probe/discovery/protocol/tcp/syn/syn.go

33 lines
822 B
Go
Raw Permalink Normal View History

2018-08-31 14:00:08 +00:00
package syn
2018-08-31 10:46:52 +00:00
import (
omd "git.loafle.net/overflow/model/discovery"
omm "git.loafle.net/overflow/model/meta"
"git.loafle.net/overflow_scanner/probe/discovery/session"
)
2018-09-28 10:57:13 +00:00
var (
discovererType = omm.ToMetaDiscovererType(omm.MetaDiscovererTypeEnumTCPSyn)
)
2018-08-31 10:46:52 +00:00
func Scan(discoverySession session.DiscoverySession, targetHost *omd.Host) error {
2018-09-01 08:49:01 +00:00
if nil == targetHost || nil == discoverySession.DiscoverPort() || !discoverySession.DiscoverPort().IncludeTCP {
2018-08-31 12:56:36 +00:00
return nil
}
2018-09-28 10:57:13 +00:00
if !discoverySession.HostNeedScan(targetHost, discovererType) {
return nil
}
2018-08-31 10:46:52 +00:00
metaIPTypeEnum := omm.ToMetaIPTypeEnum(discoverySession.Zone().MetaIPType)
switch metaIPTypeEnum {
case omm.MetaIPTypeEnumV4:
return scanV4(discoverySession, targetHost)
case omm.MetaIPTypeEnumV6:
2018-09-03 04:44:54 +00:00
return scanV6(discoverySession, targetHost)
2018-08-31 10:46:52 +00:00
}
return nil
}