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

View File

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