-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPinfo.py
More file actions
executable file
·91 lines (74 loc) · 2.01 KB
/
APinfo.py
File metadata and controls
executable file
·91 lines (74 loc) · 2.01 KB
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
# Python 3
# Program to strip the APs that devices are reaching out to from a csv generated by airodump-ng
# By ariakis
import sys, os, csv
# Initialise variables
separator = "Station MAC"
doPrints = False
counter = 1
# Navigate to the correct directory and open files for read/write
inpFilename = os.path.abspath(os.path.dirname( __file__ )) + "/" + sys.argv[1]
inputFile = open(inpFilename,"r")
def maclookup(mac,ouiFile):
mac = mac.replace(':','')
mac = mac[0:6]
with open(ouiFile,'r') as ouis:
for line in ouis:
if line[12:19] == 'base 16':
if line[0:6] == mac:
vendor = line[22:-1]
return vendor
return 'n/a'
# Scroll to clients
reader = csv.reader(inputFile)
APlist = {
'WEP' : [],
'WPA' : [],
'WPA2' : [],
'WPAboth' : [],
'OPN' : []
}
for row in reader:
if (len(row) > 0): # if line not blank to prevent errs (first line is blank always)
if row[0] == separator: # only scan APs, not clients
break
elif row[0] == 'BSSID': # if header row
pass
elif '-1' in str(row[4]): # sometimes airodump messes up and doesn't collect properly - ignore these instances
pass
else:
station = row[0]
#vendor = maclookup(station,'oui.txt')
security = row[5][1:]
SSID = row[13][1:]
timeSeen = row[1]
if security == 'WEP':
APlist['WEP'].append([station,SSID])
elif security == 'WPA':
APlist['WPA'].append([station,SSID])
elif security == 'WPA2':
APlist['WPA2'].append([station,SSID])
elif security == 'WPA2 WPA':
APlist['WPAboth'].append([station,SSID])
elif security == 'OPN':
APlist['OPN'].append([station,SSID])
else:
print("unknown type",security)
exit()
# print(str(counter)+': ' + station + ' - ' + SSID + ' (' + security + ')')
counter += 1
printed = []
for key in APlist:
print(key + '(' + str(len(APlist[key])) + ')')
print()
print('-'*20)
print()
for AP in APlist[key]:
if (AP[1] not in printed) and (AP[1] != ''):
print(AP[1],end=', ')
printed.append(AP[1])
print()
print()
print('-'*20)
print()
inputFile.close()