mirror of
https://github.com/bettercap/bettercap
synced 2025-07-13 16:43:49 -07:00
balls
This commit is contained in:
parent
6e6eb688d7
commit
1cffa33264
7 changed files with 74 additions and 75 deletions
|
@ -6,19 +6,19 @@ import (
|
|||
)
|
||||
|
||||
func ArpUpdate(iface string) (ArpTable, error) {
|
||||
arp_lock.Lock()
|
||||
defer arp_lock.Unlock()
|
||||
arpLock.Lock()
|
||||
defer arpLock.Unlock()
|
||||
|
||||
// Signal we parsed the ARP table at least once.
|
||||
arp_parsed = true
|
||||
arpWasParsed = true
|
||||
|
||||
// Run "arp -an" (darwin) or "ip neigh" (linux) and parse the output
|
||||
output, err := core.Exec(ArpCmd, ArpCmdOpts)
|
||||
if err != nil {
|
||||
return arp_table, err
|
||||
return arpTable, err
|
||||
}
|
||||
|
||||
new_table := make(ArpTable)
|
||||
newTable := make(ArpTable)
|
||||
for _, line := range strings.Split(output, "\n") {
|
||||
m := ArpTableParser.FindStringSubmatch(line)
|
||||
if len(m) == ArpTableTokens {
|
||||
|
@ -27,12 +27,12 @@ func ArpUpdate(iface string) (ArpTable, error) {
|
|||
ifname := m[ArpTableTokenIndex[2]]
|
||||
|
||||
if ifname == iface {
|
||||
new_table[address] = mac
|
||||
newTable[address] = mac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arp_table = new_table
|
||||
arpTable = newTable
|
||||
|
||||
return arp_table, nil
|
||||
return arpTable, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue