probe/discovery/protocol/icmp/icmp.go

27 lines
629 B
Go
Raw Normal View History

2018-08-31 10:05:49 +00:00
package icmp
import (
2018-09-01 02:19:03 +00:00
"git.loafle.net/overflow_scanner/probe/discovery/protocol/icmp/privileged"
"git.loafle.net/overflow_scanner/probe/discovery/protocol/icmp/unprivileged"
2018-08-31 10:05:49 +00:00
"git.loafle.net/overflow_scanner/probe/discovery/session"
2018-09-01 02:19:03 +00:00
"git.loafle.net/overflow_scanner/probe/internal/pcap"
2018-08-31 10:05:49 +00:00
)
func Scan(discoverySession session.DiscoverySession) error {
2018-09-01 02:19:03 +00:00
zone := discoverySession.Zone()
2018-08-31 10:05:49 +00:00
2018-09-01 02:19:03 +00:00
var _privileged bool
_, err := pcap.RetainScanner(zone)
if nil == err {
pcap.ReleaseScanner(zone)
_privileged = true
}
if _privileged {
return privileged.Scan(discoverySession)
2018-08-31 10:05:49 +00:00
}
2018-09-01 02:19:03 +00:00
return unprivileged.Scan(discoverySession)
2018-08-31 10:05:49 +00:00
}