models

package
v0.0.0-...-308c33c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const Index = "scan-"

Variables

View Source
var Client *elastic.Client

Functions

func Esinit

func Esinit(conf *Config)

func IPRange

func IPRange(ipNet *net.IPNet) []string

根据IP和mask换算内网IP范围

func InsertEs

func InsertEs(dataType string, data EsSave)

func InsertEsAdd

func InsertEsAdd(dataType string, data EsAddSave)

func InsertEsBrute

func InsertEsBrute(dataType string, data EsBruteSave)

func InsertEsUp

func InsertEsUp(dataType string, upData EsUpSave)

func InsertThread

func InsertThread()

func SendMail

func SendMail(mail Mail, subject string, body string) (err error)

Types

type Brute

type Brute struct {
	StartTime string
	Ip        string
	Port      string
	Protocol  string
	Service   string
	Product   string
	Version   string
	Username  string
	Password  string
	Result    bool
	F         plugins.ScanType
	Cancel    context.CancelFunc
}

type Config

type Config struct {
	Ver     string   `yaml:"version"`
	Nmap    NmapScan `yaml:"nmap"`
	Masscan MasScan  `yaml:"masscan"`
	S       Scan     `yaml:"scan"`
	Mail    Mail     `yaml:"mail"`
	Es      Es       `yaml:"es"`
	Observe Observe  `yaml:"observe"`
}

func ReadYamlConfig

func ReadYamlConfig(path string) (conf *Config, err error)

type Data

type Data struct {
	D Res    `json:"data"`
	T string `json:"time"`
}

type DataScanHistory

type DataScanHistory struct {
	StartTime int `json:"starttime"`
	EndTime   int `json:"endtime"`
}

type Empty

type Empty struct{}

type Es

type Es struct {
	Address string `yaml:"address"`
}

type EsAddData

type EsAddData struct {
	// contains filtered or unexported fields
}

type EsAddSave

type EsAddSave struct {
	AddData map[string]interface{} `json:"addata"`
	Time    string                 `json:"time"`
}

type EsBruteData

type EsBruteData struct {
	// contains filtered or unexported fields
}

type EsBruteSave

type EsBruteSave struct {
	Data map[string]interface{} `json:"brutedata"`
	Time string                 `json:"time"`
}

type EsData

type EsData struct {
	// contains filtered or unexported fields
}

type EsSave

type EsSave struct {
	Data map[string]interface{} `json:"data"`
	Time string                 `json:"time"`
}

type EsUpData

type EsUpData struct {
	// contains filtered or unexported fields
}

type EsUpSave

type EsUpSave struct {
	Data    map[string]interface{} `json:"updata"`
	NewData map[string]interface{} `json:"newdata"`
	Time    string                 `json:"time"`
}

type IP

type IP uint32

func ParseIP

func ParseIP(b []byte) IP

[]byte --> IP

func (IP) String

func (ip IP) String() string

将 IP(uint32) 转换成 可读性IP字符串

type Mail

type Mail struct {
	Host     string   `yaml:"host"`
	Port     int      `yaml:"port"`
	Username string   `yaml:"username"`
	Passwrod string   `yaml:"password"`
	From     string   `yaml:"from"`
	To       []string `yaml:",flow"`
}

type MasScan

type MasScan struct {
	Path string `yaml:"path"`
	Rate string `yaml:"rate"`
}

type NmapScan

type NmapScan struct {
	Path string `yaml:"path"`
}

type Observe

type Observe struct {
	Sw string `yaml:"switch"`
}

type Res

type Res struct {
	Ip             string `json:"ip"`
	Port           int    `json:"port"`
	Protocol       string `json:"protocol"`
	Service        string `json:"service"`
	Product        string `json:"product"`
	Version        string `json:"version"`
	Nmap_starttime string `json:"nmap_starttime"`
	Nmap_endtime   string `json:"nmap_endtime"`
}

type Scan

type Scan struct {
	IpFile        string `yaml:"ipFile"`
	IpExcludeFile string `yaml:"ipexcludeFile"`
	UserList      string `yaml:"userDict"`
	PassList      string `yaml:"passwordDict"`
	ScanInterval  int    `yaml:"scan_interval"`
	Port          string `yaml:"port"`
	MasNum        int    `yaml:"mas_num"`
	NmapNum       int    `yaml:"nmap_num"`
}

type ScanHistoryData

type ScanHistoryData struct {
	T DataScanHistory `json:"data"`
}

type Scanner

type Scanner struct {
	IpSet         *Set
	MTcp          *masscan.Masscan
	MUdp          *masscan.Masscan
	MasStartTime  string
	MasEndTime    string
	NmapStartTime string
	NmapEndTime   string
	StartTime     string
	EndTime       string
	Conf          *Config

	UserList []string
	PassList []string
	Brutech  chan []nmap.NmapResult
	// contains filtered or unexported fields
}

func (*Scanner) BruteForce

func (s *Scanner) BruteForce()

func (*Scanner) GenerateList

func (s *Scanner) GenerateList(target []nmap.NmapResult, f plugins.ScanType, cancel context.CancelFunc, startTime string) (brute []Brute, num int)

func (*Scanner) GetLastScanTime

func (s *Scanner) GetLastScanTime(dataType string) (int, int)

func (*Scanner) MasDistribute

func (s *Scanner) MasDistribute(lastScanTime int, lastScanEndTime int)

func (*Scanner) MasRun

func (s *Scanner) MasRun(m *masscan.Masscan)

func (*Scanner) NmapDistribute

func (s *Scanner) NmapDistribute()

func (*Scanner) NmapRun

func (s *Scanner) NmapRun(ip string, port string, protocol string) ([]nmap.NmapResult, error)

func (*Scanner) ReadUserPass

func (s *Scanner) ReadUserPass() (err error)

func (*Scanner) ScanInit

func (s *Scanner) ScanInit()

func (*Scanner) StartScan

func (s *Scanner) StartScan() (err error)

type Set

type Set struct {
	// contains filtered or unexported fields
}

func NewIpSet

func NewIpSet() *Set

获取一个集合实例

func (*Set) Add

func (s *Set) Add(val ...string)

添加元素

func (*Set) Clear

func (s *Set) Clear()

清空set

func (*Set) Len

func (s *Set) Len() int

获取长度

func (*Set) ProcessIp

func (s *Set) ProcessIp(ipFile string, ipFileEx string)

将ip段(192.168.1.0/24,192.168.2.3-5)转换成ip数组(192.168.1.1,192.168.1.2,...,192.168.2.5)

func (*Set) Remove

func (s *Set) Remove(val ...string)

删除元素

func (*Set) Traverse

func (s *Set) Traverse()

遍历集合

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL