mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-07 04:34:04 -05:00
Add handling of BSSAdded and BSSRemoved events
This commit is contained in:
parent
58c26600ca
commit
c9df730b03
@ -32,17 +32,8 @@ def list_interfaces(wpas_obj):
|
|||||||
def stateChanged(newState, oldState):
|
def stateChanged(newState, oldState):
|
||||||
print "StateChanged(%s -> %s)" % (oldState, newState)
|
print "StateChanged(%s -> %s)" % (oldState, newState)
|
||||||
|
|
||||||
def scanDone(success):
|
def showBss(bss):
|
||||||
gobject.MainLoop().quit()
|
net_obj = bus.get_object(WPAS_DBUS_SERVICE, bss)
|
||||||
print "Scan done: success=%s" % success
|
|
||||||
|
|
||||||
res = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'BSSs',
|
|
||||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
|
||||||
|
|
||||||
print "Scanned wireless networks:"
|
|
||||||
for opath in res:
|
|
||||||
print opath
|
|
||||||
net_obj = bus.get_object(WPAS_DBUS_SERVICE, opath)
|
|
||||||
net = dbus.Interface(net_obj, WPAS_DBUS_BSS_INTERFACE)
|
net = dbus.Interface(net_obj, WPAS_DBUS_BSS_INTERFACE)
|
||||||
props = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'Properties',
|
props = net_obj.Get(WPAS_DBUS_BSS_INTERFACE, 'Properties',
|
||||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||||
@ -72,6 +63,25 @@ def scanDone(success):
|
|||||||
|
|
||||||
print " %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq)
|
print " %s :: ssid='%s' wpa=%s wpa2=%s quality=%d%% rate=%d freq=%d" % (bssid, ssid, wpa, wpa2, qual, maxrate, freq)
|
||||||
|
|
||||||
|
def scanDone(success):
|
||||||
|
gobject.MainLoop().quit()
|
||||||
|
print "Scan done: success=%s" % success
|
||||||
|
|
||||||
|
res = if_obj.Get(WPAS_DBUS_INTERFACES_INTERFACE, 'BSSs',
|
||||||
|
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||||
|
|
||||||
|
print "Scanned wireless networks:"
|
||||||
|
for opath in res:
|
||||||
|
print opath
|
||||||
|
showBss(opath)
|
||||||
|
|
||||||
|
def bssAdded(bss):
|
||||||
|
print "BSS added: %s" % (bss)
|
||||||
|
showBss(bss)
|
||||||
|
|
||||||
|
def bssRemoved(bss):
|
||||||
|
print "BSS removed: %s" % (bss)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||||
global bus
|
global bus
|
||||||
@ -81,6 +91,12 @@ def main():
|
|||||||
bus.add_signal_receiver(scanDone,
|
bus.add_signal_receiver(scanDone,
|
||||||
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
||||||
signal_name="ScanDone")
|
signal_name="ScanDone")
|
||||||
|
bus.add_signal_receiver(bssAdded,
|
||||||
|
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
||||||
|
signal_name="BSSAdded")
|
||||||
|
bus.add_signal_receiver(bssRemoved,
|
||||||
|
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
||||||
|
signal_name="BSSRemoved")
|
||||||
bus.add_signal_receiver(stateChanged,
|
bus.add_signal_receiver(stateChanged,
|
||||||
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
|
||||||
signal_name="StateChanged")
|
signal_name="StateChanged")
|
||||||
|
Loading…
Reference in New Issue
Block a user