7 from dbus.mainloop.glib import DBusGMainLoop
9 WPAS_DBUS_SERVICE = "fi.w1.wpa_supplicant1"
10 WPAS_DBUS_INTERFACE = "fi.w1.wpa_supplicant1"
11 WPAS_DBUS_OPATH = "/fi/w1/wpa_supplicant1"
12 WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface"
15 print "Usage: %s <ifname>" % sys.argv[0]
16 print "Press Ctrl-C to stop"
18 def ProbeRequest(args):
20 print '%.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['addr']),
22 print '-> %.2x:%.2x:%.2x:%.2x:%.2x:%.2x' % tuple(args['dst']),
24 print '(bssid %.2x:%.2x:%.2x:%.2x:%.2x:%.2x)' % tuple(args['dst']),
26 print 'signal:%d' % args['signal'],
28 print 'have IEs (%d bytes)' % len(args['ies']),
31 if __name__ == "__main__":
37 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
39 bus = dbus.SystemBus()
40 wpas_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
42 # Print list of i/f if no one is specified
43 if (len(sys.argv) < 2) :
47 wpas = dbus.Interface(wpas_obj, WPAS_DBUS_INTERFACE)
51 path = wpas.GetInterface(ifname)
53 if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
54 iface = dbus.Interface(if_obj, WPAS_DBUS_INTERFACES_INTERFACE)
56 bus.add_signal_receiver(ProbeRequest,
57 dbus_interface=WPAS_DBUS_INTERFACES_INTERFACE,
58 signal_name="ProbeRequest")
60 iface.SubscribeProbeReq()
62 gobject.MainLoop().run()