Skip to content
This repository was archived by the owner on Sep 4, 2022. It is now read-only.

Commit 9ac4c1e

Browse files
Add uptime and wlan mode fields
1 parent cb6ef2d commit 9ac4c1e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

ubnt_discovery.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,30 @@
1919
UBNT_MAC = '01'
2020
UBNT_MAC_AND_IP = '02'
2121
UBNT_FIRMWARE = '03'
22-
UBNT_UNKNOWN_2 = '0a'
22+
UBNT_UPTIME = '0a'
2323
UBNT_RADIONAME = '0b'
2424
UBNT_MODEL_SHORT = '0c'
2525
UBNT_ESSID = '0d'
26-
UBNT_UNKNOWN_3 = '0e'
26+
UBNT_WLAN_MODE = '0e'
2727
UBNT_UNKNOWN_1 = '10'
2828
UBNT_MODEL_FULL = '14'
2929

3030
# UBNT discovery packet payload and reply signature
3131
UBNT_REQUEST_PAYLOAD = '01000000'
3232
UBNT_REPLY_SIGNATURE = '010000'
3333

34+
35+
# Wirelss modes
36+
UBNT_WIRELESS_MODES ={
37+
'\x00': "Auto",
38+
'\x01': "adhoc",
39+
'\x02': "Station",
40+
'\x03': "AP",
41+
'\x04': "Repeater",
42+
'\x05': "Secondary",
43+
'\x06': "Monitor",
44+
};
45+
3446
# Offset within the payload that contains the amount of bytes remaining
3547
offset_PayloadRemainingBytes = 3
3648

@@ -121,8 +133,12 @@ def ubntDiscovery():
121133
RadioModelShort = fieldData
122134
elif fieldType == UBNT_FIRMWARE:
123135
RadioFirmware = fieldData
136+
elif fieldType == UBNT_UPTIME:
137+
RadioUptime = int(fieldData.encode('hex'), 16)
124138
elif fieldType == UBNT_ESSID:
125139
RadioEssid = fieldData
140+
elif fieldType == UBNT_WLAN_MODE:
141+
RadioWlanMode = UBNT_WIRELESS_MODES[fieldData]
126142
# We don't know or care about other field types. Continue walking the payload.
127143
pointer += fieldLen
128144
remaining_bytes -= fieldLen

0 commit comments

Comments
 (0)