Only send names, not macs

This commit is contained in:
JonOfUs 2023-08-12 20:15:43 +02:00
parent f12194d8d9
commit 9d17358aa1
3 changed files with 12 additions and 16 deletions

View file

@ -37,8 +37,7 @@ $datetime->setTimestamp($present["timestamp"]);
foreach ($present["identities"] as $identity) { foreach ($present["identities"] as $identity) {
?> ?>
<tr> <tr>
<td><?php echo $identity["name"]; ?></td> <td><?php echo $identity; ?></td>
<td><code><?php echo $identity["mac"]; ?></code></td>
</tr> </tr>
<?php <?php
} }

View file

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
adapter=wlan0 adapter=wlan0
adapter_mon="${adapter}mon"
# Check for root privileges # Check for root privileges
if [ "$(id -u)" != "0" ] if [ "$(id -u)" != "0" ]
@ -14,14 +13,12 @@ fi
trackerjacker --monitor-mode-on -i $adapter trackerjacker --monitor-mode-on -i $adapter
# Run scan # Run scan
trackerjacker -i $adapter_mon --map timeout 60 trackerjacker -i $adapter_mon --map
# Deactivate Monitor mode # Deactivate Monitor mode
trackerjacker --monitor-mode-off -i $adapter_mon trackerjacker --monitor-mode-off -i $adapter
sleep 15
# Wait for WiFi to reconnect
sleep 20
# Filter & upload results # Filter & upload results
python upload.py python upload.py

View file

@ -8,7 +8,7 @@ import hmac
import hashlib import hashlib
IDENTITIES_PATH = "identities.yaml" IDENTITIES_PATH = "identities.yaml"
WEBHOOK_URL = "http://localhost:8080/update.php" WEBHOOK_URL = "https://cloud.flueren.eu/public/update.php"
WEBHOOK_SECRET = "CHANGE-THIS" WEBHOOK_SECRET = "CHANGE-THIS"
def parse_wifi_map(map_path): def parse_wifi_map(map_path):
@ -25,7 +25,7 @@ def parse_wifi_map(map_path):
print('mac = {}, name = {}'.format(identity['mac'],identity['name'])) print('mac = {}, name = {}'.format(identity['mac'],identity['name']))
devices = set() devices = set()
filtered_devices = [] filtered_identities = set()
# filter scan results for known identities # filter scan results for known identities
for ssid in wifi_map: for ssid in wifi_map:
@ -40,23 +40,23 @@ def parse_wifi_map(map_path):
#print('\t\tdevice = {}'.format(device)) #print('\t\tdevice = {}'.format(device))
for identity in identities: for identity in identities:
if identity['mac'] == device: if identity['mac'] == device:
filtered_devices.append(identity) filtered_identities |= (identity['name'])
#print('\n\nSSID count: {}, Device count: {}'.format(len(wifi_map), len(devices))) #print('\n\nSSID count: {}, Device count: {}'.format(len(wifi_map), len(devices)))
print('\nFiltered devices:') print('\nFiltered identities:')
print(filtered_devices) print(filtered_identities)
return filtered_devices return filtered_identities
if __name__ == '__main__': if __name__ == '__main__':
wifi_map_path = 'wifi_map.yaml' wifi_map_path = 'wifi_map.yaml'
if len(sys.argv) > 1: if len(sys.argv) > 1:
wifi_map_path = sys.argv[1] wifi_map_path = sys.argv[1]
filtered_devices = parse_wifi_map(wifi_map_path) filtered_identities = parse_wifi_map(wifi_map_path)
# build request # build request
json_payload = json.dumps(filtered_devices).encode("utf-8") json_payload = json.dumps(filtered_identities).encode("utf-8")
signature = hmac.new( signature = hmac.new(
key=bytes(WEBHOOK_SECRET, "utf-8"), key=bytes(WEBHOOK_SECRET, "utf-8"),