added processing err
This commit is contained in:
parent
fa53ca1724
commit
4d4b9b6fa6
|
@ -37,7 +37,6 @@ func (c *CrawlerImpl) Init(data []byte) ([]byte, error) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// load all file in path
|
// load all file in path
|
||||||
return json.Marshal(true)
|
return json.Marshal(true)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,6 @@ func (c *CrawlerImpl) Remove(id string) ([]byte, error) {
|
||||||
return json.Marshal(true)
|
return json.Marshal(true)
|
||||||
}
|
}
|
||||||
func (c *CrawlerImpl) Get(id string) ([]byte, error) {
|
func (c *CrawlerImpl) Get(id string) ([]byte, error) {
|
||||||
|
|
||||||
if c.internal != nil {
|
if c.internal != nil {
|
||||||
out, err := c.internal.Internal(c.GetConfig(id))
|
out, err := c.internal.Internal(c.GetConfig(id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -64,7 +62,7 @@ func (c *CrawlerImpl) Get(id string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
return nil, errors.New("Not Assign")
|
return nil, errors.New("Not Assigned")
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal methods
|
// internal methods
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"loafle.com/overflow/commons_go/matcher/snmp"
|
"loafle.com/overflow/commons_go/matcher/snmp"
|
||||||
"loafle.com/overflow/crawler_go"
|
"loafle.com/overflow/crawler_go"
|
||||||
config "loafle.com/overflow/agent_api/config_manager"
|
config "loafle.com/overflow/agent_api/config_manager"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SNMPV2CHeahthCrawler struct {
|
type SNMPV2CHeahthCrawler struct {
|
||||||
|
@ -12,7 +13,7 @@ type SNMPV2CHeahthCrawler struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *SNMPV2CHeahthCrawler)Internal(params config.Config) ([]byte, error) {
|
func (r *SNMPV2CHeahthCrawler)Internal(params config.Config) ([]byte, error) {
|
||||||
|
log.Println("????????????????????????????????")
|
||||||
b, err := r.CheckHeahth(params)
|
b, err := r.CheckHeahth(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -19,9 +19,9 @@ func (s *SocketHeahthCrawler) SetMatcher(m matcher.Matcher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, error) {
|
func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, error) {
|
||||||
|
|
||||||
connection := params.Target.Connection
|
connection := params.Target.Connection
|
||||||
|
|
||||||
ip := connection.Ip
|
ip := connection.Ip
|
||||||
port := connection.Port
|
port := connection.Port
|
||||||
portType := connection.PortType
|
portType := connection.PortType
|
||||||
|
@ -55,16 +55,15 @@ func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SocketHeahthCrawler) CheckHeahth(params config.Config) (bool, error) {
|
func (s *SocketHeahthCrawler) CheckHeahth(params config.Config) (bool, error) {
|
||||||
|
|
||||||
conn, err := s.getConnection(params)
|
conn, err := s.getConnection(params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
connection := params.Target.Connection
|
connection := params.Target.Connection
|
||||||
info := scaninfo.NewScanInfoImpl(connection.Ip,connection.Port)
|
info := scaninfo.NewScanInfoImpl(connection.Ip,connection.Port)
|
||||||
|
|
||||||
if s.m.IsPrePacket() == true {
|
if s.m.IsPrePacket() == true {
|
||||||
bytes := make([]byte, 1024)
|
bytes := make([]byte, 1024)
|
||||||
n, _ := conn.Read(bytes)
|
n, _ := conn.Read(bytes)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user