Merge branch 'master' of https://git.loafle.net/overflow_scanner/probe
This commit is contained in:
commit
1077e59831
|
@ -16,9 +16,6 @@ import (
|
|||
"github.com/google/gopacket/layers"
|
||||
)
|
||||
|
||||
var totalCount = 0
|
||||
var count = 0
|
||||
|
||||
func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) error {
|
||||
ps := discoverySession.PCapScanner()
|
||||
if nil == ps {
|
||||
|
@ -28,13 +25,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
|||
tcpChan := ps.OpenTCP(targetHost.Address)
|
||||
defer func() {
|
||||
ps.CloseTCP(targetHost.Address, tcpChan)
|
||||
count = count - 1
|
||||
log.Print("TCP -Count: ", count)
|
||||
}()
|
||||
count = count + 1
|
||||
log.Print("TCP +Count: ", count)
|
||||
totalCount = totalCount + 1
|
||||
log.Print("TCP Total Count: ", totalCount)
|
||||
|
||||
timerStopped := make(chan struct{})
|
||||
stopChan := make(chan struct{})
|
||||
|
@ -46,6 +37,8 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
|||
var delay atomic.Value
|
||||
delay.Store(false)
|
||||
ticker := time.NewTicker(time.Millisecond * 1000)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case packet, ok := <-tcpChan:
|
||||
|
@ -58,7 +51,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
|||
}
|
||||
case <-ticker.C:
|
||||
if false == delay.Load().(bool) {
|
||||
ticker.Stop()
|
||||
log.Print("SYN Timeout IP ", targetHost.Address)
|
||||
timerStopped <- struct{}{}
|
||||
return
|
||||
}
|
||||
|
@ -128,6 +121,8 @@ func handlePacketTCP4(discoverySession session.DiscoverySession, host *omd.Host,
|
|||
|
||||
dp := discoverySession.DiscoverPort()
|
||||
|
||||
log.Print("SYN HandlePacket IP ", host.Address)
|
||||
|
||||
if packet.SYN && packet.ACK {
|
||||
port := int(packet.SrcPort)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user