ing
This commit is contained in:
parent
3081c408fd
commit
2f67baeb46
|
@ -131,7 +131,7 @@ func (d *discovery) discoverService(port *model.Port, ds *model.DiscoveryService
|
|||
},
|
||||
func(result interface{}) {
|
||||
s := result.(*model.Service)
|
||||
logging.Logger().Info(fmt.Sprintf("service: %v", s))
|
||||
logging.Logger().Info(fmt.Sprintf("service: %s(%s)[%s:%d]", s.ServiceName, s.CryptoType, port.Host.IP, port.PortNumber))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ func scanServiceTCP(port *model.Port, ds *model.DiscoveryService, resultChan cha
|
|||
errChan <- fmt.Errorf("Discovery: Service scan[%s] on %s:%d error has occurred %v ", sc.Type(), hostIP, portNumber, err)
|
||||
break
|
||||
}
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan connected[%s:%d] %s", hostIP, portNumber, sc.Type()))
|
||||
|
||||
buf := make([]byte, 1024)
|
||||
rn, err := conn.Read(buf)
|
||||
if err != nil {
|
||||
|
@ -67,7 +69,7 @@ func hadlePrePacket(info matcher.MatchInfo, sc serviceConnector, conn net.Conn,
|
|||
}()
|
||||
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan pre packet length[%d], buf[%v]", packet.Len, packet.Buffer))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan pre packet length[%d]", packet.Len))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d pre packet length[%d]", sc.Type(), info.IP(), info.Port(), packet.Len))
|
||||
|
||||
ms := service.GetTCPMatchers(true)
|
||||
buf := make([]byte, 1024)
|
||||
|
@ -93,30 +95,30 @@ Loop:
|
|||
for j := 0; j < packetCount; j++ {
|
||||
tPacket := m.Packet(j)
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d], buf[%v]", tPacket.Len, tPacket.Buffer))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d]", tPacket.Len))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet length[%d]", sc.Type(), info.IP(), info.Port(), tPacket.Len))
|
||||
wn, err := conn.Write(tPacket.Buffer)
|
||||
if nil != err {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet error %v", err))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet error %v", sc.Type(), info.IP(), info.Port(), err))
|
||||
break
|
||||
}
|
||||
if wn != tPacket.Len {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d] not same with %d", wn, tPacket.Len))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet length[%d] not same with %d", sc.Type(), info.IP(), info.Port(), wn, tPacket.Len))
|
||||
break
|
||||
}
|
||||
|
||||
rn, err := conn.Read(buf)
|
||||
if nil != err {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive packet error %v", err))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive packet error %v", sc.Type(), info.IP(), info.Port(), err))
|
||||
break
|
||||
}
|
||||
|
||||
if m.Match(info, j+1, matcher.NewPacket(buf, rn)) {
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive match length[%d], buf[%v]", rn, buf))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive match length[%d]", rn))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive match length[%d]", sc.Type(), info.IP(), info.Port(), rn))
|
||||
found = true
|
||||
} else {
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive not match length[%d], buf[%v]", rn, buf))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive not match length[%d]", rn))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive not match length[%d]", sc.Type(), info.IP(), info.Port(), rn))
|
||||
found = false
|
||||
break
|
||||
}
|
||||
|
@ -146,7 +148,7 @@ Loop:
|
|||
|
||||
conn, err := sc.Dial(info.IP(), info.Port())
|
||||
if err != nil {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan socket[%s:%d] dial error %v", info.IP(), info.Port(), err))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d socket dial error %v", sc.Type(), info.IP(), info.Port(), err))
|
||||
break Loop
|
||||
}
|
||||
|
||||
|
@ -154,14 +156,14 @@ Loop:
|
|||
for j := 0; j < packetCount; j++ {
|
||||
tPacket := m.Packet(j)
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d], buf[%v]", tPacket.Len, tPacket.Buffer))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d]", tPacket.Len))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet length[%d]", sc.Type(), info.IP(), info.Port(), tPacket.Len))
|
||||
wn, err := conn.Write(tPacket.Buffer)
|
||||
if nil != err {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet error %v", err))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet error %v", sc.Type(), info.IP(), info.Port(), err))
|
||||
break
|
||||
}
|
||||
if wn != tPacket.Len {
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan send packet length[%d] not same with %d", wn, tPacket.Len))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d send packet length[%d] not same with %d", sc.Type(), info.IP(), info.Port(), wn, tPacket.Len))
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -175,7 +177,7 @@ Loop:
|
|||
break
|
||||
}
|
||||
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive packet error %v", err))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive packet error %v", sc.Type(), info.IP(), info.Port(), err))
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -189,11 +191,11 @@ Loop:
|
|||
}
|
||||
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive match length[%d], buf[%v]", rn, buf))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive match length[%d]", rn))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive match length[%d]", sc.Type(), info.IP(), info.Port(), rn))
|
||||
continue
|
||||
} else {
|
||||
// logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive not match length[%d], buf[%v]", rn, buf))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan receive not match length[%d]", rn))
|
||||
logging.Logger().Debug(fmt.Sprintf("Discovery: Service scan[%s] on %s:%d receive not match length[%d]", sc.Type(), info.IP(), info.Port(), rn))
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user