5 def extract_values(values):
7 for key in list(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])
14 elif key in ["Ethernet", "IPv4"]:
15 val += extract_values(values[key])
17 val += str(values[key])
21 def extract_list(list):
28 bus = dbus.SystemBus()
30 manager = dbus.Interface(bus.get_object("net.connman", "/"),
31 "net.connman.Manager")
33 for path, properties in manager.GetServices():
34 service = dbus.Interface(bus.get_object("net.connman", path),
35 "net.connman.Service")
36 identifier = path[path.rfind("/") + 1:]
37 print("[ %s ]" % (identifier))
39 for key in list(properties.keys()):
40 if key in ["IPv4", "IPv4.Configuration",
41 "IPv6", "IPv6.Configuration",
42 "Proxy", "Proxy.Configuration",
43 "Ethernet", "Provider",
44 "LastAddressConflict"]:
45 val = extract_values(properties[key])
46 elif key in ["Nameservers", "Nameservers.Configuration",
47 "Domains", "Domains.Configuration",
48 "Timeservers", "Timeservers.Configuration",
50 val = extract_list(properties[key])
51 elif key in ["Favorite", "Immutable", "AutoConnect",
52 "LoginRequired", "PassphraseRequired"]:
53 if properties[key] == dbus.Boolean(1):
57 elif key in ["Strength"]:
58 val = int(properties[key])
61 print(" %s = %s" % (key, val))