This commit is contained in:
crusader 2018-09-18 12:39:00 +09:00
parent a07e7e7b93
commit aefdb4d724
2 changed files with 9 additions and 8 deletions

View File

@ -2,7 +2,6 @@ package service
import (
"fmt"
"log"
"net"
"time"
@ -30,13 +29,17 @@ func scanTCP(discoverySession session.DiscoverySession, targetPort *omd.Port) er
if omm.MetaHostTypeEnumPrinter.String() == targetPort.Host.HostType {
switch portNumber {
case 7:
return nil
// case 7:
// return nil
case 515:
limitedMatchers = []osm.Matcher{
matcher.GetMatcherByKey("LPD"),
}
case 8290:
discoverySession.AddServiceUnknown(
omm.ToMetaDiscovererType(omm.MetaDiscovererTypeEnumTCPMatcher),
targetPort,
)
return nil
case 9100:
return nil
@ -213,10 +216,6 @@ LOOP:
for j := 0; j < packetCount; j++ {
_packet := _matcher.Packet(matchCtx, j)
if "192.168.1.99" == targetPort.Host.Address {
log.Print("192.168.1.99:", targetPort.PortNumber, " M: ", _matcher.Key())
}
if err := conn.SetWriteDeadline(time.Now().Add(deadline)); nil != err {
break INNER_LOOP
}
@ -239,7 +238,7 @@ LOOP:
// log.Printf("res: %s", string(buf[:n]))
if err := _matcher.Match(matchCtx, j+1, osm.NewPacket(buf, n)); err == nil {
if err := _matcher.Match(matchCtx, j, osm.NewPacket(buf, n)); err == nil {
if packetCount-1 == j {
discoveredMatcher = _matcher

View File

@ -2,6 +2,7 @@ package matcher
import (
osm "git.loafle.net/overflow/service_matcher-go"
"git.loafle.net/overflow/service_matcher-go/echo"
"git.loafle.net/overflow/service_matcher-go/elasticsearch"
"git.loafle.net/overflow/service_matcher-go/ftp"
"git.loafle.net/overflow/service_matcher-go/http"
@ -31,6 +32,7 @@ var (
func init() {
//TCP
addTCPMatcher(ssh.NewMatcher())
addTCPMatcher(echo.NewMatcher())
addTCPMatcher(mongodb.NewMatcher())
addTCPMatcher(mysql.NewMatcher())
addTCPMatcher(redis.NewMatcher())