new: working on windows arp parser ( ref #45 )

This commit is contained in:
evilsocket 2018-02-07 16:48:27 +01:00
commit 69e042ba32
4 changed files with 22 additions and 5 deletions

View file

@ -33,9 +33,17 @@ func ArpUpdate(iface string) (ArpTable, error) {
for _, line := range strings.Split(output, "\n") {
m := ArpTableParser.FindStringSubmatch(line)
if len(m) == ArpTableTokens {
address := m[ArpTableTokenIndex[0]]
mac := m[ArpTableTokenIndex[1]]
ifname := m[ArpTableTokenIndex[2]]
ipIndex := ArpTableTokenIndex[0]
hwIndex := ArpTableTokenIndex[1]
ifIndex := ArpTableTokenIndex[2]
address := m[ipIndex]
mac := m[hwIndex]
ifname := iface
if ifIndex != -1 {
ifname = m[ifIndex]
}
if ifname == iface {
newTable[address] = mac