diff --git a/README.md b/README.md index 171a8d2..32cc93d 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,19 @@ Sets the wifi adapter into monitor mode, then listens to surrounding packets lis Shows the last update of the `upload.py` routine. It also allows to add identities by their name and mac and to delete identities by their mac. The mac addresses are hashed server-side and then stored into the world-accessible `identities.json`. ## Set-up -Dependencies: Python3, trackerjacker (pip3), php (front-end) +Dependencies: +- Scanner: Python3, trackerjacker (pip3) +- Website: php + Configs to change: -- system-specific wifi commands in `scan.sh` -- identities URL in `upload.py` -- webhook URL and secret in `upload.py` -- webhook secret in `public/update.php` \ No newline at end of file +- `scanner/scan.sh`: + - WiFi adapter name + - network restart routines +- `scanner/upload.py`: + - URLs for webhook and identities + - webhook secret +- `public/update.php`: + - webhook secret + +Put `scanner` onto the scanning device (e.g. Raspberry Pi) and put `scanner/scan.sh` into a cron job. +Put `website` onto a php-capable webserver and point your domain to it. \ No newline at end of file diff --git a/scanner/scan.sh b/scanner/scan.sh index dfc44f6..b071021 100644 --- a/scanner/scan.sh +++ b/scanner/scan.sh @@ -1,6 +1,11 @@ #!/bin/bash adapter=wlan0 +conn_test_url=http://www.google.com + +restart_network() { + systemctl restart wpa_supplicant +} # Check for root privileges if [ "$(id -u)" != "0" ] @@ -18,11 +23,26 @@ timeout 60 trackerjacker -i $adapter --map # Deactivate Monitor mode trackerjacker --monitor-mode-off -i $adapter -# Wait for wifi to reconnect -sleep 15 +# Test network & try to restart if it fails +for i in 1 2 3 4 5 +do + sleep 10 + wget -q --spider $conn_test_url && break -# Filter & upload results -python upload.py + # no internet connection + echo "No internet - restarting network" + restart_network +done + +# Network restarted up to 5 times, last test for connectivity +wget -q --spider $conn_test_url + +if [ $? -eq 0 ]; then + # Filter & upload results + python upload.py +else + echo "ERROR: no network connection" +fi # Remove old scan results rm wifi_map.yaml \ No newline at end of file