MCPcopy
hub / github.com/bettercap/bettercap / runDiff

Method runDiff

modules/net_recon/net_recon.go:81–99  ·  view source on GitHub ↗
(cache network.ArpTable)

Source from the content-addressed store, hash-verified

79}
80
81func (mod *Discovery) runDiff(cache network.ArpTable) {
82 // check for endpoints who disappeared
83 var rem network.ArpTable = make(network.ArpTable)
84
85 mod.Session.Lan.EachHost(func(mac string, e *network.Endpoint) {
86 if _, found := cache[mac]; !found {
87 rem[mac] = e.IpAddress
88 }
89 })
90
91 for mac, ip := range rem {
92 mod.Session.Lan.Remove(ip, mac)
93 }
94
95 // now check for new friends ^_^
96 for ip, mac := range cache {
97 mod.Session.Lan.AddIfNew(ip, mac)
98 }
99}
100
101func (mod *Discovery) Configure() error {
102 return nil

Callers 3

StartMethod · 0.95
TestRunDiffFunction · 0.95
BenchmarkRunDiffFunction · 0.95

Calls 3

EachHostMethod · 0.45
RemoveMethod · 0.45
AddIfNewMethod · 0.45

Tested by 2

TestRunDiffFunction · 0.76
BenchmarkRunDiffFunction · 0.76