.
This commit is contained in:
parent
55682d7d39
commit
a1a8d24728
37
const.go
Normal file
37
const.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package crawler
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type CrawlerName int
|
||||
|
||||
func (c CrawlerName) String() string {
|
||||
return strconv.Itoa(int(c))
|
||||
}
|
||||
|
||||
const (
|
||||
ACTIVEDIRECTORY = CrawlerName(iota)
|
||||
DNS
|
||||
FTP
|
||||
FTPS
|
||||
IMAP
|
||||
LDAP
|
||||
MONGODB
|
||||
MSSQL
|
||||
MYSQL
|
||||
MARIADB
|
||||
PGSQL
|
||||
NETBIOS
|
||||
ORACLE
|
||||
POP3
|
||||
REDIS
|
||||
RMI
|
||||
SMB
|
||||
SMTP
|
||||
SNMPV2C
|
||||
SNMPV3
|
||||
SSH
|
||||
TELNET
|
||||
WMI
|
||||
)
|
|
@ -4,6 +4,8 @@ import (
|
|||
"loafle.com/overflow/of_rpc_go/models/param"
|
||||
)
|
||||
|
||||
|
||||
|
||||
type Internal interface {
|
||||
Internal(params map[string]interface{}) (param.Output, error)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"loafle.com/overflow/commons_go/matcher"
|
||||
"loafle.com/overflow/commons_go/matcher/packet"
|
||||
"net"
|
||||
"loafle.com/overflow/commons_go/model/scaninfo"
|
||||
)
|
||||
|
||||
type SocketHeahthCrawler struct {
|
||||
|
@ -40,6 +41,7 @@ func (s *SocketHeahthCrawler) getConnection(params map[string]interface{}) (net.
|
|||
&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
ServerName: ip,
|
||||
ClientAuth: tls.RequestClientCert,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -56,27 +58,29 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool,
|
|||
return false, err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
|
||||
info := scaninfo.NewScanInfoImpl(params["ip"].(string),params["port"].(string))
|
||||
|
||||
if s.m.IsPrePacket() == true {
|
||||
bytes := make([]byte, 1024)
|
||||
n, _ := conn.Read(bytes)
|
||||
p := packet.NewPacket(bytes, n)
|
||||
if s.m.Match(0, p, nil) == false {
|
||||
if s.m.Match(0, p, info) == false {
|
||||
return false, nil
|
||||
} else {
|
||||
|
||||
for i := 1; i < s.m.PacketCount(); i++ {
|
||||
pack := s.m.Packet(i-1)
|
||||
for i := 0; i < s.m.PacketCount(); i++ {
|
||||
pack := s.m.Packet(i)
|
||||
conn.Write(pack.Buffer)
|
||||
bytes := make([]byte, 1024)
|
||||
n, _ := conn.Read(bytes)
|
||||
|
||||
if s.m.IsNoResponse(i) == true { // empty last response
|
||||
if s.m.IsNoResponse(i+1) == true { // empty last response
|
||||
break
|
||||
}
|
||||
|
||||
p := packet.NewPacket(bytes, n)
|
||||
if s.m.Match(i, p, nil) == false {
|
||||
if s.m.Match(i+1, p, info) == false {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +99,7 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool,
|
|||
}
|
||||
|
||||
p := packet.NewPacket(bytes, n)
|
||||
if s.m.Match(i, p, nil) == false {
|
||||
if s.m.Match(i, p, info) == false {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user