Skip to content

Instantly share code, notes, and snippets.

View donalod's full-sized avatar
🏠
Building PanSift so you can WFH

Donal donalod

🏠
Building PanSift so you can WFH
View GitHub Profile
@donalod
donalod / wifi.sh
Last active August 29, 2015 14:06
WiFi Debugging on OSX
#!/usr/bin/env bash
# Remember to change the "Podomere" SSID to name grab your preferred/connected SSIDs
# Also update the default gateway!
# Change to a SpeedTest server near you from http://www.speedtest.net/speedtest-servers.php
# Pick a small file http://lowendtalk.com/discussion/2178/speed-test-files-1-300-locations
# And run this file from a wifitest directory and put it in your crontab for every minute!
# Note: add your BSSID,APname in to a file called "bssidsapnames.txt" in the same directory!!
# Yes this is a quick and nasty script! All improvements welcome including shortening :)
@donalod
donalod / 2014-09-19_08.06.16.00.txt
Last active August 29, 2015 14:06
WiFi.sh Example Output
2014-09-19_08.06.16 ======NewFile======
2014-09-19_08.06.16 ======Begin=======
2014-09-19_08.06.16 Country Code: DE
2014-09-19_08.06.16 Status: Connected
2014-09-19_08.06.16 PHY Mode: 802.11n
2014-09-19_08.06.16 Channel: 48,-1
2014-09-19_08.06.16 Country Code: DE
2014-09-19_08.06.16 Signal / Noise: -51 dBm / -88 dBm
2014-09-19_08.06.16 Transmit Rate: 300
2014-09-19_08.06.16 MCS Index: 15
@donalod
donalod / gnuplot.conf
Created September 21, 2014 20:02
GNUPlot
# This is just a gnuplot conf file I have been using on some manipulated data from the Wifi.sh script results.
# First I parse out the high and low SNR to separate files and also slightly reformat the columns and then apply
# the below...
#
set terminal png size 2000, 800
set title "Normal SNR = 20 - 50dBm"
set output "snr_1.png"
set xdata time
set timefmt "%Y-%m-%d_%H.%M.%S"
set xlabel "Time"
@donalod
donalod / utctoaest.sh
Last active August 29, 2015 14:06
LogMashJuniperPoETelemetry
#!/usr/bin/env bash
# This script takes the input from a manual PoE dump of telemetries of interfaces on a Juniper EX2200.
# As the date command is doing a parsing function that only GNU date can do, this bit must be
# run on linux or some such and not OSX. Your log file name in this example would be 'p'.
while read line; do
#echo "$line"
cleanline=$(echo $line|tr -s ' '|cut -f2,3,5,6 -d" ")
#echo "$cleanline"
date=$(echo $cleanline| cut -f1 -d" ")
@donalod
donalod / upstognuplot.sh
Created September 22, 2014 14:18
APCUPSLogsToGNUPlot
#!/usr/bin/env bash
grep -i "UPS:" ./u > u1
statehigh=""
statelow=""
while read line; do
#echo "$line"
cleanline=$(echo $line|tr -s ' ')
@donalod
donalod / gnuplot.conf
Last active August 29, 2015 14:06
GNUPlotConf
set terminal png size 2000, 800
set title "West Side Channel 161 and Channel 52 Normal SNR = 20 - 50dBm"
set output "snr_201014.png"
set xdata time
set timefmt "%Y-%m-%d_%H.%M.%S"
set xlabel "Time"
set key left center
set grid
set bmargin at screen 0.2
set xtics format "%b %d %H:%M"
@donalod
donalod / kplot.conf
Created October 21, 2014 15:38
GNUPlotConf
set terminal png size 2048, 800
set title "Normal SNR = 20 - 50dBm"
set output "snr_190914-141014.png"
set xdata time
set timefmt "%Y-%m-%d_%H.%M.%S"
set xlabel "Time"
set key center center
set grid
set bmargin at screen 0.2
set xtics format "%b %d -- %H:%M"
@donalod
donalod / basicsharking1
Last active August 29, 2015 14:08
tsharking802.11
Wireshark/tshark onboard for deeper troubleshooting on OSX?
Monitor Mode (disruptive) for 802.11 Management and Control Frames which contain much richer data about signal, capabilities, other nodes etc..
Note: Testing for more specific/useful frames but right now we just want access to some richer data that can be easily manipulated when a user or network has issues i.e. when "/usr/sbin/system_profiler SPAirPortDataType" and "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport" are not enough (as per https://gist.github.com/donalod/ba467ffdb2a2531cd13e )
/usr/local/bin/tshark -i en1 -I -L
Data link types of interface en1 when in monitor mode (use option -y to set):
IEEE802_11_RADIO (802.11 plus radiotap header)
PPI (Per-Packet Information)
IEEE802_11 (802.11)
@donalod
donalod / WiFiTermGraph
Last active August 29, 2015 14:08
WiFiRetriesTerminalGraph
# In one terminal run the below (ensuring you have *wireshark/tshark* installed)...
# or you can backround the process too of course with '&' or 'screen'...
# but remember this will put your OSX radio in monitor mode until you stop the process :)
/usr/local/bin/tshark -q -i en1 -I -y IEEE802_11_RADIO -Tfields -e wlan.fc.retry > retries.dat
# In another terminal run the following (or create a script file) + ensure you have *gnuplot* installed :)
while true ; do tail -n 200 retries.dat | gnuplot -e "set term dumb size 100,40; set yrange [0:1.5]; plot '-' with linespoints" ; sleep 1 ; done
@donalod
donalod / WiFiPerfLinerBasic
Last active August 29, 2015 14:08
WiFiPerfLiners
# Get your currently connected BSSID mac address on your Apple MAC OSX device via:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep -i bssid | awk '{print $2}'
# Then get your own 'target' address:
ifconfig en1 | grep ether | awk '{print $2}'
# And add them in to the below 'tshark' filter line:
/usr/local/bin/tshark -q -l -i en1 -I -y IEEE802_11_RADIO -Y '(wlan.bssid==b4:18:d1:e0:5d:39 and ((wlan[0] != 0x80 and wlan[0] != 0x50 and wlan[0] != 0x40 and wlan[0] != 0xd4) and (wlan.sa==68:a8:6d:4c:76:fc or wlan.ra==68:a8:6d:4c:76:fc or wlan.ta==b4:18:d1:e0:5d:39 or wlan.da==68:a8:6d:4c:76:fc)))' -Tfields -e radiotap.dbm_antsignal -e radiotap.dbm_antnoise -E separator=" " | awk '{print $1" - "$2; system("")}' | bc -q > signal.dat