This commit is contained in:
crusader 2018-04-20 12:07:24 +09:00
parent f28ff9a303
commit 9c9bb88c91
25 changed files with 261 additions and 26 deletions

View File

@ -2,12 +2,62 @@ package crawler
import ( import (
"git.loafle.net/overflow/crawler-go" "git.loafle.net/overflow/crawler-go"
activedirectoryH "git.loafle.net/overflow/container_network/crawler/health/activedirectory"
cassandraH "git.loafle.net/overflow/container_network/crawler/health/cassandra"
dnsH "git.loafle.net/overflow/container_network/crawler/health/dns"
ftpH "git.loafle.net/overflow/container_network/crawler/health/ftp"
httpH "git.loafle.net/overflow/container_network/crawler/health/http"
imapH "git.loafle.net/overflow/container_network/crawler/health/imap"
ldapH "git.loafle.net/overflow/container_network/crawler/health/ldap"
mongodbH "git.loafle.net/overflow/container_network/crawler/health/mongodb"
mysqlH "git.loafle.net/overflow/container_network/crawler/health/mysql"
netbiosH "git.loafle.net/overflow/container_network/crawler/health/netbios"
oracleH "git.loafle.net/overflow/container_network/crawler/health/oracle"
popH "git.loafle.net/overflow/container_network/crawler/health/pop"
postgresqlH "git.loafle.net/overflow/container_network/crawler/health/postgresql"
redisH "git.loafle.net/overflow/container_network/crawler/health/redis"
rmiH "git.loafle.net/overflow/container_network/crawler/health/rmi"
smbH "git.loafle.net/overflow/container_network/crawler/health/smb"
smtpH "git.loafle.net/overflow/container_network/crawler/health/smtp"
snmpV2H "git.loafle.net/overflow/container_network/crawler/health/snmp/v2"
snmpV3H "git.loafle.net/overflow/container_network/crawler/health/snmp/v3"
sqlserverH "git.loafle.net/overflow/container_network/crawler/health/sqlserver"
sshH "git.loafle.net/overflow/container_network/crawler/health/ssh"
telnetH "git.loafle.net/overflow/container_network/crawler/health/telnet"
wmiH "git.loafle.net/overflow/container_network/crawler/health/wmi"
"git.loafle.net/overflow/container_network/crawler/ssh"
) )
var crawlers map[string]crawler.Crawler var crawlers map[string]crawler.Crawler
func init() { func init() {
crawlers = make(map[string]crawler.Crawler, 0) crawlers = make(map[string]crawler.Crawler, 0)
addCrawler(activedirectoryH.NewCrawler())
addCrawler(cassandraH.NewCrawler())
addCrawler(dnsH.NewCrawler())
addCrawler(ftpH.NewCrawler())
addCrawler(httpH.NewCrawler())
addCrawler(imapH.NewCrawler())
addCrawler(ldapH.NewCrawler())
addCrawler(mongodbH.NewCrawler())
addCrawler(mysqlH.NewCrawler())
addCrawler(netbiosH.NewCrawler())
addCrawler(oracleH.NewCrawler())
addCrawler(popH.NewCrawler())
addCrawler(postgresqlH.NewCrawler())
addCrawler(redisH.NewCrawler())
addCrawler(rmiH.NewCrawler())
addCrawler(smbH.NewCrawler())
addCrawler(smtpH.NewCrawler())
addCrawler(snmpV2H.NewCrawler())
addCrawler(snmpV3H.NewCrawler())
addCrawler(sqlserverH.NewCrawler())
addCrawler(sshH.NewCrawler())
addCrawler(telnetH.NewCrawler())
addCrawler(wmiH.NewCrawler())
addCrawler(ssh.NewCrawler())
} }
func addCrawler(c crawler.Crawler) { func addCrawler(c crawler.Crawler) {

View File

@ -12,7 +12,15 @@ type CassandraHealthCrawler struct {
} }
func (c *CassandraHealthCrawler) Name() string { func (c *CassandraHealthCrawler) Name() string {
return "CASSANDRA_HEALTH_CRAWLER" return "CASSANDRA_HEALTH"
}
func (c *CassandraHealthCrawler) String() string {
return "Cassandra Health Crawler"
}
func (c *CassandraHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *CassandraHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *CassandraHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type DNSHealthCrawler struct {
} }
func (c *DNSHealthCrawler) Name() string { func (c *DNSHealthCrawler) Name() string {
return "DNS_HEALTH_CRAWLER" return "DNS_HEALTH"
}
func (c *DNSHealthCrawler) String() string {
return "DNS Health Crawler"
}
func (c *DNSHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *DNSHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *DNSHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type FTPHealthCrawler struct {
} }
func (c *FTPHealthCrawler) Name() string { func (c *FTPHealthCrawler) Name() string {
return "FTP_HEALTH_CRAWLER" return "FTP_HEALTH"
}
func (c *FTPHealthCrawler) String() string {
return "FTP Health Crawler"
}
func (c *FTPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *FTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *FTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type HTTPHealthCrawler struct {
} }
func (c *HTTPHealthCrawler) Name() string { func (c *HTTPHealthCrawler) Name() string {
return "HTTP_HEALTH_CRAWLER" return "HTTP_HEALTH"
}
func (c *HTTPHealthCrawler) String() string {
return "HTTP Health Crawler"
}
func (c *HTTPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *HTTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *HTTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type IMAPHealthCrawler struct {
} }
func (c *IMAPHealthCrawler) Name() string { func (c *IMAPHealthCrawler) Name() string {
return "IMAP_HEALTH_CRAWLER" return "IMAP_HEALTH"
}
func (c *IMAPHealthCrawler) String() string {
return "IMAP Health Crawler"
}
func (c *IMAPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *IMAPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *IMAPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type LDAPHealthCrawler struct {
} }
func (c *LDAPHealthCrawler) Name() string { func (c *LDAPHealthCrawler) Name() string {
return "LDAP_HEALTH_CRAWLER" return "LDAP_HEALTH"
}
func (c *LDAPHealthCrawler) String() string {
return "Active Directory Health Crawler"
}
func (c *LDAPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *LDAPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *LDAPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type MongoDBHealthCrawler struct {
} }
func (c *MongoDBHealthCrawler) Name() string { func (c *MongoDBHealthCrawler) Name() string {
return "MONGODB_HEALTH_CRAWLER" return "MONGODB_HEALTH"
}
func (c *MongoDBHealthCrawler) String() string {
return "MongoDB Health Crawler"
}
func (c *MongoDBHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *MongoDBHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *MongoDBHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type MySQLHealthCrawler struct {
} }
func (c *MySQLHealthCrawler) Name() string { func (c *MySQLHealthCrawler) Name() string {
return "MYSQL_HEALTH_CRAWLER" return "MYSQL_HEALTH"
}
func (c *MySQLHealthCrawler) String() string {
return "MySQL Health Crawler"
}
func (c *MySQLHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *MySQLHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *MySQLHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type NetBIOSHealthCrawler struct {
} }
func (c *NetBIOSHealthCrawler) Name() string { func (c *NetBIOSHealthCrawler) Name() string {
return "NETBIOS_HEALTH_CRAWLER" return "NETBIOS_HEALTH"
}
func (c *NetBIOSHealthCrawler) String() string {
return "NetBIOS Health Crawler"
}
func (c *NetBIOSHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *NetBIOSHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *NetBIOSHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type OracleHealthCrawler struct {
} }
func (c *OracleHealthCrawler) Name() string { func (c *OracleHealthCrawler) Name() string {
return "ORACLE_HEALTH_CRAWLER" return "ORACLE_HEALTH"
}
func (c *OracleHealthCrawler) String() string {
return "Oracle Health Crawler"
}
func (c *OracleHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *OracleHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *OracleHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type POPHealthCrawler struct {
} }
func (c *POPHealthCrawler) Name() string { func (c *POPHealthCrawler) Name() string {
return "POP_HEALTH_CRAWLER" return "POP_HEALTH"
}
func (c *POPHealthCrawler) String() string {
return "POP Health Crawler"
}
func (c *POPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *POPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *POPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type PostgreSQLHealthCrawler struct {
} }
func (c *PostgreSQLHealthCrawler) Name() string { func (c *PostgreSQLHealthCrawler) Name() string {
return "POSTGRESQL_HEALTH_CRAWLER" return "POSTGRESQL_HEALTH"
}
func (c *PostgreSQLHealthCrawler) String() string {
return "PostgreSQL Health Crawler"
}
func (c *PostgreSQLHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *PostgreSQLHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *PostgreSQLHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type RedisHealthCrawler struct {
} }
func (c *RedisHealthCrawler) Name() string { func (c *RedisHealthCrawler) Name() string {
return "REDIS_HEALTH_CRAWLER" return "REDIS_HEALTH"
}
func (c *RedisHealthCrawler) String() string {
return "Redis Health Crawler"
}
func (c *RedisHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *RedisHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *RedisHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type RMIHealthCrawler struct {
} }
func (c *RMIHealthCrawler) Name() string { func (c *RMIHealthCrawler) Name() string {
return "RMI_HEALTH_CRAWLER" return "RMI_HEALTH"
}
func (c *RMIHealthCrawler) String() string {
return "RMI Health Crawler"
}
func (c *RMIHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *RMIHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *RMIHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SMBHealthCrawler struct {
} }
func (c *SMBHealthCrawler) Name() string { func (c *SMBHealthCrawler) Name() string {
return "SMB_HEALTH_CRAWLER" return "SMB_HEALTH"
}
func (c *SMBHealthCrawler) String() string {
return "SMB Health Crawler"
}
func (c *SMBHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SMBHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SMBHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SMTPHealthCrawler struct {
} }
func (c *SMTPHealthCrawler) Name() string { func (c *SMTPHealthCrawler) Name() string {
return "SMTP_HEALTH_CRAWLER" return "SMTP_HEALTH"
}
func (c *SMTPHealthCrawler) String() string {
return "SMTP Health Crawler"
}
func (c *SMTPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SMTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SMTPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SNMPHealthCrawler struct {
} }
func (c *SNMPHealthCrawler) Name() string { func (c *SNMPHealthCrawler) Name() string {
return "SNMPV2C_HEALTH_CRAWLER" return "SNMPV2C_HEALTH"
}
func (c *SNMPHealthCrawler) String() string {
return "SNMP V2C Health Crawler"
}
func (c *SNMPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SNMPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SNMPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SNMPHealthCrawler struct {
} }
func (c *SNMPHealthCrawler) Name() string { func (c *SNMPHealthCrawler) Name() string {
return "SNMPV3_HEALTH_CRAWLER" return "SNMPV3_HEALTH"
}
func (c *SNMPHealthCrawler) String() string {
return "SNMP V3 Health Crawler"
}
func (c *SNMPHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SNMPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SNMPHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SQLServerHealthCrawler struct {
} }
func (c *SQLServerHealthCrawler) Name() string { func (c *SQLServerHealthCrawler) Name() string {
return "SQLSERVER_HEALTH_CRAWLER" return "SQLSERVER_HEALTH"
}
func (c *SQLServerHealthCrawler) String() string {
return "SQL Server Health Crawler"
}
func (c *SQLServerHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SQLServerHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SQLServerHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type SSHHealthCrawler struct {
} }
func (c *SSHHealthCrawler) Name() string { func (c *SSHHealthCrawler) Name() string {
return "SSH_HEALTH_CRAWLER" return "SSH_HEALTH"
}
func (c *SSHHealthCrawler) String() string {
return "SSH Health Crawler"
}
func (c *SSHHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SSHHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SSHHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type TelnetHealthCrawler struct {
} }
func (c *TelnetHealthCrawler) Name() string { func (c *TelnetHealthCrawler) Name() string {
return "TELNET_HEALTH_CRAWLER" return "TELNET_HEALTH"
}
func (c *TelnetHealthCrawler) String() string {
return "Telnet Health Crawler"
}
func (c *TelnetHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *TelnetHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *TelnetHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -12,7 +12,15 @@ type WMIHealthCrawler struct {
} }
func (c *WMIHealthCrawler) Name() string { func (c *WMIHealthCrawler) Name() string {
return "WMI_HEALTH_CRAWLER" return "WMI_HEALTH"
}
func (c *WMIHealthCrawler) String() string {
return "WMI Health Crawler"
}
func (c *WMIHealthCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *WMIHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *WMIHealthCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {

View File

@ -5,11 +5,12 @@ import (
"bytes" "bytes"
"fmt" "fmt"
uuid "github.com/satori/go.uuid"
ocsm "git.loafle.net/overflow/commons-go/sensorconfig/model" ocsm "git.loafle.net/overflow/commons-go/sensorconfig/model"
"git.loafle.net/overflow/container_network/crawler/ssh/client" "git.loafle.net/overflow/container_network/crawler/ssh/client"
"git.loafle.net/overflow/container_network/crawler/ssh/parser" "git.loafle.net/overflow/container_network/crawler/ssh/parser"
crawler "git.loafle.net/overflow/crawler-go" crawler "git.loafle.net/overflow/crawler-go"
sensorConfigUtil "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/util"
) )
type SSHCrawler struct { type SSHCrawler struct {
@ -17,7 +18,15 @@ type SSHCrawler struct {
} }
func (c *SSHCrawler) Name() string { func (c *SSHCrawler) Name() string {
return "SSH_CRAWLER" return "SSH"
}
func (c *SSHCrawler) String() string {
return "SSH Crawler"
}
func (c *SSHCrawler) Auth(auth map[string]string) error {
return nil
} }
func (c *SSHCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) { func (c *SSHCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {
@ -64,7 +73,7 @@ func (c *SSHCrawler) Get(config *ocsm.SensorConfig) (map[string]string, error) {
} }
if nil != rm { if nil != rm {
mm := sensorConfigUtil.KeysToMap(item.Keys) mm := ocsm.KeysToMap(item.Keys)
for key, value := range mm { for key, value := range mm {
results[value] = rm[key] results[value] = rm[key]
} }

View File

@ -16,7 +16,7 @@
"interval": "5" "interval": "5"
}, },
"crawler": { "crawler": {
"name": "SSH_CRAWLER", "name": "SSH",
"container": "go_proxy" "container": "go_proxy"
}, },
"items": [{ "items": [{