48 lines
No EOL
924 B
Bash
48 lines
No EOL
924 B
Bash
#!/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" ]
|
|
then
|
|
>&2 echo "Quitting, this script has to be run as root!"
|
|
exit 1
|
|
fi
|
|
|
|
# Activate Monitor mode
|
|
trackerjacker --monitor-mode-on -i $adapter
|
|
|
|
# Run scan
|
|
timeout 60 trackerjacker -i $adapter --map
|
|
|
|
# Deactivate Monitor mode
|
|
trackerjacker --monitor-mode-off -i $adapter
|
|
|
|
# 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 |