add wardrive
This commit is contained in:
parent
e2a1b5bb2b
commit
db879f6854
2 changed files with 80 additions and 0 deletions
59
angry_scripts/setupWardrive.sh
Normal file
59
angry_scripts/setupWardrive.sh
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
function yes_or_no {
|
||||
while true; do
|
||||
read -p "$*Are you using GPSD Forwarder?[y/n]: " yn
|
||||
case $yn in
|
||||
[Yy]*) GPSD_FORWARDER=true; return ;;
|
||||
[Nn]*) GPSD_FORWARDER=false; return ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function create_service {
|
||||
echo "Creating new wardrive.service at ~/wardrive.service"
|
||||
|
||||
cat << EOF > ~/wardrive.service
|
||||
[Unit]
|
||||
Description=AngryOxide Wardrive
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/bash $HOME/wardrive.sh $WLAN_DEVICE $(if [[ "$GPSD_FORWARDER" == "true" ]]; then echo $GPSD_FORWARDER_SETTINGS; fi)
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=Wardrive
|
||||
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
}
|
||||
|
||||
sudo apt install gpsd
|
||||
|
||||
echo "Enter your wireless device name (default: wlan1):"
|
||||
read -r WLAN_DEVICE
|
||||
WLAN_DEVICE="${WLAN_DEVICE:-wlan1}"
|
||||
GPS_DEVICE=false
|
||||
GPSD_FORWARDER=false
|
||||
|
||||
yes_or_no $forwarder
|
||||
|
||||
IP=""
|
||||
PORT=""
|
||||
|
||||
# Add error handling for IP and port
|
||||
if [ $GPSD_FORWARDER=true ]; then
|
||||
read -p "Enter the IP of your GPSD Forwarder Server: " IP
|
||||
read -p "Enter the PORT of your GPSD Forwarder Server: " PORT
|
||||
fi
|
||||
GPSD_FORWARDER_SETTINGS=$IP:$PORT
|
||||
create_service
|
||||
|
||||
sudo mv ~/wardrive.service /etc/systemd/system/wardrive.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable wardrive.service
|
||||
21
angry_scripts/wardrive.sh
Normal file
21
angry_scripts/wardrive.sh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
WLAN_DEVICE=$1
|
||||
GPS_FORWARDER_SETTINGS=$2
|
||||
|
||||
pkill gpsd
|
||||
gpsd -n /dev/ttyACM0
|
||||
sleep 1
|
||||
|
||||
UTCDATE=`gpspipe -w | grep -m 1 "TPV" | sed -r 's/.*"time":"([^"]*)".*/\1/' | sed -e 's/^\(.\{10\}\)T\(.\{8\}\).*/\1 \2/'`
|
||||
date -u -s "$UTCDATE"
|
||||
|
||||
if [ -z $GPS_FORWARDER_SETTINGS ]; then
|
||||
angryoxide -i $WLAN_DEVICE --notransmit --headless --autoexit
|
||||
else
|
||||
angryoxide -i $WLAN_DEVICE --notransmit --headless --autoexit --gpsd $GPS_FORWARDER_SETTINGS
|
||||
|
||||
fi
|
||||
|
||||
Loading…
Reference in a new issue