-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount_wifi_lines.py
More file actions
36 lines (29 loc) · 1.08 KB
/
count_wifi_lines.py
File metadata and controls
36 lines (29 loc) · 1.08 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
#!/usr/bin/env python3
import os
folder = "/Users/lina/Desktop/ba-implementation/train/5d27075f03f801723c2e360f/F1/"
category_counts = {}
total_lines_without_hash = 0
unique_ssids = set()
unique_bssids = set()
rssi_values = []
# Read the file and extract SSIDs and BSSIDs for TYPE_WIFI category
with open(os.path.join(folder, "aggregated.txt"), "r") as file:
for line in file:
if not line.strip().startswith("#"):
total_lines_without_hash += 1
columns = line.split()
if len(columns) > 1:
category = columns[1]
category_counts[category] = category_counts.get(category, 0) + 1
if len(columns) > 4 and columns[1] == "TYPE_WIFI":
ssid = columns[2]
bssid = columns[3]
unique_ssids.add(ssid)
unique_bssids.add(bssid)
rssi = int(columns[4])
rssi_values.append(rssi)
category_counts, total_lines_without_hash
min_rssi = min(rssi_values)
max_rssi = max(rssi_values)
min_rssi, max_rssi
len(unique_ssids), len(unique_bssids)