2016-04-28 01:27:25 +02:00
|
|
|
#!/usr/bin/python3
|
2015-03-26 06:11:18 +01:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import dbus
|
|
|
|
|
|
|
|
bus = dbus.SystemBus()
|
|
|
|
|
|
|
|
manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"),
|
2016-05-21 03:39:37 +02:00
|
|
|
"org.freedesktop.DBus.ObjectManager")
|
|
|
|
objects = manager.GetManagedObjects()
|
|
|
|
|
|
|
|
for path in objects:
|
|
|
|
if 'net.connman.iwd.Device' not in objects[path]:
|
|
|
|
continue
|
|
|
|
|
|
|
|
device = objects[path]['net.connman.iwd.Device']
|
2015-03-26 06:11:18 +01:00
|
|
|
|
|
|
|
print("[ %s ]" % path)
|
|
|
|
|
2016-05-21 03:39:37 +02:00
|
|
|
for key in device.keys():
|
|
|
|
val = device[key]
|
2015-03-26 06:11:18 +01:00
|
|
|
print(" %s = %s" % (key, val))
|
|
|
|
|
|
|
|
print(" Networks:")
|
|
|
|
|
2016-05-21 03:39:37 +02:00
|
|
|
for path2 in objects:
|
|
|
|
if not path2.startswith(path) or \
|
|
|
|
'net.connman.iwd.Network' not in objects[path2]:
|
|
|
|
continue
|
|
|
|
|
|
|
|
network = objects[path2]['net.connman.iwd.Network']
|
|
|
|
|
|
|
|
print(" [ %s ]" % path2)
|
2015-03-26 06:11:18 +01:00
|
|
|
|
2016-05-21 03:39:37 +02:00
|
|
|
for key in network.keys():
|
2015-03-26 06:11:18 +01:00
|
|
|
if key in ["SSID"]:
|
2016-05-21 03:39:37 +02:00
|
|
|
val = network[key]
|
2015-03-26 06:11:18 +01:00
|
|
|
val = "".join(map(chr, val))
|
|
|
|
else:
|
2016-05-21 03:39:37 +02:00
|
|
|
val = network[key]
|
2015-03-26 06:11:18 +01:00
|
|
|
|
|
|
|
print(" %s = %s" % (key, val))
|