Created
February 8, 2019 19:22
-
-
Save JoshuaCurry/eb6ec66569c6ec8ad29794fb4fe7bace to your computer and use it in GitHub Desktop.
Gets info about currently associated AP from Aironet Extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import json | |
#Run tshark, get single beacon frame, decode fields we want. | |
#Should be only thing on current association frequency beaconing hopefully. | |
#I can't be bothered with subprocess, cheat. | |
os.system("tshark -I -i en0 -f 'type mgt subtype beacon' -Tjson -e 'wlan.cisco.ccx1.name' -e 'wlan.cisco.ccx1.clients' -e 'wlan_radio.frequency' -e 'wlan_radio.signal_dbm' -e 'wlan_radio.noise_dbm' -c 1 -Q > /tmp/tsout1 2>/dev/null") | |
f = open("/tmp/tsout1", "r") | |
inp = ''.join(f.readlines()) | |
fields = json.loads(inp) | |
f.close() | |
#Grab the fields | |
name = fields[0]['_source']['layers']['wlan.cisco.ccx1.name'][0] | |
clients = fields[0]['_source']['layers']['wlan.cisco.ccx1.clients'][0] | |
frequency = fields[0]['_source']['layers']['wlan_radio.frequency'][0] | |
signal = fields[0]['_source']['layers']['wlan_radio.signal_dbm'][0] | |
noise = fields[0]['_source']['layers']['wlan_radio.noise_dbm'][0] | |
#Print the fields | |
print ("Associated AP: "+name) | |
print ("Connected Clients: "+clients) | |
print ("Frequency: "+frequency) | |
print ("Signal dB: "+signal) | |
print ("Noise dB: "+noise) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment