33 lines
822 B
Go
33 lines
822 B
Go
package syn
|
|
|
|
import (
|
|
omd "git.loafle.net/overflow/model/discovery"
|
|
omm "git.loafle.net/overflow/model/meta"
|
|
"git.loafle.net/overflow_scanner/probe/discovery/session"
|
|
)
|
|
|
|
var (
|
|
discovererType = omm.ToMetaDiscovererType(omm.MetaDiscovererTypeEnumTCPSyn)
|
|
)
|
|
|
|
func Scan(discoverySession session.DiscoverySession, targetHost *omd.Host) error {
|
|
if nil == targetHost || nil == discoverySession.DiscoverPort() || !discoverySession.DiscoverPort().IncludeTCP {
|
|
return nil
|
|
}
|
|
|
|
if !discoverySession.HostNeedScan(targetHost, discovererType) {
|
|
return nil
|
|
}
|
|
|
|
metaIPTypeEnum := omm.ToMetaIPTypeEnum(discoverySession.Zone().MetaIPType)
|
|
|
|
switch metaIPTypeEnum {
|
|
case omm.MetaIPTypeEnumV4:
|
|
return scanV4(discoverySession, targetHost)
|
|
case omm.MetaIPTypeEnumV6:
|
|
return scanV6(discoverySession, targetHost)
|
|
}
|
|
|
|
return nil
|
|
}
|