-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-airodump-data-extractor.py
55 lines (44 loc) · 1.46 KB
/
2-airodump-data-extractor.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
import csv
import json
import subprocess
def parse_csv_to_json(file_path):
wifi_data = []
with open(file_path, newline='') as csvfile:
csv_reader = csv.reader(csvfile)
headers = next(csv_reader)
print("[+] Reading data...")
for row in csv_reader:
if len(row) < 15:
continue
if row[0].strip() == "BSSID":
continue
try:
channel = int(row[3])
except ValueError:
continue
wifi_data.append({
"BSSID": row[0],
"First time seen": row[1],
"Last time seen": row[2],
"Channel": channel,
"Speed": int(row[4]),
"Privacy": row[5],
"Cipher": row[6],
"Authentication": row[7],
"Power": int(row[8]),
"# beacons": int(row[9]),
"# IV": int(row[10]),
"LAN IP": row[11],
"ID-length": int(row[12]),
"ESSID": row[13],
"Key": row[14]
})
return {
"wifi_data": wifi_data
}
if __name__ == "__main__":
csv_file_path = "data/wifi_data-01.csv"
parsed_data = parse_csv_to_json(csv_file_path)
with open("data/wifi_data.json", "w") as outfile:
json.dump(parsed_data, outfile, indent=2)
print("[+] Data parsed and saved into: data/wifi_data.json")