ing
This commit is contained in:
parent
df9121603d
commit
212d3feb38
|
@ -71,8 +71,6 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) (er
|
|||
}
|
||||
}()
|
||||
|
||||
log.Print("SYN start ", targetHost.Address)
|
||||
|
||||
go func() {
|
||||
if err = sendTCP4(discoverySession, ps, targetHost, stopChan); nil != err {
|
||||
log.Printf("sendTCP %v", err)
|
||||
|
@ -108,37 +106,37 @@ Loop:
|
|||
}
|
||||
}
|
||||
}
|
||||
startTime := time.Now()
|
||||
// startTime := time.Now()
|
||||
tcpPacket.TCP.DstPort = layers.TCPPort(portNumber)
|
||||
if err := tcpPacket.TCP.SetNetworkLayerForChecksum(tcpPacket.IP); err != nil {
|
||||
return err
|
||||
}
|
||||
if 80 == portNumber || 41111 == portNumber {
|
||||
log.Print("1 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
// if 80 == portNumber || 41111 == portNumber {
|
||||
// log.Print("1 SYN 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 || 41111 == portNumber {
|
||||
log.Print("2 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
// if 80 == portNumber || 41111 == portNumber {
|
||||
// log.Print("2 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
// }
|
||||
|
||||
if err := ps.WritePacketData(buf.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
if 80 == portNumber || 41111 == portNumber {
|
||||
log.Print("3 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
// if 80 == portNumber || 41111 == portNumber {
|
||||
// log.Print("3 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
// }
|
||||
|
||||
select {
|
||||
case <-time.After(time.Microsecond * 10):
|
||||
case <-stopChan:
|
||||
return nil
|
||||
}
|
||||
if 80 == portNumber || 41111 == portNumber {
|
||||
log.Print("4 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
}
|
||||
// if 80 == portNumber || 41111 == portNumber {
|
||||
// log.Print("4 SYN IP:", host.Address, " Port:", portNumber, " t:", time.Since(startTime))
|
||||
// }
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -2,6 +2,7 @@ package service
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
|
@ -15,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
deadline = time.Millisecond * 500
|
||||
deadline = time.Millisecond * 1000
|
||||
)
|
||||
|
||||
func scanTCP(discoverySession session.DiscoverySession, targetPort *omd.Port) error {
|
||||
|
@ -54,6 +55,10 @@ func scanTCP(discoverySession session.DiscoverySession, targetPort *omd.Port) er
|
|||
var discoveredMatcher osm.Matcher
|
||||
var discoveredConnector connector
|
||||
|
||||
if targetPort.PortNumber == "7" {
|
||||
log.Print("")
|
||||
}
|
||||
|
||||
LOOP:
|
||||
for _, _connector := range connectors {
|
||||
conn, err := _connector.dial(targetPort)
|
||||
|
@ -221,6 +226,7 @@ LOOP:
|
|||
}
|
||||
_, err := conn.Write(_packet.Buffer)
|
||||
if nil != err {
|
||||
log.Print(err)
|
||||
break INNER_LOOP
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user