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"
|
"github.com/google/gopacket/layers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var totalCount = 0
|
|
||||||
var count = 0
|
|
||||||
|
|
||||||
func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) error {
|
func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) error {
|
||||||
ps := discoverySession.PCapScanner()
|
ps := discoverySession.PCapScanner()
|
||||||
if nil == ps {
|
if nil == ps {
|
||||||
|
@ -28,13 +25,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
||||||
tcpChan := ps.OpenTCP(targetHost.Address)
|
tcpChan := ps.OpenTCP(targetHost.Address)
|
||||||
defer func() {
|
defer func() {
|
||||||
ps.CloseTCP(targetHost.Address, tcpChan)
|
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{})
|
timerStopped := make(chan struct{})
|
||||||
stopChan := make(chan struct{})
|
stopChan := make(chan struct{})
|
||||||
|
@ -46,6 +37,8 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
||||||
var delay atomic.Value
|
var delay atomic.Value
|
||||||
delay.Store(false)
|
delay.Store(false)
|
||||||
ticker := time.NewTicker(time.Millisecond * 1000)
|
ticker := time.NewTicker(time.Millisecond * 1000)
|
||||||
|
defer ticker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case packet, ok := <-tcpChan:
|
case packet, ok := <-tcpChan:
|
||||||
|
@ -58,7 +51,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
||||||
}
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
if false == delay.Load().(bool) {
|
if false == delay.Load().(bool) {
|
||||||
ticker.Stop()
|
log.Print("SYN Timeout IP ", targetHost.Address)
|
||||||
timerStopped <- struct{}{}
|
timerStopped <- struct{}{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -128,6 +121,8 @@ func handlePacketTCP4(discoverySession session.DiscoverySession, host *omd.Host,
|
||||||
|
|
||||||
dp := discoverySession.DiscoverPort()
|
dp := discoverySession.DiscoverPort()
|
||||||
|
|
||||||
|
log.Print("SYN HandlePacket IP ", host.Address)
|
||||||
|
|
||||||
if packet.SYN && packet.ACK {
|
if packet.SYN && packet.ACK {
|
||||||
port := int(packet.SrcPort)
|
port := int(packet.SrcPort)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user