5 def extract_values(values):
7 for key in values.keys():
9 if key in ["PrefixLength"]:
10 val += "%s" % (int(values[key]))
12 if key in ["Servers", "Excludes"]:
13 val += extract_list(values[key])
15 val += str(values[key])
19 def extract_list(list):
26 bus = dbus.SystemBus()
28 manager = dbus.Interface(bus.get_object("net.connman", "/"),
29 "net.connman.Manager")
31 properties = manager.GetProperties()
33 for key in properties.keys():
34 if key in ["OfflineMode", "SessionMode"]:
36 if properties[key] == dbus.Boolean(1):
42 print " %s" % (properties[key])
45 services = manager.GetServices()
47 for (path, properties) in services:
49 for key in properties.keys():
50 if key in ["Available", "Remember", "Default",
51 "Favorite", "Immutable", "AutoConnect",
53 "PassphraseRequired"]:
54 if properties[key] == dbus.Boolean(1):
59 elif key in ["IPv4", "IPv4.Configuration",
60 "IPv6", "IPv6.Configuration",
61 "Proxy", "Proxy.Configuration",
62 "Ethernet", "Provider"]:
63 val = extract_values(properties[key])
65 elif key in ["Nameservers", "Nameservers.Configuration",
66 "Domains", "Domains.Configuration",
68 val = extract_list(properties[key])
70 elif key in ["Strength", "Priority"]:
71 val = int(properties[key])
74 val = str(properties[key])
76 print " %s = %s" % (key, val)
78 print ("Technologies")
79 technologies = manager.GetTechnologies()
81 for (path, properties) in technologies:
83 for key in properties.keys():
85 if key in ["Connected", "Powered", "Tethering"]:
86 if properties[key] == dbus.Boolean(1):
93 print " %s = %s" % (key, val)