fix: better ipv6 detection logic

This commit is contained in:
Simone Margaritelli 2024-09-22 15:03:06 +02:00
parent 8446d66d12
commit a234c20650
5 changed files with 30 additions and 12 deletions

View file

@ -6,6 +6,7 @@ import (
"sync"
"github.com/bettercap/bettercap/v2/core"
"github.com/bettercap/bettercap/v2/log"
)
type ArpTable map[string]string
@ -33,6 +34,7 @@ func ArpUpdate(iface string) (ArpTable, error) {
for _, line := range strings.Split(output, "\n") {
m := ArpTableParser.FindStringSubmatch(line)
if len(m) == ArpTableTokens {
log.Debug("ARP TABLE MATCH: %v", m)
ipIndex := ArpTableTokenIndex[0]
hwIndex := ArpTableTokenIndex[1]
ifIndex := ArpTableTokenIndex[2]
@ -46,6 +48,7 @@ func ArpUpdate(iface string) (ArpTable, error) {
}
if ifname == iface {
log.Debug(" %s = %s", address, mac)
newTable[address] = mac
}
}