pkg

package
v2.8.9 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: GPL-3.0 Imports: 23 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SMART       = "s"
	SUPERSMART  = "ss"
	SUPERSMARTC = "sb"
	SUPERSMARTB = "sc"
	Default     = "default"
)

Variables

View Source
var (
	NameMap = ipcs.NameMap
	PortMap = ipcs.PortMap
	TagMap  = ipcs.TagMap
	//WorkFlowMap    map[string][]*Workflow
	Extractors = make(fingers.Extractors)
)
View Source
var (
	Md5Fingers  map[string]string
	Mmh3Fingers map[string]string
	AllFingers  fingers.Fingers
	TcpFingers  fingers.FingerMapper
	HttpFingers fingers.FingerMapper
)
View Source
var (
	Win  = utils.IsWin()
	Root = utils.IsRoot()
	Key  = []byte{}
)
View Source
var ExecuterOptions *protocols.ExecuterOptions
View Source
var NoGuess bool
View Source
var Proxy func(*http.Request) (*url.URL, error)
View Source
var ProxyDialTimeout func(network, address string, timeout time.Duration) (net.Conn, error)
View Source
var ProxyUrl *url.URL
View Source
var RandomDir = "/g8kZMwp4oeKsL2in"
View Source
var TemplateMap map[string][]*templates.Template

Functions

func CollectHttpInfo

func CollectHttpInfo(result *Result, resp *http.Response)

func CollectSocketInfo

func CollectSocketInfo(result *Result, socketContent []byte)

func ColorOutput

func ColorOutput(result *Result) string

func CompileRegexp

func CompileRegexp(s string) *regexp.Regexp

func Decode

func Decode(input string) []byte

func Encode

func Encode(input []byte) string

func FileDecode

func FileDecode(input string) []byte

func FormatCertDomains

func FormatCertDomains(domains []string) []string

func FullOutput

func FullOutput(result *Result) string

func GetFilename

func GetFilename(config *Config, name string) string

func GetStatusCode

func GetStatusCode(content string) (bool, string)

从socket中获取http状态码

func HasPingPriv

func HasPingPriv() bool

func HasStdin

func HasStdin() bool

func HttpConn

func HttpConn(delay int) *http.Client

func IsBase64

func IsBase64(content []byte) bool

func IsBin

func IsBin(content []byte) bool

func IsExist

func IsExist(filename string) bool

func IsJson

func IsJson(content []byte) bool

func JsonOutput

func JsonOutput(result *Result) string

func LoadConfig

func LoadConfig(typ string) []byte

func LoadFinger

func LoadFinger(t string) fingers.Fingers

加载指纹到全局变量

func LoadHashFinger

func LoadHashFinger(fs fingers.Fingers) (map[string]string, map[string]string)

func LoadNuclei

func LoadNuclei(filename string) map[string][]*templates.Template

func LoadPortConfig

func LoadPortConfig()

func LoadResultFile

func LoadResultFile(file *os.File) interface{}

func LoadTemplates

func LoadTemplates(content []byte) map[string][]*templates.Template

func Open

func Open(filename string) *os.File

func ParserCmdPayload

func ParserCmdPayload(payloads []string) *protocols.ExecuterOptions

func ValuesOutput

func ValuesOutput(result *Result, outType string) string

func WriteAlivedResult

func WriteAlivedResult(file *File, ips []string)

func WriteScReuslt

func WriteScReuslt(file *File, ips []string)

func WriteSmartResult

func WriteSmartResult(file *File, ips []string)

Types

type Config

type Config struct {
	// ip
	IP     string     `json:"ip"`
	IPlist []string   `json:"ips"`
	CIDRs  ipcs.CIDRs `json:"-"`

	// port and probe
	Ports         string   `json:"ports"` // 预设字符串
	PortList      []string `json:"-"`     // 处理完的端口列表
	PortProbe     string   `json:"-"`     // 启发式扫描预设探针
	PortProbeList []string `json:"-"`     // 启发式扫描预设探针
	IpProbe       string   `json:"-"`
	IpProbeList   []uint   `json:"-"`

	// file
	JsonFile    string `json:"json_file"` // gt的结果json文件,可以再次读入扫描
	ListFile    string `json:"list_file"` // 目标ip列表
	IsListInput bool   `json:"-"`         // 从标准输入中读
	IsJsonInput bool   `json:"-"`         // 从标准输入中读

	// misc
	Threads       int      `json:"threads"` // 线程数
	Mod           string   `json:"mod"`     // 扫描模式
	AliveSprayMod []string `json:"alive_spray"`
	PortSpray     bool     `json:"port_spray"`
	NoSpray       bool     `json:"-"`
	Exploit       string   `json:"exploit"`
	JsonType      string   `json:"json_type"`
	VersionLevel  int      `json:"version_level"`
	Compress      bool     `json:"-"`

	// output
	FilePath       string              `json:"-"`
	Filename       string              `json:"-"`
	SmartFilename  string              `json:"-"`
	AlivedFilename string              `json:"-"`
	File           *File               `json:"-"`
	SmartFile      *File               `json:"-"`
	ExtractFile    *File               `json:"-"`
	AliveFile      *File               `json:"-"`
	Tee            bool                `json:"-"`
	Outputf        string              `json:"-"`
	FileOutputf    string              `json:"-"`
	Filenamef      string              `json:"-"`
	Results        Results             `json:"-"` // json反序列化后的内网,保存在内存中
	HostsMap       map[string][]string `json:"-"` // host映射表
}

func (*Config) Close

func (config *Config) Close()

func (*Config) GetTarget

func (config *Config) GetTarget() string

func (*Config) GetTargetName

func (config *Config) GetTargetName() string

func (*Config) HasAlivedScan

func (config *Config) HasAlivedScan() bool

func (*Config) InitFile

func (config *Config) InitFile() error

func (*Config) InitIP

func (config *Config) InitIP() error

func (*Config) IsASmart

func (config *Config) IsASmart() bool

func (*Config) IsBSmart

func (config *Config) IsBSmart() bool

func (*Config) IsScan

func (config *Config) IsScan() bool

func (*Config) IsSmart

func (config *Config) IsSmart() bool

func (*Config) IsSmartScan

func (config *Config) IsSmartScan() bool

func (*Config) ToJson

func (config *Config) ToJson(json_type string) string

func (*Config) Validate

func (config *Config) Validate() error

type Extracts

type Extracts struct {
	Target       string               `json:"target"`
	MatchedNames []string             `json:"-"`
	Extractors   []*fingers.Extracted `json:"extracts"`
}

func LoadExtracts

func LoadExtracts(content []byte) ([]*Extracts, error)

func (*Extracts) ToResult

func (es *Extracts) ToResult() string

func (*Extracts) ToString

func (es *Extracts) ToString() string

type Frameworks

type Frameworks []*fingers.Framework

func (Frameworks) GetNames

func (fs Frameworks) GetNames() []string

func (Frameworks) IsFocus

func (fs Frameworks) IsFocus() bool

func (Frameworks) ToString

func (fs Frameworks) ToString() string

type IPMapResult

type IPMapResult map[string]Result

type PortFinger

type PortFinger struct {
	Name  string   `json:"name"`
	Ports []string `json:"ports"`
	Type  []string `json:"type"`
}

type Result

type Result struct {
	// baseinfo
	Ip       string `json:"ip"`             // ip
	Port     string `json:"port"`           // port
	Protocol string `json:"protocol"`       // protocol
	Status   string `json:"status"`         // http_stat
	Uri      string `json:"uri,omitempty"`  // uri
	Os       string `json:"os,omitempty"`   // os
	Host     string `json:"host,omitempty"` // host

	//Cert         string         `json:"c"`
	HttpHosts   []string `json:"-"`
	CurrentHost string   `json:"-"`
	Title       string   `json:"title"`   // title
	Midware     string   `json:"midware"` // midware

	Language     string         `json:"language"`             // language
	Frameworks   Frameworks     `json:"frameworks,omitempty"` // framework
	Vulns        Vulns          `json:"vulns,omitempty"`
	Extracts     *Extracts      `json:"-"`
	ExtractsStat map[string]int `json:"extracts_stat,omitempty"`
	//Hash         string         `json:"hs"`
	Open bool `json:"-"`
	//FrameworksMap map[string]bool `json:"-"`
	SmartProbe bool              `json:"-"`
	TcpConn    *net.Conn         `json:"-"`
	HttpConn   *http.Client      `json:"-"`
	Httpresp   *parsers.Response `json:"-"`
	Error      string            `json:"-"`
	ErrStat    int               `json:"-"`
	Content    string            `json:"-"`
}

func NewResult

func NewResult(ip, port string) *Result

func (*Result) AddExtract

func (result *Result) AddExtract(extract *fingers.Extracted)

func (*Result) AddExtracts

func (result *Result) AddExtracts(extracts []*fingers.Extracted)

func (*Result) AddFramework

func (result *Result) AddFramework(f *fingers.Framework)

func (*Result) AddFrameworks

func (result *Result) AddFrameworks(f []*fingers.Framework)

func (*Result) AddNTLMInfo

func (result *Result) AddNTLMInfo(m map[string]string, t string)

func (*Result) AddVuln

func (result *Result) AddVuln(vuln *fingers.Vuln)

func (*Result) AddVulns

func (result *Result) AddVulns(vulns []*fingers.Vuln)

func (*Result) Filter

func (result *Result) Filter(k, v, op string) bool

func (*Result) Get

func (result *Result) Get(key string) string

func (Result) GetBaseURL

func (result Result) GetBaseURL() string

func (*Result) GetExtractStat

func (result *Result) GetExtractStat() string

func (Result) GetFirstFramework

func (result Result) GetFirstFramework() string

func (Result) GetHostBaseURL

func (result Result) GetHostBaseURL() string

func (Result) GetHostURL

func (result Result) GetHostURL() string

func (*Result) GetHttpConn

func (result *Result) GetHttpConn(delay int) *http.Client

func (Result) GetTarget

func (result Result) GetTarget() string

func (Result) GetURL

func (result Result) GetURL() string

func (*Result) GuessFramework

func (result *Result) GuessFramework()

func (Result) IsHttp

func (result Result) IsHttp() bool

func (Result) IsHttps

func (result Result) IsHttps() bool

func (Result) NoFramework

func (result Result) NoFramework() bool

type Results

type Results []*Result

func (Results) Filter

func (rs Results) Filter(k, v, op string) Results

func (Results) GetValues

func (results Results) GetValues(key string) []string

type ResultsData

type ResultsData struct {
	Config Config  `json:"config"`
	IP     string  `json:"ip"`
	Data   Results `json:"data"`
}

func LoadResult

func LoadResult(content []byte) (*ResultsData, error)

func (*ResultsData) Filter

func (rd *ResultsData) Filter(name string)

func (ResultsData) ToCobaltStrike

func (rd ResultsData) ToCobaltStrike() string

func (ResultsData) ToConfig

func (rd ResultsData) ToConfig() string

func (ResultsData) ToFormat

func (rd ResultsData) ToFormat(isColor bool) string

func (ResultsData) ToValues

func (rd ResultsData) ToValues(outType string) string

func (ResultsData) ToZombie

func (rd ResultsData) ToZombie() string

type SmartData

type SmartData struct {
	Config Config   `json:"config"`
	Data   []string `json:"data"`
	IP     string   `json:"ip"`
}

type Socket

type Socket struct {
	Conn    net.Conn
	Count   int
	Timeout time.Duration
}

func NewSocket

func NewSocket(network, target string, delay int) (*Socket, error)

func (*Socket) Close

func (s *Socket) Close()

func (*Socket) Read

func (s *Socket) Read(timeout int) ([]byte, error)

func (*Socket) Request

func (s *Socket) Request(data []byte, max int) ([]byte, error)

type Vulns

type Vulns []*fingers.Vuln

func (Vulns) ToString

func (vs Vulns) ToString() string

type Workflow

type Workflow struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	IP          string   `json:"ip"`
	IPlist      []string `json:"iplist"`
	Ports       string   `json:"ports"`
	Mod         string   `json:"mod"`
	Ping        bool     `json:"ping"`
	//Arp         bool     `json:"arp"`
	NoScan     bool     `json:"no-scan"`
	IpProbe    string   `json:"ipprobe"`
	SmartProbe string   `json:"portprobe"`
	Exploit    string   `json:"exploit"`
	Version    int      `json:"version"`
	File       string   `json:"file"`
	Path       string   `json:"path"`
	Tags       []string `json:"tags"`
}

func ParseWorkflowsFromInput

func ParseWorkflowsFromInput(content []byte) []*Workflow

func (*Workflow) PrepareConfig

func (w *Workflow) PrepareConfig(rconfig Config) *Config

type WorkflowMap

type WorkflowMap map[string][]*Workflow

func LoadWorkFlow

func LoadWorkFlow() WorkflowMap

func (WorkflowMap) Choice

func (m WorkflowMap) Choice(name string) []*Workflow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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