Skip to content

Instantly share code, notes, and snippets.

@mdukat
Created June 21, 2019 17:14
Show Gist options
  • Save mdukat/2acdb774a30025fde386cc84265668f3 to your computer and use it in GitHub Desktop.
Save mdukat/2acdb774a30025fde386cc84265668f3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Simple wifi data logger
# d3s
pingSite='onet.pl'
wifiName=$(nmcli connection show | head -2 | tail -1 | sed 's/ .*//g')
echo $wifiName
wifiIp=$(curl -s https://ipinfo.io/ip)
echo $wifiIp
wifiData=$(curl -s https://ipvigilante.com/${wifiIp})
wifiLong=$(echo $wifiData | jq '.data.longitude')
echo $wifiLong
wifiLati=$(echo $wifiData | jq '.data.latitude')
echo $wifiLati
wifiPing=$(ping -c 1 ${pingSite} | head -2 | tail -1 | sed 's/.*time=//; s/ .*//')
echo $wifiPing
# CSV:
# 1 2 3 4 5
# Wifi SSID IP Longitude Latitude Ping (ms)
echo "\"${wifiName}\";${wifiIp};${wifiLong};${wifiLati};${wifiPing}" >> wardrive.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment