def call(self, batadv_dev): return (lambda fields: dict( (key, dict((type_, int(value_)) for key_, type_, value_ in fields if key_ == key)) for key in ['rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx']))(list( (key.replace('_bytes', '').replace('_dropped', ''), 'bytes' if key.endswith('_bytes') else 'dropped' if key. endswith('_dropped') else 'packets', value) for key, value in map( lambda s: list(map(str.strip, s.split(': ', 1))), call(['ethtool', '-S', batadv_dev])[1:])))
def call(self, batadv_dev): return { batadv_dev: { "interfaces": { "tunnel": [ open('/sys/class/net/{}/address'.format( iface)).read().strip() for iface in map( lambda line: line.split(':')[0], call(['batctl', 'meshif', batadv_dev, 'if'])) ] } } }
def call(self, batadv_dev): return { batadv_dev: { "interfaces": { "tunnel": [ open('/sys/class/net/{}/address'.format(iface)).read().strip() for iface in map( lambda line: line.split(':')[0], call(['batctl', '-m', batadv_dev, 'if']) ) ] } } }
def call(self, batadv_dev): lines = call(['batctl', '-m', batadv_dev, 'o']) neighbours = {} prefix_lower = '/sys/class/net/{}/lower_'.format(batadv_dev) for dev in glob(prefix_lower + '*'): ifname = dev[len(prefix_lower):] mac = open(dev + '/address').read().strip() ifneighbours = {} for line in lines[2:]: for s in ['(', ')', '[', ']:', ']', '*']: line = line.replace(s, '') fields = line.split() if fields[4] == ifname and fields[0] == fields[3]: ifneighbours[fields[0]] = {'lastseen': float(fields[1].strip('s')), 'tq': int(fields[2])} neighbours[mac] = {'neighbours': ifneighbours} return neighbours
def call(self, batadv_dev): return (lambda fields: dict( (key, dict( (type_, int(value_)) for key_, type_, value_ in fields if key_ == key)) for key in ['rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx'] ) )(list( ( key.replace('_bytes', '').replace('_dropped', ''), 'bytes' if key.endswith('_bytes') else 'dropped' if key.endswith('_dropped') else 'packets', value ) for key, value in map(lambda s: list(map(str.strip, s.split(': ', 1))), call(['ethtool', '-S', batadv_dev])[1:]) ))
def call(self, batadv_dev): lines = call(['batctl', 'meshif', batadv_dev, 'o', '-nH']) neighbours = {} prefix_lower = '/sys/class/net/{}/lower_'.format(batadv_dev) for dev in glob(prefix_lower + '*'): ifname = dev[len(prefix_lower):] mac = open(dev + '/address').read().strip() ifneighbours = {} for line in lines: for s in ['(', ')', '[', ']:', ']', '*']: line = line.replace(s, '') fields = line.split() if fields[4] == ifname and fields[0] == fields[3]: ifneighbours[fields[0]] = { 'lastseen': float(fields[1].strip('s')), 'tq': int(fields[2]) } neighbours[mac] = {'neighbours': ifneighbours} return neighbours
def call(self): return call(['lsb_release','-is'])[0]
def call(self): return call(['lsb_release', '-rs'])[0]
def call(self): return call(['fastd','-v'])[0].split(' ')[1]
def call(self): return call(['fastd', '-v'])[0].split(' ')[1]
def call(self, vpn_protos): if 'fastd' in vpn_protos: return call(['fastd', '-v'])[0].split(' ')[1]