ing
This commit is contained in:
parent
d50a6608c0
commit
e1f698cc1c
|
@ -34,16 +34,14 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
|||
go func() {
|
||||
defer func() {
|
||||
close(timerStopped)
|
||||
log.Print("timer close:", targetHost.Address)
|
||||
}()
|
||||
ports := make(map[int]*omd.Port)
|
||||
|
||||
var delay atomic.Value
|
||||
delay.Store(false)
|
||||
ticker := time.NewTicker(time.Millisecond * 3000)
|
||||
ticker := time.NewTicker(time.Millisecond * 20000)
|
||||
defer func() {
|
||||
ticker.Stop()
|
||||
log.Print("ticker stop:", targetHost.Address)
|
||||
}()
|
||||
|
||||
for {
|
||||
|
@ -89,6 +87,7 @@ func sendTCP4(discoverySession session.DiscoverySession, ps pcap.PCapScanner, ho
|
|||
}
|
||||
|
||||
buf := gopacket.NewSerializeBuffer()
|
||||
startTime := time.Now()
|
||||
|
||||
Loop:
|
||||
for portNumber := dp.FirstScanRange; portNumber < dp.LastScanRange; portNumber++ {
|
||||
|
@ -107,18 +106,20 @@ Loop:
|
|||
if err := gopacket.SerializeLayers(buf, tcpPacket.Opts, tcpPacket.Eth, tcpPacket.IP, tcpPacket.TCP); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := ps.WritePacketData(buf.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
select {
|
||||
// case <-time.After(time.Microsecond * 10):
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
case <-stopChan:
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
log.Print("IP:", host.Address, " t:", time.Since(startTime))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user