summaryrefslogtreecommitdiff
path: root/haircontrol/inspectors.py
blob: 9b797fe0cdf8a6db8dab0658e4d03a167665c95a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import re

class Inspector():
    cmds = {}
    fd = None

    def parse(self):
        return None #XXX Implement

class LinuxInspector(Inspector):
    cmds = {
            'ip-neigh': {
                'cmd': 'ip neigh',
                # fe80::8300 dev eth1 lladdr 10:fe:ed:f1:e1:f3 router STALE
                # 172.16.20.210 dev eth1 lladdr c0:4a:00:fe:1f:87 REACHABLE
                'kind': 'text',
                'fields': ['ip','ifname','mac'],
                're': re.compile("(?P<ip>[a-f0-9:.]+) dev (?P<ifname>.*) lladdr (?P<mac>[a-f0-9:]*)")
            }
    }