mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: working on windows arp parser ( ref #45 )
This commit is contained in:
parent
318932453c
commit
69e042ba32
4 changed files with 22 additions and 5 deletions
14
net/arp.go
14
net/arp.go
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue