Returns all devices on system with their ipv4 ip netmask
()
| 115 | |
| 116 | |
| 117 | def get_device_info(): |
| 118 | """ Returns all devices on system with their ipv4 ip netmask """ |
| 119 | list = [] |
| 120 | mtu = None |
| 121 | for i in execute("ip addr show |grep -v secondary"): |
| 122 | vals = i.strip().lstrip().rstrip().split() |
| 123 | if re.search('[0-9]:', vals[0]): |
| 124 | mtu = vals[4] |
| 125 | |
| 126 | if vals[0] == "inet": |
| 127 | to = {} |
| 128 | to['ip'] = vals[1] |
| 129 | to['dev'] = vals[-1] |
| 130 | to['network'] = IPNetwork(to['ip']) |
| 131 | to['dnsmasq'] = False |
| 132 | if mtu: |
| 133 | to['mtu'] = mtu |
| 134 | list.append(to) |
| 135 | return list |
| 136 | |
| 137 | |
| 138 | def get_domain(): |