added processing err

This commit is contained in:
insanity@loafle.com 2017-05-17 12:26:24 +09:00
parent fa53ca1724
commit 4d4b9b6fa6
3 changed files with 7 additions and 9 deletions

View File

@ -37,7 +37,6 @@ func (c *CrawlerImpl) Init(data []byte) ([]byte, error) {
log.Fatal(err)
}
// load all file in path
return json.Marshal(true)
}
@ -55,7 +54,6 @@ func (c *CrawlerImpl) Remove(id string) ([]byte, error) {
return json.Marshal(true)
}
func (c *CrawlerImpl) Get(id string) ([]byte, error) {
if c.internal != nil {
out, err := c.internal.Internal(c.GetConfig(id))
if err != nil {
@ -64,7 +62,7 @@ func (c *CrawlerImpl) Get(id string) ([]byte, error) {
}
return out, nil
}
return nil, errors.New("Not Assign")
return nil, errors.New("Not Assigned")
}
// internal methods

View File

@ -5,6 +5,7 @@ import (
"loafle.com/overflow/commons_go/matcher/snmp"
"loafle.com/overflow/crawler_go"
config "loafle.com/overflow/agent_api/config_manager"
"log"
)
type SNMPV2CHeahthCrawler struct {
@ -12,7 +13,7 @@ type SNMPV2CHeahthCrawler struct {
}
func (r *SNMPV2CHeahthCrawler)Internal(params config.Config) ([]byte, error) {
log.Println("????????????????????????????????")
b, err := r.CheckHeahth(params)
if err != nil {
return nil, err

View File

@ -19,9 +19,9 @@ func (s *SocketHeahthCrawler) SetMatcher(m matcher.Matcher) {
}
func (s *SocketHeahthCrawler) getConnection(params config.Config) (net.Conn, error) {
connection := params.Target.Connection
ip := connection.Ip
port := connection.Port
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) {
conn, err := s.getConnection(params)
if err != nil {
return false, err
}
defer conn.Close()
connection := params.Target.Connection
info := scaninfo.NewScanInfoImpl(connection.Ip,connection.Port)
if s.m.IsPrePacket() == true {
bytes := make([]byte, 1024)
n, _ := conn.Read(bytes)