Try to restart network if it fails first time
This commit is contained in:
parent
22dc20d7f8
commit
1cf3c49672
2 changed files with 39 additions and 9 deletions
20
README.md
20
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`
|
||||
- `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.
|
|
@ -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
|
||||
|
||||
# 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
|
Loading…
Reference in a new issue