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 for path, properties in manager.GetServices():
32 service = dbus.Interface(bus.get_object("net.connman", path),
33 "net.connman.Service")
34 identifier = path[path.rfind("/") + 1:]
35 print "[ %s ]" % (identifier)
37 for key in properties.keys():
38 if key in ["IPv4", "IPv4.Configuration",
39 "IPv6", "IPv6.Configuration",
40 "Proxy", "Proxy.Configuration",
41 "Ethernet", "Provider"]:
42 val = extract_values(properties[key])
43 elif key in ["Nameservers", "Nameservers.Configuration",
44 "Domains", "Domains.Configuration",
45 "Timeservers", "Timeservers.Configuration",
47 val = extract_list(properties[key])
48 elif key in ["Favorite", "Immutable", "AutoConnect",
49 "LoginRequired", "PassphraseRequired"]:
50 if properties[key] == dbus.Boolean(1):
54 elif key in ["Strength"]:
55 val = int(properties[key])
58 print " %s = %s" % (key, val)