14ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor#!/usr/bin/python 24ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 34ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregorimport dbus 44ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregorimport sys, os 54ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregorimport time 64ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregorimport gobject 74ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 84ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregordef main(): 94ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor bus = dbus.SystemBus() 104ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor wpas_obj = bus.get_object("fi.w1.wpa_supplicant1", 114ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor "/fi/w1/wpa_supplicant1") 124ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor props = wpas_obj.GetAll("fi.w1.wpa_supplicant1", 134ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 144ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print "GetAll(fi.w1.wpa_supplicant1, /fi/w1/wpa_supplicant1):" 154ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print props 164ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 178f7c540ac42370c40ebcdc4b69018c938faf94ecArgyrios Kyrtzidis if len(sys.argv) != 2: 1830a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth os._exit(1) 1930a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth 20b9e1b75772db2c7db566c6034ba90a07f22e35ebDouglas Gregor ifname = sys.argv[1] 21f226ff9fe8c8db6c5b74a61ce649eda1491c3502Argyrios Kyrtzidis 2230a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth wpas = dbus.Interface(wpas_obj, "fi.w1.wpa_supplicant1") 234ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor path = wpas.GetInterface(ifname) 24aa49a7d70e58dac2aeb40664ba16d2ea571b8c95Daniel Dunbar if_obj = bus.get_object("fi.w1.wpa_supplicant1", path) 254ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor props = if_obj.GetAll("fi.w1.wpa_supplicant1.Interface", 264ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 274ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print 284ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print "GetAll(fi.w1.wpa_supplicant1.Interface, %s):" % (path) 29c515978bd3a703aa733f846a0094ffa84d149074Argyrios Kyrtzidis print props 304ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 314ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor props = if_obj.GetAll("fi.w1.wpa_supplicant1.Interface.WPS", 324ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 334ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print 344ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print "GetAll(fi.w1.wpa_supplicant1.Interface.WPS, %s):" % (path) 354ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print props 364ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 374ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor res = if_obj.Get("fi.w1.wpa_supplicant1.Interface", 'BSSs', 384ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 394ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor if len(res) > 0: 404ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor bss_obj = bus.get_object("fi.w1.wpa_supplicant1", res[0]) 414ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor props = bss_obj.GetAll("fi.w1.wpa_supplicant1.BSS", 42bf7efa2742dc94363d3561d284c9d634fc5a780fDouglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 43ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor print 44bf7efa2742dc94363d3561d284c9d634fc5a780fDouglas Gregor print "GetAll(fi.w1.wpa_supplicant1.BSS, %s):" % (res[0]) 454ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor print props 469e5bb85ac899eeab7c21b5ff9030c3da6ff4837bChandler Carruth 474ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor res = if_obj.Get("fi.w1.wpa_supplicant1.Interface", 'Networks', 484ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor dbus_interface=dbus.PROPERTIES_IFACE) 494ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor if len(res) > 0: 504ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor net_obj = bus.get_object("fi.w1.wpa_supplicant1", res[0]) 51e24692b30adbe8144597678a0e3354912e99c747Argyrios Kyrtzidis props = net_obj.GetAll("fi.w1.wpa_supplicant1.Network", 52e24692b30adbe8144597678a0e3354912e99c747Argyrios Kyrtzidis dbus_interface=dbus.PROPERTIES_IFACE) 53e24692b30adbe8144597678a0e3354912e99c747Argyrios Kyrtzidis print 549e5bb85ac899eeab7c21b5ff9030c3da6ff4837bChandler Carruth print "GetAll(fi.w1.wpa_supplicant1.Network, %s):" % (res[0]) 559e5bb85ac899eeab7c21b5ff9030c3da6ff4837bChandler Carruth print props 564ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 575555bf78e0a76337f7149669723bf4f3f9ddbc1cArgyrios Kyrtzidisif __name__ == "__main__": 585555bf78e0a76337f7149669723bf4f3f9ddbc1cArgyrios Kyrtzidis main() 594ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor 604ae8f298b1ea51b4c2234f9148e2e4349c9bdd23Douglas Gregor