This commit is contained in:
crusader 2018-10-23 13:31:25 +09:00
parent 0a05e38d8b
commit bce329e44e
28 changed files with 62 additions and 57 deletions

View File

@ -173,11 +173,11 @@ type ActiveDirectoryMatcher struct {
osm.Matchers
}
func (m *ActiveDirectoryMatcher) Key() string {
func (m *ActiveDirectoryMatcher) Key(matchCtx *osm.MatchCtx) string {
return "ACTIVEDIRECTORY"
}
func (m *ActiveDirectoryMatcher) Type() string {
func (m *ActiveDirectoryMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DIRECTORY"
}

View File

@ -19,11 +19,11 @@ type CassandraMatcher struct {
osm.Matchers
}
func (m *CassandraMatcher) Key() string {
func (m *CassandraMatcher) Key(matchCtx *osm.MatchCtx) string {
return "CASSANDRA"
}
func (m *CassandraMatcher) Type() string {
func (m *CassandraMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NOSQL"
}

View File

@ -41,11 +41,11 @@ type DNSMatcher struct {
osm.Matchers
}
func (m *DNSMatcher) Key() string {
func (m *DNSMatcher) Key(matchCtx *osm.MatchCtx) string {
return "DNS"
}
func (m *DNSMatcher) Type() string {
func (m *DNSMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}
func (m *DNSMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -15,11 +15,11 @@ type EchoMatcher struct {
osm.Matchers
}
func (m *EchoMatcher) Key() string {
func (m *EchoMatcher) Key(matchCtx *osm.MatchCtx) string {
return "ECHO"
}
func (m *EchoMatcher) Type() string {
func (m *EchoMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}

View File

@ -13,11 +13,11 @@ type ElasticSearchMatcher struct {
osm.Matchers
}
func (m *ElasticSearchMatcher) Key() string {
func (m *ElasticSearchMatcher) Key(matchCtx *osm.MatchCtx) string {
return "ELASTICSEARCH"
}
func (m *ElasticSearchMatcher) Type() string {
func (m *ElasticSearchMatcher) Type(matchCtx *osm.MatchCtx) string {
return "SEARCH"
}
func (m *ElasticSearchMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -29,11 +29,11 @@ type FTPMatcher struct {
osm.Matchers
}
func (m *FTPMatcher) Key() string {
func (m *FTPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "FTP"
}
func (m *FTPMatcher) Type() string {
func (m *FTPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}
func (m *FTPMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -10,11 +10,11 @@ type HTTPMatcher struct {
osm.Matchers
}
func (m *HTTPMatcher) Key() string {
func (m *HTTPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "HTTP"
}
func (m *HTTPMatcher) Type() string {
func (m *HTTPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "WEB"
}

View File

@ -13,11 +13,11 @@ type IMAPMatcher struct {
osm.Matchers
}
func (m *IMAPMatcher) Key() string {
func (m *IMAPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "IMAP"
}
func (m *IMAPMatcher) Type() string {
func (m *IMAPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "MAIL"
}
func (m *IMAPMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -18,11 +18,11 @@ type LDAPMatcher struct {
reqID int64
}
func (m *LDAPMatcher) Key() string {
func (m *LDAPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "LDAP"
}
func (m *LDAPMatcher) Type() string {
func (m *LDAPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DIRECTORY"
}
func (m *LDAPMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -1,12 +1,11 @@
package ldap
import (
"math/rand"
"net"
"testing"
"time"
"math/rand"
osm "git.loafle.net/overflow/service_matcher-go"
"gopkg.in/asn1-ber.v1"
)

View File

@ -8,11 +8,11 @@ type LPDMatcher struct {
osm.Matchers
}
func (m *LPDMatcher) Key() string {
func (m *LPDMatcher) Key(matchCtx *osm.MatchCtx) string {
return "LPD"
}
func (m *LPDMatcher) Type() string {
func (m *LPDMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}

View File

@ -5,8 +5,8 @@ import (
)
type Matcher interface {
Key() string
Type() string
Key(matchCtx *MatchCtx) string
Type(matchCtx *MatchCtx) string
Vendor(matchCtx *MatchCtx) string
Version(matchCtx *MatchCtx) string
OsType(matchCtx *MatchCtx) string

View File

@ -50,11 +50,11 @@ type MongoDBMatcher struct {
osm.Matchers
}
func (m *MongoDBMatcher) Key() string {
func (m *MongoDBMatcher) Key(matchCtx *osm.MatchCtx) string {
return "MONGODB"
}
func (m *MongoDBMatcher) Type() string {
func (m *MongoDBMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NOSQL"
}

View File

@ -13,11 +13,17 @@ type MySqlMatcher struct {
osm.Matchers
}
func (m *MySqlMatcher) Key() string {
return "MYSQL"
func (m *MySqlMatcher) Key(matchCtx *osm.MatchCtx) string {
v := "MYSQL"
if _v, ok := matchCtx.GetAttribute("version"); ok {
if strings.Contains(_v, "MariaDB") {
v = "MARIADB"
}
}
return v
}
func (m *MySqlMatcher) Type() string {
func (m *MySqlMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DATABASE"
}

View File

@ -29,11 +29,11 @@ type NBSSMatcher struct {
osm.Matchers
}
func (m *NBSSMatcher) Key() string {
func (m *NBSSMatcher) Key(matchCtx *osm.MatchCtx) string {
return "NBSS"
}
func (m *NBSSMatcher) Type() string {
func (m *NBSSMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}
func (m *NBSSMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -11,11 +11,11 @@ type OracleMatcher struct {
osm.Matchers
}
func (m *OracleMatcher) Key() string {
func (m *OracleMatcher) Key(matchCtx *osm.MatchCtx) string {
return "ORACLE"
}
func (m *OracleMatcher) Type() string {
func (m *OracleMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DATABASE"
}
func (m *OracleMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -1,10 +1,10 @@
package oracle
import (
osm "git.loafle.net/overflow/service_matcher-go"
"net"
"testing"
osm "git.loafle.net/overflow/service_matcher-go"
)
func TestOracle(t *testing.T) {

View File

@ -12,11 +12,11 @@ type POPMatcher struct {
osm.Matchers
}
func (m *POPMatcher) Key() string {
func (m *POPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "POP3"
}
func (m *POPMatcher) Type() string {
func (m *POPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "MAIL"
}
func (m *POPMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -41,11 +41,11 @@ type PostgreSQLMatcher struct {
osm.Matchers
}
func (m *PostgreSQLMatcher) Key() string {
func (m *PostgreSQLMatcher) Key(matchCtx *osm.MatchCtx) string {
return "POSTGRESQL"
}
func (m *PostgreSQLMatcher) Type() string {
func (m *PostgreSQLMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DATABASE"
}
func (m *PostgreSQLMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -17,11 +17,11 @@ type RedisMatcher struct {
osm.Matchers
}
func (m *RedisMatcher) Key() string {
func (m *RedisMatcher) Key(matchCtx *osm.MatchCtx) string {
return "REDIS"
}
func (m *RedisMatcher) Type() string {
func (m *RedisMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NOSQL"
}

View File

@ -31,11 +31,11 @@ type RMIMatcher struct {
osm.Matchers
}
func (m *RMIMatcher) Key() string {
func (m *RMIMatcher) Key(matchCtx *osm.MatchCtx) string {
return "RMI"
}
func (m *RMIMatcher) Type() string {
func (m *RMIMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}

View File

@ -52,11 +52,11 @@ type SMBMatcher struct {
osm.Matchers
}
func (m *SMBMatcher) Key() string {
func (m *SMBMatcher) Key(matchCtx *osm.MatchCtx) string {
return "SMB"
}
func (m *SMBMatcher) Type() string {
func (m *SMBMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}

View File

@ -10,11 +10,11 @@ type SmtpMatcher struct {
osm.Matchers
}
func (m *SmtpMatcher) Key() string {
func (m *SmtpMatcher) Key(matchCtx *osm.MatchCtx) string {
return "SMTP"
}
func (m *SmtpMatcher) Type() string {
func (m *SmtpMatcher) Type(matchCtx *osm.MatchCtx) string {
return "MAIL"
}
func (m *SmtpMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -43,11 +43,11 @@ type SNMPMatcher struct {
requestID int32
}
func (s *SNMPMatcher) Key() string {
func (s *SNMPMatcher) Key(matchCtx *osm.MatchCtx) string {
return "SNMP"
}
func (m *SNMPMatcher) Type() string {
func (m *SNMPMatcher) Type(matchCtx *osm.MatchCtx) string {
return "MONITORING"
}

View File

@ -69,11 +69,11 @@ type SQLServerMatcher struct {
isSSL bool
}
func (m *SQLServerMatcher) Key() string {
func (m *SQLServerMatcher) Key(matchCtx *osm.MatchCtx) string {
return "SQLSERVER"
}
func (m *SQLServerMatcher) Type() string {
func (m *SQLServerMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DATABASE"
}
func (m *SQLServerMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -12,11 +12,11 @@ type SSHMatcher struct {
osm.Matchers
}
func (m *SSHMatcher) Key() string {
func (m *SSHMatcher) Key(matchCtx *osm.MatchCtx) string {
return "SSH"
}
func (m *SSHMatcher) Type() string {
func (m *SSHMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}

View File

@ -16,11 +16,11 @@ type TelnetMatcher struct {
osm.Matchers
}
func (m *TelnetMatcher) Key() string {
func (m *TelnetMatcher) Key(matchCtx *osm.MatchCtx) string {
return "TELNET"
}
func (m *TelnetMatcher) Type() string {
func (m *TelnetMatcher) Type(matchCtx *osm.MatchCtx) string {
return "NETWORK"
}
func (m *TelnetMatcher) Vendor(matchCtx *osm.MatchCtx) string {

View File

@ -21,11 +21,11 @@ type WMIMatcher struct {
osm.Matchers
}
func (m *WMIMatcher) Key() string {
func (m *WMIMatcher) Key(matchCtx *osm.MatchCtx) string {
return "WMI"
}
func (m *WMIMatcher) Type() string {
func (m *WMIMatcher) Type(matchCtx *osm.MatchCtx) string {
return "MONITORING"
}
func (m *WMIMatcher) Vendor(matchCtx *osm.MatchCtx) string {