This commit is contained in:
crusader 2018-03-27 18:03:36 +09:00
parent 8dd32aedb8
commit a07f717d52
85 changed files with 834 additions and 1249 deletions

View File

@ -1,68 +1,76 @@
package crawler
import (
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
activedirectoryH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/activedirectory"
cassandraH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/cassandra"
dnsH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/dns"
ftpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/ftp"
httpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/http"
imapH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/imap"
ldapH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/ldap"
mongodbH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/mongodb"
mysqlH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/mysql"
netbiosH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/netbios"
oracleH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/oracle"
popH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/pop"
postgresqlH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/postgresql"
redisH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/redis"
rmiH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/rmi"
smbH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/smb"
smtpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/smtp"
snmpV2H "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/snmp/v2"
snmpV3H "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/snmp/v3"
sqlserverH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/sqlserver"
sshH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/ssh"
telnetH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/telnet"
wmiH "git.loafle.net/overflow/overflow_probe_container_network/crawler/health/wmi"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/ssh"
)
type Crawler interface {
Init(config *configM.Config) error
Add(config *configM.Config) error
Remove(id string) error
Get(id string) (map[string]string, error)
var crawlers map[string]oopcc.Crawler
Name() string
func init() {
crawlers = make(map[string]oopcc.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())
}
type InternalCrawler interface {
InternalGet(config *configM.Config) (map[string]string, error)
func addCrawler(c oopcc.Crawler) {
crawlers[c.Name()] = c
}
type Crawlers struct {
configs map[string]*configM.Config
Internal InternalCrawler
}
func (c *Crawlers) GetConfig(id string) *configM.Config {
if nil == c.configs {
func GetCrawler(name string) oopcc.Crawler {
c, ok := crawlers[name]
if !ok {
return nil
}
return c.configs[id]
return c
}
func (c *Crawlers) RemoveConfig(id string) {
if nil == c.configs {
return
}
delete(c.configs, id)
}
func (c *Crawlers) PutConfig(id string, config *configM.Config) {
if nil == c.configs {
c.configs = make(map[string]*configM.Config, 0)
}
c.configs[id] = config
}
func (c *Crawlers) Init(config *configM.Config) error {
c.PutConfig(config.ID.String(), config)
return nil
}
func (c *Crawlers) Add(config *configM.Config) error {
c.PutConfig(config.ID.String(), config)
return nil
}
func (c *Crawlers) Remove(id string) error {
c.RemoveConfig(id)
return nil
}
func (c *Crawlers) Get(id string) (map[string]string, error) {
rss, err := c.Internal.InternalGet(c.GetConfig(id))
if nil != err {
return nil, err
}
return rss, nil
func GetCrawlers() map[string]oopcc.Crawler {
return crawlers
}

View File

@ -9,12 +9,12 @@ import (
cnsm "git.loafle.net/commons_go/network_service_matcher"
cuej "git.loafle.net/commons_go/util/encoding/json"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
)
type SocketHeahthCrawler struct {
crawler.Crawlers
oopcc.Crawler
m cnsm.Matcher
}
@ -22,7 +22,7 @@ func (s *SocketHeahthCrawler) SetMatcher(m cnsm.Matcher) {
s.m = m
}
func (s *SocketHeahthCrawler) getConnection(config *configM.Config) (net.Conn, error) {
func (s *SocketHeahthCrawler) getConnection(config *sensorConfigM.SensorConfig) (net.Conn, error) {
connection := config.Target.Connection
ip := connection.IP
@ -54,7 +54,7 @@ func (s *SocketHeahthCrawler) getConnection(config *configM.Config) (net.Conn, e
return conn, nil
}
func (s *SocketHeahthCrawler) CheckHeahth(config *configM.Config) (result map[string]string, err error) {
func (s *SocketHeahthCrawler) CheckHeahth(config *sensorConfigM.SensorConfig) (result map[string]string, err error) {
result = make(map[string]string, 0)
result["StartTime"] = time.Now().String()

View File

@ -2,9 +2,9 @@ package activedirectory
import (
cnsma "git.loafle.net/commons_go/network_service_matcher/activedirectory"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type ActiveDirectoryHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *ActiveDirectoryHealthCrawler) Name() string {
return "ACTIVEDIRECTORY_HEALTH_CRAWLER"
}
func (c *ActiveDirectoryHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *ActiveDirectoryHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *ActiveDirectoryHealthCrawler) InternalGet(config *configM.Config) (map[
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
ad := &ActiveDirectoryHealthCrawler{}
ad.Internal = ad
ad.SetMatcher(cnsma.NewMatcher())
return ad
}

View File

@ -0,0 +1,27 @@
package activedirectory
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.1",
Port: json.Number(389),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package cassandra
import (
cnsmc "git.loafle.net/commons_go/network_service_matcher/cassandra"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type CassandraHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *CassandraHealthCrawler) Name() string {
return "CASSANDRA_HEALTH_CRAWLER"
}
func (c *CassandraHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *CassandraHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *CassandraHealthCrawler) InternalGet(config *configM.Config) (map[string
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &CassandraHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmc.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package cassandra
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.104",
Port: json.Number(9042),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package dns
import (
cnsmd "git.loafle.net/commons_go/network_service_matcher/dns"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type DNSHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *DNSHealthCrawler) Name() string {
return "DNS_HEALTH_CRAWLER"
}
func (c *DNSHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *DNSHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *DNSHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &DNSHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmd.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package dns
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(53),
PortType: "udp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package ftp
import (
cnsmf "git.loafle.net/commons_go/network_service_matcher/ftp"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type FTPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *FTPHealthCrawler) Name() string {
return "FTP_HEALTH_CRAWLER"
}
func (c *FTPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *FTPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *FTPHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &FTPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmf.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package ftp
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(21),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package http
import (
cnsmh "git.loafle.net/commons_go/network_service_matcher/http"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type HTTPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *HTTPHealthCrawler) Name() string {
return "HTTP_HEALTH_CRAWLER"
}
func (c *HTTPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *HTTPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *HTTPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &HTTPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmh.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package http
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.105",
Port: json.Number(80),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package imap
import (
cnsmi "git.loafle.net/commons_go/network_service_matcher/imap"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type IMAPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *IMAPHealthCrawler) Name() string {
return "IMAP_HEALTH_CRAWLER"
}
func (c *IMAPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *IMAPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *IMAPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &IMAPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmi.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package imap
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(993),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package ldap
import (
cnsml "git.loafle.net/commons_go/network_service_matcher/ldap"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type LDAPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *LDAPHealthCrawler) Name() string {
return "LDAP_HEALTH_CRAWLER"
}
func (c *LDAPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *LDAPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *LDAPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &LDAPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsml.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package ldap
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(389),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package mongodb
import (
cnsmm "git.loafle.net/commons_go/network_service_matcher/mongodb"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type MongoDBHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *MongoDBHealthCrawler) Name() string {
return "MONGODB_HEALTH_CRAWLER"
}
func (c *MongoDBHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *MongoDBHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *MongoDBHealthCrawler) InternalGet(config *configM.Config) (map[string]s
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &MongoDBHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmm.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package mongodb
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.104",
Port: json.Number(27017),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package mysql
import (
cnsmm "git.loafle.net/commons_go/network_service_matcher/mysql"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type MySQLHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *MySQLHealthCrawler) Name() string {
return "MYSQL_HEALTH_CRAWLER"
}
func (c *MySQLHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *MySQLHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *MySQLHealthCrawler) InternalGet(config *configM.Config) (map[string]str
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &MySQLHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmm.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package mysql
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.103",
Port: json.Number(3306),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package netbios
import (
cnsmn "git.loafle.net/commons_go/network_service_matcher/netbios"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type NetBIOSHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *NetBIOSHealthCrawler) Name() string {
return "NETBIOS_HEALTH_CRAWLER"
}
func (c *NetBIOSHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *NetBIOSHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *NetBIOSHealthCrawler) InternalGet(config *configM.Config) (map[string]s
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &NetBIOSHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmn.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package netbios
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.106",
Port: json.Number(139),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package oracle
import (
cnsmo "git.loafle.net/commons_go/network_service_matcher/oracle"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type OracleHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *OracleHealthCrawler) Name() string {
return "ORACLE_HEALTH_CRAWLER"
}
func (c *OracleHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *OracleHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *OracleHealthCrawler) InternalGet(config *configM.Config) (map[string]st
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &OracleHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmo.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package oracle
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.30",
Port: json.Number(1521),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package pop
import (
cnsmp "git.loafle.net/commons_go/network_service_matcher/pop"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type POPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *POPHealthCrawler) Name() string {
return "POP_HEALTH_CRAWLER"
}
func (c *POPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *POPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *POPHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &POPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmp.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package pop
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(110),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package postgresql
import (
cnsmp "git.loafle.net/commons_go/network_service_matcher/postgresql"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type PostgreSQLHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *PostgreSQLHealthCrawler) Name() string {
return "POSTGRESQL_HEALTH_CRAWLER"
}
func (c *PostgreSQLHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *PostgreSQLHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *PostgreSQLHealthCrawler) InternalGet(config *configM.Config) (map[strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &PostgreSQLHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmp.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package postgresql
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.107",
Port: json.Number(5432),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package redis
import (
cnsmr "git.loafle.net/commons_go/network_service_matcher/redis"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type RedisHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *RedisHealthCrawler) Name() string {
return "REDIS_HEALTH_CRAWLER"
}
func (c *RedisHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *RedisHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *RedisHealthCrawler) InternalGet(config *configM.Config) (map[string]str
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &RedisHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmr.NewMatcher())
return c
}

View File

@ -0,0 +1,27 @@
package redis
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.104",
Port: json.Number(6379),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package rmi
import (
cnsmr "git.loafle.net/commons_go/network_service_matcher/rmi"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type RMIHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *RMIHealthCrawler) Name() string {
return "RMI_HEALTH_CRAWLER"
}
func (c *RMIHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *RMIHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *RMIHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &RMIHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmr.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package rmi
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.103",
Port: json.Number(9840),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package smb
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/smb"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SMBHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SMBHealthCrawler) Name() string {
return "SMB_HEALTH_CRAWLER"
}
func (c *SMBHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SMBHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SMBHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SMBHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package smb
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.106",
Port: json.Number(445),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package smtp
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/smtp"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SMTPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SMTPHealthCrawler) Name() string {
return "SMTP_HEALTH_CRAWLER"
}
func (c *SMTPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SMTPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SMTPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SMTPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package smtp
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(25),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package v2
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/snmp/v2"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SNMPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SNMPHealthCrawler) Name() string {
return "SNMPV2C_HEALTH_CRAWLER"
}
func (c *SNMPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SNMPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SNMPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SNMPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package v2
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(161),
PortType: "udp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package v3
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/snmp/v3"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SNMPHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SNMPHealthCrawler) Name() string {
return "SNMPV3_HEALTH_CRAWLER"
}
func (c *SNMPHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SNMPHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SNMPHealthCrawler) InternalGet(config *configM.Config) (map[string]stri
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SNMPHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package v3
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.254",
Port: json.Number(161),
PortType: "udp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package sqlserver
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/sqlserver"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SQLServerHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SQLServerHealthCrawler) Name() string {
return "SQLSERVER_HEALTH_CRAWLER"
}
func (c *SQLServerHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SQLServerHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SQLServerHealthCrawler) InternalGet(config *configM.Config) (map[string
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SQLServerHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package sqlserver
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.106",
Port: json.Number(1433),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -2,9 +2,9 @@ package ssh
import (
cnsms "git.loafle.net/commons_go/network_service_matcher/ssh"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type SSHHealthCrawler struct {
@ -15,7 +15,7 @@ func (c *SSHHealthCrawler) Name() string {
return "SSH_HEALTH_CRAWLER"
}
func (c *SSHHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SSHHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -23,9 +23,8 @@ func (c *SSHHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SSHHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsms.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package ssh
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(22),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,11 +1,10 @@
package telnet
import (
cnsmt "git.loafle.net/commons_go/network_service_matcher/telnet"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type TelnetHealthCrawler struct {
@ -16,7 +15,7 @@ func (c *TelnetHealthCrawler) Name() string {
return "TELNET_HEALTH_CRAWLER"
}
func (c *TelnetHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *TelnetHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -24,9 +23,8 @@ func (c *TelnetHealthCrawler) InternalGet(config *configM.Config) (map[string]st
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &TelnetHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmt.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package telnet
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.215",
Port: json.Number(23),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,11 +1,10 @@
package wmi
import (
cnsmw "git.loafle.net/commons_go/network_service_matcher/wmi"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/health"
)
type WMIHealthCrawler struct {
@ -16,7 +15,7 @@ func (c *WMIHealthCrawler) Name() string {
return "WMI_HEALTH_CRAWLER"
}
func (c *WMIHealthCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *WMIHealthCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
rss, err := c.CheckHeahth(config)
if err != nil {
return nil, err
@ -24,9 +23,8 @@ func (c *WMIHealthCrawler) InternalGet(config *configM.Config) (map[string]strin
return rss, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &WMIHealthCrawler{}
c.Internal = c
c.SetMatcher(cnsmw.NewMatcher())
return c
}

View File

@ -0,0 +1,26 @@
package wmi
import (
"encoding/json"
"testing"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
config.Target = &sensorConfigM.Target{}
config.Target.Connection = &sensorConfigM.Connection{
IP: "192.168.1.1",
Port: json.Number(135),
PortType: "tcp",
SSL: false,
}
c := NewCrawler()
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package activedirectory
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*ActiveDirectoryHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.1",
Port: json.Number(389),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package cassandra
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*CassandraHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.104",
Port: json.Number(9042),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package dns
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*DNSHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(53),
PortType: "udp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package ftp
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*FTPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(21),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package http
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*HTTPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.105",
Port: json.Number(80),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package imap
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*IMAPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(993),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package ldap
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*LDAPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(389),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package mongodb
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*MongoDBHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.104",
Port: json.Number(27017),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package mysql
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*MySQLHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.103",
Port: json.Number(3306),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package netbios
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*NetBIOSHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.106",
Port: json.Number(139),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package oracle
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*OracleHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.30",
Port: json.Number(1521),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package pop
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*POPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(110),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package postgresql
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*PostgreSQLHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.107",
Port: json.Number(5432),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package redis
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*RedisHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.104",
Port: json.Number(6379),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package rmi
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*RMIHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.103",
Port: json.Number(9840),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package smb
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SMBHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.106",
Port: json.Number(445),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package smtp
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SMTPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(25),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package v2
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SNMPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(161),
PortType: "udp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package v3
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SNMPHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.254",
Port: json.Number(161),
PortType: "udp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package sqlserver
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SQLServerHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.106",
Port: json.Number(1433),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package ssh
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*SSHHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(22),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package telnet
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*TelnetHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.215",
Port: json.Number(23),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,37 +0,0 @@
package wmi
import (
"encoding/json"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
c := NewCrawler().(*WMIHealthCrawler)
config := &configM.Config{}
config.Target = &configM.Target{}
config.Target.Connection = &configM.Connection{
IP: "192.168.1.1",
Port: json.Number(135),
PortType: "tcp",
SSL: false,
}
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
assert.Nil(t, err)
assert.NotNil(t, rss)
}

View File

@ -1,72 +0,0 @@
package impl
import (
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
activedirectoryH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/activedirectory"
cassandraH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/cassandra"
dnsH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/dns"
ftpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/ftp"
httpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/http"
imapH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/imap"
ldapH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/ldap"
mongodbH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/mongodb"
mysqlH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/mysql"
netbiosH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/netbios"
oracleH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/oracle"
popH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/pop"
postgresqlH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/postgresql"
redisH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/redis"
rmiH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/rmi"
smbH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/smb"
smtpH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/smtp"
snmpV2H "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/snmp/v2"
snmpV3H "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/snmp/v3"
sqlserverH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/sqlserver"
sshH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/ssh"
telnetH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/telnet"
wmiH "git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/health/wmi"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/ssh"
)
var crawlers map[string]crawler.Crawler
func init() {
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) {
crawlers[c.Name()] = c
}
func GetCrawler(name string) crawler.Crawler {
c, ok := crawlers[name]
if !ok {
return nil
}
return c
}

View File

@ -5,23 +5,23 @@ import (
"bytes"
"fmt"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
configUtil "git.loafle.net/overflow/overflow_commons_go/modules/config/util"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/ssh/client"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl/ssh/parser"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
sensorConfigUtil "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/util"
oopcc "git.loafle.net/overflow/overflow_probe_container/crawler"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/ssh/client"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/ssh/parser"
"github.com/satori/go.uuid"
)
type SSHCrawler struct {
crawler.Crawlers
oopcc.Crawler
}
func (c *SSHCrawler) Name() string {
return "SSH_CRAWLER"
}
func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, error) {
func (c *SSHCrawler) Get(config *sensorConfigM.SensorConfig) (map[string]string, error) {
sshClient, err := client.New(config.Target)
if nil != err {
return nil, err
@ -29,7 +29,12 @@ func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, err
itemCount := len(config.Items)
results := make(map[string]string, 0)
boundary := uuid.NewV4().String()
uuid, err := uuid.NewV4()
if nil != err {
return nil, err
}
boundary := uuid.String()
commands := ""
for i := 0; i < itemCount; i++ {
@ -65,7 +70,7 @@ func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, err
}
if nil != rm {
mm := configUtil.KeysToMap(item.Keys)
mm := sensorConfigUtil.KeysToMap(item.Keys)
for key, value := range mm {
results[value] = rm[key]
}
@ -79,9 +84,8 @@ func (c *SSHCrawler) InternalGet(config *configM.Config) (map[string]string, err
return results, nil
}
func NewCrawler() crawler.Crawler {
func NewCrawler() oopcc.Crawler {
c := &SSHCrawler{}
c.Internal = c
return c
}

View File

@ -6,13 +6,12 @@ import (
"log"
"testing"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"github.com/stretchr/testify/assert"
)
func setConfig() crawler.Crawler {
config := &configM.Config{}
func TestMatch(t *testing.T) {
config := &sensorConfigM.SensorConfig{}
data, err := ioutil.ReadFile("./SSHCrawler_test.json")
if err != nil {
log.Fatal(err)
@ -23,16 +22,8 @@ func setConfig() crawler.Crawler {
}
c := NewCrawler().(*SSHCrawler)
c.PutConfig("c", config)
return c
}
func TestMatch(t *testing.T) {
// test config
c := setConfig()
rss, err := c.Get("c")
rss, err := c.Get(config)
assert.Nil(t, err)
assert.NotNil(t, rss)

View File

@ -8,7 +8,7 @@ import (
"git.loafle.net/commons_go/logging"
cuej "git.loafle.net/commons_go/util/encoding/json"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
"golang.org/x/crypto/ssh"
)
@ -88,7 +88,7 @@ func parsePrivateKey(keyPath, pw string) (ssh.Signer, error) {
return ssh.ParsePrivateKeyWithPassphrase(buff, []byte(pw))
}
func New(target *configM.Target) (*SSHClient, error) {
func New(target *sensorConfigM.Target) (*SSHClient, error) {
connection := target.Connection
auth := target.Auth

View File

@ -8,8 +8,10 @@ import (
crr "git.loafle.net/commons_go/rpc/registry"
"git.loafle.net/commons_go/server"
ooca "git.loafle.net/overflow/overflow_commons_go/annotation"
oopc "git.loafle.net/overflow/overflow_probe_container"
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
oopcService "git.loafle.net/overflow/overflow_probe_container/service"
"git.loafle.net/overflow/overflow_probe_container_network/crawler"
oopcns "git.loafle.net/overflow/overflow_probe_container_network/service"
)
@ -21,6 +23,8 @@ func New(pidPath string) server.Server {
)
oopcns.InitService()
cdr.RegisterResource(oopc.PROBE_CONTAINER_CRAWLERS, crawler.GetCrawlers())
rpcRegistry := crr.NewRPCRegistry()
if services, err = cdr.GetInstancesByAnnotationName(ooca.ServiceTag); nil != err {
@ -40,7 +44,7 @@ func New(pidPath string) server.Server {
rpcSH := oopcs.NewRPCServletHandler(rpcRegistry)
socketHandler := newSocketHandler(rpcSH, probeService)
sh := newServerHandler(pidPath, socketHandler)
sh := newServerHandler(pidPath, socketHandler, services, oopcns.ServicesToStartAndStop)
s := oopcs.New(sh)
return s

View File

@ -1,13 +1,15 @@
package server
import (
"reflect"
"git.loafle.net/commons_go/server"
oopcs "git.loafle.net/overflow/overflow_probe_container/server"
)
func newServerHandler(pidPath string, socketHandler SocketHandler) ServerHandler {
func newServerHandler(pidPath string, socketHandler SocketHandler, services []interface{}, servicesToStartAndStop []reflect.Type) ServerHandler {
sh := &ServerHandlers{}
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Network Containter", socketHandler)
sh.ServerHandler = oopcs.NewServerHandler(pidPath, "Network Containter", socketHandler, services, servicesToStartAndStop)
return sh
}
@ -34,6 +36,11 @@ func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) {
sh.ServerHandler.OnStop(serverCTX)
}
func (sh *ServerHandlers) Destroy(serverCTX server.ServerContext) {
sh.ServerHandler.Destroy(serverCTX)
}
func (sh *ServerHandlers) Validate() {
sh.ServerHandler.Validate()

View File

@ -1,57 +0,0 @@
package service
import (
"reflect"
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
configM "git.loafle.net/overflow/overflow_commons_go/modules/config/model"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl"
)
func init() {
cdr.RegisterType(reflect.TypeOf((*ConfigService)(nil)))
}
type ConfigService struct {
cda.TypeAnnotation `annotation:"@overFlow:Service()"`
}
func (s *ConfigService) Add(crawlerName string, config *configM.Config) error {
c := impl.GetCrawler(crawlerName)
return c.Add(config)
}
func (s *ConfigService) Remove(crawlerName string, id string) error {
c := impl.GetCrawler(crawlerName)
return c.Remove(id)
}
func (s *ConfigService) Init(configs []map[string]*configM.Config) error {
var err error
sensorIDs := make([]map[string]*configM.Config, 0)
ok := true
Loop:
for _, item := range configs {
for k, v := range item {
c := impl.GetCrawler(k)
if err = c.Init(v); nil != err {
ok = false
break Loop
}
sensorIDs = append(sensorIDs, item)
}
}
if !ok {
for _, item := range sensorIDs {
for k, v := range item {
s.Remove(k, v.ID.String())
}
}
return err
}
return nil
}

View File

@ -1,22 +0,0 @@
package service
import (
"reflect"
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
"git.loafle.net/overflow/overflow_probe_container_network/crawler/impl"
)
func init() {
cdr.RegisterType(reflect.TypeOf((*DataService)(nil)))
}
type DataService struct {
cda.TypeAnnotation `annotation:"@overFlow:Service()"`
}
func (s *DataService) Get(crawlerName string, sensorID string) (interface{}, error) {
c := impl.GetCrawler(crawlerName)
return c.Get(sensorID)
}

View File

@ -1,20 +0,0 @@
package service
import (
"reflect"
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
)
func init() {
cdr.RegisterType(reflect.TypeOf((*StateService)(nil)))
}
type StateService struct {
cda.TypeAnnotation `annotation:"@overFlow:Service()"`
}
func (s *StateService) State() (bool, error) {
return true, nil
}

View File

@ -1,9 +1,20 @@
package service
import (
"reflect"
oopcs "git.loafle.net/overflow/overflow_probe_container/service"
)
var (
ServicesToStartAndStop = []reflect.Type{
reflect.TypeOf((*oopcs.SensorConfigService)(nil)),
reflect.TypeOf((*oopcs.CrawlerService)(nil)),
reflect.TypeOf((*oopcs.ProbeService)(nil)),
reflect.TypeOf((*oopcs.StateService)(nil)),
}
)
func InitService() {
oopcs.InitService()
}