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 osm.Matchers
} }
func (m *ActiveDirectoryMatcher) Key() string { func (m *ActiveDirectoryMatcher) Key(matchCtx *osm.MatchCtx) string {
return "ACTIVEDIRECTORY" return "ACTIVEDIRECTORY"
} }
func (m *ActiveDirectoryMatcher) Type() string { func (m *ActiveDirectoryMatcher) Type(matchCtx *osm.MatchCtx) string {
return "DIRECTORY" return "DIRECTORY"
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,11 +13,17 @@ type MySqlMatcher struct {
osm.Matchers osm.Matchers
} }
func (m *MySqlMatcher) Key() string { func (m *MySqlMatcher) Key(matchCtx *osm.MatchCtx) string {
return "MYSQL" 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" return "DATABASE"
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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