tools

package
v1.3.7-alpha1107 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BruterExports = map[string]interface{}{
	"GetAvailableBruteTypes": func() []string {
		return bruteutils.GetBuildinAvailableBruteType()
	},
	"GetUsernameListFromBruteType": bruteutils.GetUsernameListFromBruteType,
	"GetPasswordListFromBruteType": bruteutils.GetPasswordListFromBruteType,

	"New":                _yakitBruterNew,
	"concurrentTarget":   yakBruteOpt_ConcurrentTarget,
	"debug":              yakBruteOpt_Debug,
	"userList":           yakBruteOpt_userlist,
	"passList":           yakBruteOpt_passlist,
	"autoDict":           yakBruteOpt_autoDict,
	"concurrent":         yakBruteOpt_concurrent,
	"minDelay":           yakBruteOpt_minDelay,
	"maxDelay":           yakBruteOpt_maxDelay,
	"bruteHandler":       yakBruteOpt_coreHandler,
	"okToStop":           yakBruteOpt_OkToStop,
	"finishingThreshold": yakBruteOpt_FinishingThreshold,
}
View Source
var BuildinNucleiYakScriptParam = []*ypb.YakScriptParam{
	{
		Field:        "target",
		DefaultValue: "",
		TypeVerbose:  "string",
		Required:     true,
		FieldVerbose: "扫描目标",
		Help:         "扫描目标可接受:主机名 / 主机名:端口 / IP段 / URL 等多种格式",
	},
	{
		Field:        "reverse-url",
		DefaultValue: "",
		TypeVerbose:  "string",
		FieldVerbose: "反连 URL",
		Help:         "可使用 InteractshURL 也可使用 Yakit Reverse URL",
	},
	{
		Field:        "debug",
		DefaultValue: "",
		TypeVerbose:  "boolean",
		FieldVerbose: "设置调试模式",
		Help:         "开启调试模式,调试模式将输出尽量多的调试信息",
	},
	{
		Field:        "proxy",
		DefaultValue: "",
		TypeVerbose:  "proxy",
		FieldVerbose: "HTTP 代理",
		Help:         "设置 HTTP 代理",
	},
}
View Source
var Exports = map[string]interface{}{

	"NewPocInvoker": func() (*PocInvoker, error) {
		return NewPocInvoker()
	},
	"NewBruteUtil": func(t string) (*bruteutils.BruteUtil, error) {
		res, err := bruteutils.GetBruteFuncByType(t)
		if err != nil {
			return nil, err
		}
		ut, err := bruteutils.NewMultiTargetBruteUtil(256, 1, 5, res)
		if err != nil {
			return nil, utils.Errorf("create brute utils failed: %s", err)
		}
		return ut, nil
	},
}
View Source
var FinPortScanExports = map[string]interface{}{
	"Scan": func(target string, port string, opts ...finScanOpt) (chan *finscan.FinScanResult, error) {
		config := &_yakFinPortScanConfig{
			waiting:           10 * time.Second,
			rateLimitDelayMs:  1,
			rateLimitDelayGap: 5,
		}
		for _, opt := range opts {
			opt(config)
		}
		return _finscanDo(hostsToChan(target), port, config)
	},

	"excludePorts":   _finScanOptExcludePorts,
	"excludeHosts":   _finScanOptExcludeHosts,
	"wait":           _finScanOptWaiting,
	"outputFile":     _finScanOptOpenPortResult,
	"outputPrefix":   _finScanOptOpenPortResultPrefix,
	"initHostFilter": _finScanOptOpenPortInitHostFilter,
	"initPortFilter": _finScanOptOpenPortInitPortFilter,
	"rateLimit":      _finScanOptRateLimit,
	"concurrent":     _finScanOptConcurrent,
}

FinPortScanExports 为了防止网卡过载,5个是上限

  1. waiting 实现
  2. timeout
View Source
var FingerprintScanExports = map[string]interface{}{
	"Scan":                scanFingerprint,
	"ScanOne":             scanOneFingerprint,
	"ScanFromSynResult":   _scanFromTargetStream,
	"ScanFromSpaceEngine": _scanFromTargetStream,
	"ScanFromPing":        _scanFromPingUtils,

	"proto": _protoOption,

	"concurrent": fp.WithPoolSize,

	"excludePorts": fp.WithExcludePorts,
	"excludeHosts": fp.WithExcludeHosts,

	"probeTimeout": fp.WithProbeTimeoutHumanRead,

	"proxy": fp.WithProxy,

	"cache":         fp.WithCache,
	"databaseCache": fp.WithDatabaseCache,

	"webRule": fp.WithWebFingerprintRule,

	"nmapRule": fp.WithNmapRule,

	"nmapRarityMax": fp.WithRarityMax,

	"active": fp.WithActiveMode,

	"maxProbes": fp.WithProbesMax,

	"maxProbesConcurrent": fp.WithProbesConcurrentMax,

	"web": _webOption,

	"service": _serviceOption,

	"all": _allOption,

	"disableDefaultRule": _disableDefaultFingerprint,
}
View Source
var NucleiOperationsExports = map[string]interface{}{
	"UpdatePoC":      UpdatePoC,
	"PullDatabase":   PullTemplatesFromGithub,
	"UpdateDatabase": LoadYamlPoCDatabase,
	"RemoveDatabase": RemovePoCDatabase,
	"AllPoC":         FetchCurrentNucleiTemplates,
	"PocVulToRisk":   PocVulToRisk,
	"GetPoCDir":      consts.GetNucleiTemplatesDir,
}
View Source
var PingExports = map[string]interface{}{
	"Scan":         _pingScan,
	"Ping":         _ping,
	"excludeHosts": _pingConfigOpt_excludeHosts,
	"onResult":     _pingConfigOpt_onResult,
	"dnsTimeout":   _pingConfigOpt_withDNSTimeout,
	"timeout":      _pingConfigOpt_withTimeout,
	"dnsServers":   _pingConfigOpt_dnsServers,
	"scanCClass":   _pingConfigOpt_scanCClass,
	"skip":         _pingConfigOpt_skipped,
	"concurrent":   _pingConfigOpt_concurrent,
	"tcpPingPorts": _pingConfigOpt_tcpPingPorts,
	"proxy":        _pingConfigOpt_proxy,
}
View Source
var SubDomainExports = map[string]interface{}{
	"Scan": _subdomainScan,

	"wildcardToStop":    subdomain.WithWildCardToStop,
	"recursive":         subdomain.WithAllowToRecursive,
	"workerConcurrent":  subdomain.WithWorkerCount,
	"dnsServer":         subdomain.WithDNSServers,
	"maxDepth":          subdomain.WithMaxDepth,
	"targetConcurrent":  subdomain.WithParallelismTasksCount,
	"targetTimeout":     withTargetTimeout,
	"eachQueryTimeout":  withEachQueryTimeout,
	"eachSearchTimeout": withEachSearchTimeout,

	"mainDict":      withMainDict,
	"recursiveDict": withRecursiveDict,
}
View Source
var SynPortScanExports = map[string]interface{}{
	"FixPermission": pcapfix.Fix,
	"Scan":          _scan,
	"ScanFromPing":  _synscanFromPingUtils,

	"callback":           _scanOptCallback,
	"submitTaskCallback": _scanOptSubmitTaskCallback,
	"excludePorts":       _scanOptExcludePorts,
	"excludeHosts":       _scanOptExcludeHosts,
	"wait":               _scanOptWaiting,
	"outputFile":         _scanOptOpenPortResult,
	"outputPrefix":       _scanOptOpenPortResultPrefix,
	"initHostFilter":     _scanOptOpenPortInitHostFilter,
	"initPortFilter":     _scanOptOpenPortInitPortFilter,
	"rateLimit":          _scanOptRateLimit,
	"concurrent":         _scanOptSYNConcurrent,
	"iface":              _scanOptIface,
}

为了防止网卡过载,5个是上限

  1. waiting 实现
  2. timeout
View Source
var SynxPortScanExports = map[string]interface{}{
	"FixPermission": pcapfix.Fix,

	"Scan":         _scanx,
	"ScanFromPing": _scanxFromPingUtils,

	"callback":           synscanx.WithCallback,
	"submitTaskCallback": synscanx.WithSubmitTaskCallback,
	"excludeHosts":       synscanx.WithExcludeHosts,
	"excludePorts":       synscanx.WithExcludePorts,
	"wait":               synscanx.WithWaiting,
	"outputFile":         synscanx.WithOutputFile,
	"outputPrefix":       synscanx.WithOutputFilePrefix,
	"initHostFilter":     synscanx.WithInitFilterHosts,
	"initPortFilter":     synscanx.WithInitFilterPorts,
	"rateLimit":          synscanx.WithRateLimit,
	"concurrent":         synscanx.WithConcurrent,
	"iface":              synscanx.WithIface,
	"shuffle":            synscanx.WithShuffle,
	"maxPorts":           synscanx.WithMaxOpenPorts,
}

Functions

func BinaryLocations

func BinaryLocations(binaryName ...string) []string

func DebugMockRedis added in v1.3.1

func DebugMockRedis(ctx context.Context, needPasswd bool, passwd ...string) (string, int)

func FetchCurrentNucleiTemplates

func FetchCurrentNucleiTemplates(defaultDirs ...string) ([]*templateDesc, error)

func HandleNucleiResultFromFile

func HandleNucleiResultFromFile(ctx context.Context, fileName string) (chan *PocVul, error)

func HandleNucleiResultFromReader

func HandleNucleiResultFromReader(i io.Reader) chan *PocVul

func HandleXrayResultChan

func HandleXrayResultChan(r io.Reader) chan *PocVul

func LoadYamlPoCDatabase

func LoadYamlPoCDatabase(nucleiDir ...string) error

func NewDefaultPingConfig

func NewDefaultPingConfig() *_pingConfig

func PocVulToRisk

func PocVulToRisk(p *PocVul) *schema.Risk

func PullTemplatesFromGithub

func PullTemplatesFromGithub(giturl string, proxy ...string) (string, error)

func RemovePoCDatabase

func RemovePoCDatabase() error

func ResourceLocations

func ResourceLocations(resResources ...string) []string

func UpdatePoC added in v1.3.2

func UpdatePoC(proxy ...string)

func UpdatePoCWithUrl added in v1.3.2

func UpdatePoCWithUrl(u string, proxy ...string)

Types

type BruteOpt

type BruteOpt func(bruter *yakBruter)

func WithBruteCtx

func WithBruteCtx(ctx context.Context) BruteOpt

func WithBruteRuntimeId

func WithBruteRuntimeId(id string) BruteOpt

type PingConfigOpt

type PingConfigOpt func(config *_pingConfig)

func WithPingCtx

func WithPingCtx(ctx context.Context) PingConfigOpt

func WithPingRuntimeId

func WithPingRuntimeId(id string) PingConfigOpt

type PocInvoker

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

func NewPocInvoker

func NewPocInvoker() (*PocInvoker, error)

func (*PocInvoker) Exec

func (p *PocInvoker) Exec(urls ...string) ([]*PocVul, error)

type PocVul

type PocVul struct {
	Source        string
	PocName       string
	CVE           string
	Description   string
	DescriptionZh string
	MatchedAt     string
	Target        string
	IP            string
	Port          int
	Timestamp     int64
	Payload       string
	Severity      string
	RawJson       string
	Tags          string
	TitleName     string
	Details       map[string]interface{}
	RuntimeId     string

	// meta info
	ScriptName string
	UUID       string
}

func HandleNucleiResult

func HandleNucleiResult(raw []byte) []*PocVul

func HandleXrayResult

func HandleXrayResult(raw []byte) []*PocVul

解析 nuclei 和 xray 的输出结果 (JSON)

type SubFinderInstance

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

func NewSubFinderInstance

func NewSubFinderInstance() (*SubFinderInstance, error)

func (*SubFinderInstance) Exec

func (s *SubFinderInstance) Exec(domain string, nsServers ...string) ([]*subdomain.SubdomainResult, error)

func (*SubFinderInstance) SetTimeout

func (s *SubFinderInstance) SetTimeout(ts string)

func (*SubFinderInstance) SetTimeoutRaw

func (s *SubFinderInstance) SetTimeoutRaw(t time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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