Documentation
¶
Index ¶
- Constants
- Variables
- func CleanSpiltCFLR(s string) []string
- func CollectHttpResponse(result *Result, resp *http.Response)
- func CollectParsedResponse(result *Result, resp *httputils.Response)
- func CollectSocketResponse(result *Result, socketContent []byte)
- func CollectTLS(result *Result, resp *http.Response)
- func Decode(input string) []byte
- func FormatCertDomains(domains []string) []string
- func GetFilename(config *Config, name string) string
- func GetStatusCode(content []byte) (bool, string)
- func HTTPGet(client *http.Client, url string) (*http.Response, error)
- func HasPingPriv() bool
- func HasTLS(resp *http.Response) bool
- func HttpConn(delay int) *http.Client
- func HttpConnWithDialer(delay int, ...) *http.Client
- func HttpConnWithNoRedirect(delay int) *http.Client
- func HttpConnWithNoRedirectWithDialer(delay int, ...) *http.Client
- func LoadConfig(typ string) []byte
- func LoadEmbeddedConfig(typ string) []byte
- func LoadExtractor() error
- func LoadFinger(fileutils []string) error
- func LoadNeutron(filename string) (map[string][]*templates.Template, error)
- func LoadPortConfig(portConfig string) error
- func LoadResource(url string) ([]byte, error)
- func LoadResources() error
- func LoadResultFile(file io.Reader) interface{}
- func LoadTemplates(content []byte) (map[string][]*templates.Template, error)
- func ParserCmdPayload(payloads []string) map[string]interface{}
- func ResetResourceProvider()
- func SetResourceLoader(fn func() error)
- func SetResourceProvider(provider ResourceProvider)
- func WriteSmartResult(file *fileutils.File, target string, ips []string)
- type Config
- func (config *Config) Close()
- func (config *Config) Context() context.Context
- func (config *Config) ExcludeCIDRs(cidrs utils.CIDRs) utils.CIDRs
- func (config *Config) GetTarget() string
- func (config *Config) GetTargetName() string
- func (config *Config) HasAlivedScan() bool
- func (config *Config) InitFile() error
- func (config *Config) InitIP() error
- func (config *Config) IsBSmart() bool
- func (config *Config) IsCSmart() bool
- func (config *Config) IsScan() bool
- func (config *Config) IsSmart() bool
- func (config *Config) SyncFile()
- func (config *Config) ToJson(json_type string) string
- func (config *Config) ToWorkflow() *Workflow
- func (config *Config) Validate() error
- type PortMapResult
- type ResourceProvider
- type Result
- func (result *Result) AddExtract(extract *parsers.Extracted)
- func (result *Result) AddExtracts(extracts []*parsers.Extracted)
- func (result *Result) AddFramework(f *common.Framework)
- func (result *Result) AddFrameworks(fs []*common.Framework)
- func (result *Result) AddNTLMInfo(m map[string]string, t string)
- func (result *Result) AddVuln(vuln *common.Vuln)
- func (result *Result) AddVulns(vulns []*common.Vuln)
- func (result *Result) AddVulnsAndFrameworks(fs common.Frameworks, vs common.Vulns)
- func (result *Result) Filter(rules [][]string) bool
- func (result *Result) GetHostBaseURL() string
- func (result *Result) GetHostURL() string
- func (result *Result) GetHttpConn(delay int) *http.Client
- func (result *Result) GetHttpConnWithOpt(delay int, opt *RunnerOption) *http.Client
- func (result *Result) GuessFramework()
- func (result *Result) IsHttps() bool
- func (result *Result) String() string
- func (result *Result) ToContent() *fingers.Content
- type ResultsData
- type RunnerOption
- type SmartResult
- type Socket
- type Workflow
- type WorkflowMap
Constants ¶
const ( SMART = "s" // 使用port-probe探测存活的c段, 递归下降到default SUPERSMART = "ss" // 使用ip-probe探测存活的b段, 递归下降到s SUPERSMARTC = "sb" // 使用port-probe探测到c段后退出 SUPERSMARTB = "sc" // 使用ip-probe探测存活的b段,. 递归下降到sb Default = "default" // 扫描完后退出 )
Variables ¶
var ( HttpTimeout time.Duration // DefaultTransport 仅作为不可变的默认配置参考保留;运行时不再被改写, // 也不再作为客户端共享 transport(每次构造经 utils/httpx 返回全新实例, // 确保并发下不同代理互不干扰)。 DefaultTransport = &http.Transport{ TLSClientConfig: &tls.Config{ MinVersion: tls.VersionTLS10, Renegotiation: tls.RenegotiateOnceAsClient, InsecureSkipVerify: true, }, MaxIdleConnsPerHost: 1, MaxIdleConns: 4000, DisableKeepAlives: false, } )
var ( FingerEngine *fingers.FingersEngine FingerprintHubEngine *fingerprinthub.FingerPrintHubEngine Extractor []*parsers.Extractor Extractors = make(parsers.Extractors) ExtractRegexps = map[string][]*parsers.Extractor{} )
var ( TemplateMap map[string][]*templates.Template ChainExec *templates.ChainExecutor )
var ( Win = iutils.IsWin() Mac = iutils.IsMac() Root = iutils.IsRoot() DefaultMaxSize = 1024 * 16 // 16k )
var DefaultConfig = Config{ GOGOConfig: &parsers.GOGOConfig{ Ports: "top1", Mod: Default, }, RunnerOpt: DefaultRunnerOption, PortProbe: "default", IpProbe: "default", IpProbeList: []uint{1, 254}, Compress: true, Outputf: "full", FileOutputf: "default", OutputDelimiter: "\t", }
DefaultConfig 包含所有默认值的配置实例 基于 options.go 中的默认值和 runner.go 中的 PrepareConfig 方法
var DefaultRunnerOption = &RunnerOption{ Exploit: "none", VersionLevel: 0, Delay: 2, HttpsDelay: 2, ScanFilters: nil, Debug: false, Opsec: false, ExcludeCIDRs: nil, }
var ExecuterOptions *protocols.ExecuterOptions = &protocols.ExecuterOptions{ Options: &protocols.Options{ Timeout: 5, }, }
var PortStat = map[int]string{
0: "open",
1: "closed",
2: "filtered|closed",
3: "noroute",
4: "denied",
5: "down",
6: "error_host",
7: "icmp",
8: "rst",
-1: "unknown",
}
return open: 0, closed: 1, filtered: 2, noroute: 3, denied: 4, down: 5, error_host: 6, unkown: -1
var RandomDir = "/g8kZMwp4oeKsL2in"
Functions ¶
func CleanSpiltCFLR ¶ added in v2.10.4
func CollectHttpResponse ¶ added in v2.12.2
func CollectParsedResponse ¶ added in v2.12.2
func CollectSocketResponse ¶ added in v2.12.2
func CollectTLS ¶ added in v2.12.2
func FormatCertDomains ¶
func GetFilename ¶
func GetStatusCode ¶
GetStatusCode 从socket中获取http状态码
func HasPingPriv ¶
func HasPingPriv() bool
func HttpConnWithDialer ¶ added in v2.15.0
func HttpConnWithDialer(delay int, dialContext func(ctx context.Context, network, address string) (net.Conn, error)) *http.Client
HttpConnWithDialer 创建一个 http.Client。dialContext 非 nil 时作为 Transport 的 DialContext(用于代理)。每次返回全新实例,不读写任何全局状态。
func HttpConnWithNoRedirect ¶ added in v2.11.3
func HttpConnWithNoRedirectWithDialer ¶ added in v2.15.0
func HttpConnWithNoRedirectWithDialer(delay int, dialContext func(ctx context.Context, network, address string) (net.Conn, error)) *http.Client
HttpConnWithNoRedirectWithDialer 同 HttpConnWithDialer,但禁止重定向。
func LoadConfig ¶
LoadConfig loads config bytes from the external provider first, then from the embedded templates kept for standalone gogo compatibility.
func LoadEmbeddedConfig ¶ added in v2.15.0
LoadEmbeddedConfig loads the standalone embedded config without consulting an installed external provider.
func LoadExtractor ¶ added in v2.10.4
func LoadExtractor() error
func LoadNeutron ¶ added in v2.10.7
func LoadPortConfig ¶
func LoadResource ¶ added in v2.13.8
func LoadResources ¶ added in v2.15.0
func LoadResources() error
LoadResources executes the configured resource loader. Returns nil immediately if an external loader was set (e.g. SDK already loaded resources).
func LoadResultFile ¶
func ParserCmdPayload ¶
func ResetResourceProvider ¶ added in v2.15.0
func ResetResourceProvider()
ResetResourceProvider removes the external template/config provider.
func SetResourceLoader ¶ added in v2.15.0
func SetResourceLoader(fn func() error)
SetResourceLoader overrides the default resource loading strategy. Pass nil to restore default behavior.
func SetResourceProvider ¶ added in v2.15.0
func SetResourceProvider(provider ResourceProvider)
SetResourceProvider installs an external template/config provider.
Types ¶
type Config ¶
type Config struct {
*parsers.GOGOConfig
RunnerOpt *RunnerOption `json:"-"`
// ip
CIDRs utils.CIDRs `json:"-"`
Excludes utils.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
IsListInput bool `json:"-"` // 从标准输入中读
IsJsonInput bool `json:"-"` // 从标准输入中读
NoSpray bool `json:"-"`
Compress bool `json:"-"`
// output
FilePath string `json:"-"`
Filename string `json:"-"`
SmartBFilename string `json:"-"`
SmartCFilename string `json:"-"`
AlivedFilename string `json:"-"`
File *fileutils.File `json:"-"`
SmartBFile *fileutils.File `json:"-"`
SmartCFile *fileutils.File `json:"-"`
AliveFile *fileutils.File `json:"-"`
FileSync func() `json:"-"`
Tee bool `json:"-"`
Outputf string `json:"-"`
FileOutputf string `json:"-"`
OutputDelimiter string `json:"-"`
Filenamef string `json:"-"`
Results parsers.GOGOResults `json:"-"` // json反序列化后的,保存在内存中
HostsMap map[string][]string `json:"-"` // host映射表
Filters []string `json:"-"`
FilterOr bool `json:"-"`
OutputFilters [][]string `json:"-"`
ResultCallback func(*Result) `json:"-"`
Ctx context.Context `json:"-"`
}
func NewDefaultConfig ¶ added in v2.14.1
func NewDefaultConfig(opt *RunnerOption) Config
func (*Config) ExcludeCIDRs ¶ added in v2.13.6
func (*Config) GetTargetName ¶
func (*Config) HasAlivedScan ¶
func (*Config) ToWorkflow ¶ added in v2.14.1
type PortMapResult ¶ added in v2.10.5
type PortMapResult map[string]*parsers.GOGOResult
func (PortMapResult) Get ¶ added in v2.10.5
func (imap PortMapResult) Get(port string) *parsers.GOGOResult
type ResourceProvider ¶ added in v2.15.0
ResourceProvider supplies template/config bytes by logical name.
type Result ¶
type Result struct {
*parsers.GOGOResult
HttpHosts []string `json:"-"`
CurrentHost string `json:"-"`
IsHttp bool `json:"-"`
Filtered bool `json:"-"`
Open bool `json:"-"`
SmartProbe bool `json:"-"`
TcpConn *net.Conn `json:"-"`
HttpConn *http.Client `json:"-"`
Httpresp *httputils.Response `json:"-"`
HasTitle bool `json:"-"`
Err error `json:"-"`
Error string `json:"-"`
ErrStat int `json:"-"`
Content []byte `json:"-"`
}
func (*Result) AddExtract ¶
func (*Result) AddExtracts ¶
func (*Result) AddFramework ¶
func (*Result) AddFrameworks ¶
func (*Result) AddVulnsAndFrameworks ¶ added in v2.12.1
func (result *Result) AddVulnsAndFrameworks(fs common.Frameworks, vs common.Vulns)
func (*Result) GetHostBaseURL ¶
func (*Result) GetHostURL ¶
func (*Result) GetHttpConnWithOpt ¶ added in v2.15.0
func (result *Result) GetHttpConnWithOpt(delay int, opt *RunnerOption) *http.Client
GetHttpConnWithOpt 在 opt 配置了实例级 proxy 时返回带代理 DialContext 的 http.Client(每次新建以隔离不同任务的代理),否则回退到 GetHttpConn 的 缓存逻辑。
func (*Result) GuessFramework ¶
func (result *Result) GuessFramework()
type ResultsData ¶
func (*ResultsData) GetConfig ¶ added in v2.9.0
func (rd *ResultsData) GetConfig() *Config
func (*ResultsData) ToCobaltStrike ¶
func (rd *ResultsData) ToCobaltStrike() string
func (*ResultsData) ToExtracteds ¶ added in v2.9.0
func (rd *ResultsData) ToExtracteds() string
func (*ResultsData) ToFormat ¶
func (rd *ResultsData) ToFormat(isColor bool) string
type RunnerOption ¶ added in v2.14.1
type RunnerOption struct {
Exploit string
VersionLevel int
Delay int
HttpsDelay int
ScanFilters [][]string
//SuffixStr string
Debug bool
Opsec bool // enable opsec
ExcludeCIDRs utils.CIDRs
// 实例级 proxy 支持。为 nil 时表示不使用代理(直连),并回退到全局
// ProxyDialTimeout / DefaultTransport(保持 CLI 行为)。
// SDK 通过设置这两个字段实现 per-instance / per-task 代理控制。
ProxyDialTimeout func(network, address string, timeout time.Duration) (net.Conn, error)
ProxyDialContext func(ctx context.Context, network, address string) (net.Conn, error)
}
type SmartResult ¶ added in v2.11.0
func (*SmartResult) List ¶ added in v2.11.0
func (sr *SmartResult) List() []string
type Socket ¶
Socket 复用 utils/httpx 的统一实现,消除与 zombie 的重复定义。
func NewSocketWithDialer ¶ added in v2.15.0
func NewSocketWithDialer(network, target string, delay int, dialTimeout func(string, string, time.Duration) (net.Conn, error)) (*Socket, error)
NewSocketWithDialer 使用指定的 dialTimeout 创建 Socket。dialTimeout 为 nil 时 直连(net.DialTimeout)。SDK 通过传入 opt.ProxyDialTimeout 实现实例级 / 单任务级代理控制——不再依赖任何包级全局,天然并发安全。
type Workflow ¶
type Workflow struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
IP string `json:"ip" yaml:"ip"`
IPlist []string `json:"iplist" yaml:"iplist"`
Ports string `json:"ports" yaml:"ports"`
Mod string `json:"mod" yaml:"mod"`
Ping bool `json:"ping" yaml:"ping"`
NoScan bool `json:"no-scan" yaml:"no-scan"`
IpProbe string `json:"ip-probe" yaml:"ip-probe"`
PortProbe string `json:"port-probe" yaml:"port-probe"`
Exploit string `json:"exploit" yaml:"exploit"`
Verbose int `json:"verbose" yaml:"verbose"`
File string `json:"file" yaml:"file"`
Path string `json:"path" yaml:"path"`
Tags []string `json:"tags" yaml:"tags"`
}
func ParseWorkflowsFromInput ¶
func (*Workflow) PrepareConfig ¶
type WorkflowMap ¶
func LoadWorkFlow ¶
func LoadWorkFlow() (WorkflowMap, error)
func (WorkflowMap) Choice ¶
func (m WorkflowMap) Choice(name string) []*Workflow