This commit is contained in:
crusader 2018-06-21 19:54:31 +09:00
parent 78ba6b1138
commit 5f80794d28
7 changed files with 18 additions and 16 deletions

6
Gopkg.lock generated
View File

@ -79,7 +79,7 @@
"telnet",
"wmi"
]
revision = "f5a697e4d15125f4fcae754a56b71e5b1d00e57c"
revision = "297c909956a0892b9e547370384012cbe2992b9d"
[[projects]]
branch = "master"
@ -115,7 +115,7 @@
"service/container/discovery",
"service/probe"
]
revision = "292dd88aae9a1eb66fe5c1d45cbac20799cce3a0"
revision = "7e2ff26648aefbafaee2ca28c1a958332ae4c6f9"
[[projects]]
branch = "master"
@ -131,7 +131,7 @@
branch = "master"
name = "git.loafle.net/overflow/crawler-go"
packages = ["."]
revision = "02d2885e33e86e64bccda0b237c416b2b385a625"
revision = "bae05dbc820773ec5b584cb39614216dd408a7f7"
[[projects]]
name = "github.com/BurntSushi/toml"

View File

@ -14,7 +14,7 @@ func init() {
}
func addCrawler(c crawler.Crawler) {
crawlers[c.Name()] = c
crawlers[c.Key()] = c
}
func GetCrawlers() map[string]crawler.Crawler {

View File

@ -8,7 +8,7 @@ import (
type DiscoveryCrawler struct {
}
func (c *DiscoveryCrawler) Name() string {
func (c *DiscoveryCrawler) Key() string {
return "DISCOVERY"
}

View File

@ -21,9 +21,10 @@ func ScanService(port *ocmd.Port, ds *ocmd.DiscoverService, resultChan chan inte
case ocmm.MetaPortTypeEnumTCP:
if !scanServiceTCP(port, ds, resultChan, errChan, stopChan) {
if dName, ok := layers.TCPPortNames[layers.TCPPort(portNumber)]; ok {
sName := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, portNumber)
description := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, portNumber)
s := &ocmd.Service{
Name: sName,
Key: ocmm.MetaTargetServiceTypeEnumUNKNOWN.String(),
Description: description,
DiscoveredDate: occu.NowPtr(),
Port: port,
MetaCryptoType: ocmm.ToMetaCryptoType(ocmm.MetaCryptoTypeEnumUNKNOWN),
@ -35,9 +36,10 @@ func ScanService(port *ocmd.Port, ds *ocmd.DiscoverService, resultChan chan inte
case ocmm.MetaPortTypeEnumUDP:
if !scanServiceUDP(port, ds, resultChan, errChan, stopChan) {
if dName, ok := layers.UDPPortNames[layers.UDPPort(portNumber)]; ok {
sName := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, portNumber)
description := fmt.Sprintf("Not Supported Service. Perhaps %s[%d]", dName, portNumber)
s := &ocmd.Service{
Name: sName,
Key: ocmm.MetaTargetServiceTypeEnumUNKNOWN.String(),
Description: description,
DiscoveredDate: occu.NowPtr(),
Port: port,
MetaCryptoType: ocmm.ToMetaCryptoType(ocmm.MetaCryptoTypeEnumUNKNOWN),

View File

@ -103,7 +103,7 @@ LOOP:
if 0 == packetCount {
s = &ocmd.Service{
Name: m.Name(),
Key: m.Key(),
MetaCryptoType: sc.MetaCryptoType(),
DiscoveredDate: occu.NowPtr(),
}
@ -155,7 +155,7 @@ LOOP:
if found {
s = &ocmd.Service{
Name: m.Name(),
Key: m.Key(),
MetaCryptoType: sc.MetaCryptoType(),
DiscoveredDate: occu.NowPtr(),
}
@ -213,7 +213,7 @@ LOOP:
if nil != err {
if !m.HasResponse(j) {
s = &ocmd.Service{
Name: m.Name(),
Key: m.Key(),
MetaCryptoType: sc.MetaCryptoType(),
DiscoveredDate: occu.NowPtr(),
}
@ -227,7 +227,7 @@ LOOP:
if m.Match(info, j, csm.NewPacket(buf, rn)) {
if packetCount-1 == j {
s = &ocmd.Service{
Name: m.Name(),
Key: m.Key(),
MetaCryptoType: sc.MetaCryptoType(),
DiscoveredDate: occu.NowPtr(),
}

View File

@ -27,7 +27,7 @@ func scanServiceUDP(port *ocmd.Port, ds *ocmd.DiscoverService, resultChan chan i
if m.Match(mi, 0, p) {
s := &ocmd.Service{
Name: m.Name(),
Key: m.Key(),
Port: port,
MetaCryptoType: ocmm.ToMetaCryptoType(ocmm.MetaCryptoTypeEnumNONE),
DiscoveredDate: occu.NowPtr(),

View File

@ -96,9 +96,9 @@ func GetUDPMatchers() []csm.UDPMatcher {
return UDPMatchers
}
func GetMatcherByName(name string) csm.Matcher {
func GetMatcherByKey(key string) csm.Matcher {
for _, m := range AllMatchers {
if m.Name() == name {
if m.Key() == key {
return m
}
}