Skip to content

Commit

Permalink
Remove nmap scanner in favor of internal arp scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
robgonnella committed Aug 8, 2023
1 parent d903f31 commit 895491d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 135 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/robgonnella/ops
go 1.19

require (
github.com/Ullaakut/nmap/v3 v3.0.2
github.com/apenella/go-ansible v1.1.7
github.com/gdamore/tcell/v2 v2.6.0
github.com/golang/mock v1.6.0
Expand Down Expand Up @@ -56,7 +55,6 @@ require (
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/Ullaakut/nmap/v3 v3.0.2 h1:AqQ9UYxLWzYZTv/rzMzVn8+LIgFGxGi+4h+3pDkFOII=
github.com/Ullaakut/nmap/v3 v3.0.2/go.mod h1:dd5K68P7LHc5nKrFwQx6EdTt61O9UN5x3zn1R4SLcco=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/apenella/go-ansible v1.1.7 h1:seJcEZbRjALS6RjbO5UjPQTHpCnnaRADmCCo0MT26BU=
Expand Down Expand Up @@ -488,8 +486,6 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
5 changes: 5 additions & 0 deletions internal/discovery/arpscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ func (s *ARPScanner) handleARPLayer(arp *layers.ARP) {
ip := net.IP(arp.SourceProtAddress)
mac := net.HardwareAddr(arp.SourceHwAddress)

if !util.SliceIncludes(s.targets, ip.String()) {
// not an arp request we care about
return
}

s.mux.Lock()
s.arpMap[ip.String()] = mac
s.mux.Unlock()
Expand Down
129 changes: 0 additions & 129 deletions internal/discovery/nmap.go

This file was deleted.

0 comments on commit 895491d

Please sign in to comment.