ing
This commit is contained in:
parent
a8d61c6657
commit
3c2c480f83
|
@ -94,10 +94,11 @@ func sendTCP4(discoverySession session.DiscoverySession, ps pcap.PCapScanner, ho
|
|||
}
|
||||
|
||||
buf := gopacket.NewSerializeBuffer()
|
||||
startTime := time.Now()
|
||||
|
||||
Loop:
|
||||
for portNumber := dp.FirstScanRange; portNumber < dp.LastScanRange; portNumber++ {
|
||||
startTime := time.Now()
|
||||
|
||||
if nil != dp.ExcludePorts {
|
||||
for _, exPortNumber := range dp.ExcludePorts {
|
||||
if portNumber == exPortNumber {
|
||||
|
@ -105,27 +106,43 @@ Loop:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if 80 == portNumber || 111 == portNumber {
|
||||
log.Print("1 IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
tcpPacket.TCP.DstPort = layers.TCPPort(portNumber)
|
||||
if err := tcpPacket.TCP.SetNetworkLayerForChecksum(tcpPacket.IP); err != nil {
|
||||
return err
|
||||
}
|
||||
if 80 == portNumber || 111 == portNumber {
|
||||
log.Print("2 IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
if err := gopacket.SerializeLayers(buf, tcpPacket.Opts, tcpPacket.Eth, tcpPacket.IP, tcpPacket.TCP); err != nil {
|
||||
return err
|
||||
}
|
||||
if 80 == portNumber || 111 == portNumber {
|
||||
log.Print("3 IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
if err := ps.WritePacketData(buf.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
if 80 == portNumber || 111 == portNumber {
|
||||
log.Print("4 IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
case <-stopChan:
|
||||
return nil
|
||||
}
|
||||
if 80 == portNumber || 111 == portNumber {
|
||||
log.Print("5 IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
log.Print("IP:", host.Address, " t:", time.Since(startTime))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user