mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 05:22:04 -07:00
Replace arp from net-tools by ip from iproute2 (linux)
This commit is contained in:
parent
3cc5faa297
commit
c55284429e
3 changed files with 12 additions and 6 deletions
|
@ -12,8 +12,8 @@ func ArpUpdate(iface string) (ArpTable, error) {
|
|||
// Signal we parsed the ARP table at least once.
|
||||
arp_parsed = true
|
||||
|
||||
// Run "arp -an" and parse the output.
|
||||
output, err := core.Exec("arp", []string{"-a", "-n"})
|
||||
// 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
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ func ArpUpdate(iface string) (ArpTable, error) {
|
|||
for _, line := range strings.Split(output, "\n") {
|
||||
m := ArpTableParser.FindStringSubmatch(line)
|
||||
if len(m) == ArpTableTokens {
|
||||
address := m[1]
|
||||
mac := m[2]
|
||||
ifname := m[3]
|
||||
address := m[ArpTableTokenIndex[0]]
|
||||
mac := m[ArpTableTokenIndex[1]]
|
||||
ifname := m[ArpTableTokenIndex[2]]
|
||||
|
||||
if ifname == iface {
|
||||
new_table[address] = mac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue