config

package
v3.5.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

pkg/config/banner.go

Index

Constants

View Source
const (
	Version     = "3.5.3"
	ProjectName = "Afrog"
	Codename    = "Lightweight, Fast, and Direct to the Flaw."
	LineWidth   = 56
)

Variables

View Source
var (
	OOBCeyeio     = "ceyeio"
	OOBDnslogcn   = "dnslogcn"
	OOBAlphalog   = "alphalog"
	OOBXray       = "xray"
	OOBRevsuit    = "revsuit"
	OOBInteractsh = "interactsh"
)

Functions

func EngineV

func EngineV(u *AfrogUpdate) string

func GetErrorSymbol added in v3.1.7

func GetErrorSymbol() string

func GetFileBaseName added in v3.1.7

func GetFileBaseName(options *Options) string

新增函数:获取基础文件名

func GetOkSymbol added in v3.1.7

func GetOkSymbol() string

func IsOOBAdapter added in v3.0.2

func IsOOBAdapter(oob string) bool

func PocV

func PocV(u *AfrogUpdate) string

func PrintSeparator added in v3.1.7

func PrintSeparator()

func PrintStatusLine added in v3.1.7

func PrintStatusLine(symbol, label, value, note string)

func ShowBanner

func ShowBanner(u *AfrogUpdate, curated *Curated)

func ShowVersion

func ShowVersion()

func WriteConfiguration

func WriteConfiguration(config *Config, configFile string) error

WriteConfiguration writes the updated afrog configuration to disk

Types

type AfrogUpdate

type AfrogUpdate struct {
	HomeDir             string
	CurrVersion         string
	RemoteVersion       string
	LastestVersion      string
	LastestAfrogVersion string
	IsUpdatePocs        bool
}

func NewAfrogUpdate

func NewAfrogUpdate(updatePoc bool) (*AfrogUpdate, error)

func (*AfrogUpdate) AfrogUpdatePocs

func (u *AfrogUpdate) AfrogUpdatePocs() (string, error)

func (*AfrogUpdate) CheckAfrogUpdate

func (u *AfrogUpdate) CheckAfrogUpdate() (bool, error)

func (*AfrogUpdate) Download

func (u *AfrogUpdate) Download() error

func (*AfrogUpdate) Unzip

func (u *AfrogUpdate) Unzip(src string) error

type Alphalog added in v3.0.2

type Alphalog struct {
	Domain string `yaml:"domain"`
	ApiUrl string `yaml:"api_url"`
}

type Ceye

type Ceye struct {
	ApiKey string `yaml:"api-key"`
	Domain string `yaml:"domain"`
}

type Config

type Config struct {
	ServerAddress string     `yaml:"server"`
	Reverse       Reverse    `yaml:"reverse"`
	Webhook       Webhook    `yaml:"webhook"`
	Cyberspace    Cyberspace `yaml:"cyberspace"`
	Curated       Curated    `yaml:"curated"`
}

Config is a afrog-config.yaml catalog helper implementation

func NewConfig

func NewConfig(configFile string) (*Config, error)

Create and initialize afrog-config.yaml configuration info

func ReadConfiguration

func ReadConfiguration(configFile string) (*Config, error)

ReadConfiguration reads the afrog configuration file from disk.

func (*Config) GetConfigPath

func (c *Config) GetConfigPath() string

type ConfigHttp

type ConfigHttp struct {
	Proxy               string `yaml:"proxy"`
	DialTimeout         int32  `yaml:"dial_timeout"`
	ReadTimeout         string `yaml:"read_timeout"`
	WriteTimeout        string `yaml:"write_timeout"`
	MaxRedirect         int32  `yaml:"max_redirect"`
	MaxIdle             string `yaml:"max_idle"`
	Concurrency         int    `yaml:"concurrency"`
	MaxConnsPerHost     int    `yaml:"max_conns_per_host"`
	MaxResponseBodySize int    `yaml:"max_responsebody_sizse"`
	UserAgent           string `yaml:"user_agent"`
}

type Curated added in v3.3.7

type Curated struct {
	Enabled    string `yaml:"enabled"`
	AutoUpdate *bool  `yaml:"auto_update"`
	Endpoint   string `yaml:"endpoint"`
	Bin        string `yaml:"bin,omitempty"`
	TimeoutSec int    `yaml:"timeout_sec"`
	Channel    string `yaml:"channel"`
	LicenseKey string `yaml:"license_key"`
}

type Cyberspace

type Cyberspace struct {
	ZoomEyes []string `yaml:"zoom_eyes"`
}

type Dingtalk

type Dingtalk struct {
	Tokens    []string `yaml:"tokens"`
	AtMobiles []string `yaml:"at_mobiles"`
	AtAll     bool     `yaml:"at_all"`
	Range     string   `yaml:"range"`
}

type Dnslogcn added in v3.0.2

type Dnslogcn struct {
	Domain string `yaml:"domain"`
}

type Eye

type Eye struct {
	Host   string `yaml:"host"`
	Token  string `yaml:"token"`
	Domain string `yaml:"domain"`
}

type Interactsh added in v3.5.1

type Interactsh struct {
	Server string `yaml:"server"`
	Token  string `yaml:"token"`
}

type Jndi

type Jndi struct {
	JndiAddress string `yaml:"jndi_address"`
	LdapPort    string `yaml:"ldap_port"`
	ApiPort     string `yaml:"api_port"`
}

type Options

type Options struct {
	// afrog-config.yaml configuration file
	Config *Config

	AfrogUpdate *AfrogUpdate

	// Pocs Directory
	PocsDirectory utils.StringSlice

	Targets sliceutil.SafeSlice

	// target URLs/hosts to scan
	Target goflags.StringSlice

	// list of target URLs/hosts to scan (one per line)
	TargetsFile string

	// PoC file or directory to scan
	PocFile string

	// Append PoC file or directory to scan
	AppendPoc goflags.StringSlice

	// show afrog-pocs list
	PocList bool

	// show a afrog-pocs detail
	PocDetail string

	PocMigrate string

	ExcludePocs     goflags.StringSlice
	ExcludePocsFile string

	// file to write output to (optional), support format: html
	Output string

	// file to write output to (optional), support format: json
	Json string

	// file to write output to (optional), support format: json
	JsonAll string

	// search PoC by keyword , eg: -s tomcat
	Search string

	SearchKeywords []string

	// no progress if silent is true
	Silent  bool
	NoColor bool

	// pocs to run based on severity. Possible values: info, low, medium, high, critical
	Severity string

	SeverityKeywords []string

	// update afrog-pocs
	UpdatePocs bool

	// update afrog version
	Update bool

	// Disable update check
	DisableUpdateCheck bool

	MonitorTargets bool

	// POC Execution Duration Tracker
	PocExecutionDurationMonitor bool
	PedmLogLimit                int
	PedmSlowThresholdSec        int
	PedmSlowLogLimit            int
	PedmSummaryTop              int
	PedmSummaryBy               string
	TaskHardTimeoutSec          int
	TaskSmartTimeout            bool
	TaskTimeoutVisibleCapSec    int
	TaskTimeoutNetCapSec        int
	TaskTimeoutGoCapSec         int

	// Single Vulnerability Stopper
	VulnerabilityScannerBreakpoint bool

	// Scan count num(targets * allpocs)
	Count int

	// Current Scan count num
	CurrentCount uint32

	// Thread lock
	OptLock sync.Mutex

	// maximum number of requests to send per second (default 150)
	RateLimit         int
	ReqLimitPerTarget int
	AutoReqLimit      bool
	Polite            bool
	Balanced          bool
	Aggressive        bool

	// maximum number of afrog-pocs to be executed in parallel (default 25)
	Concurrency int

	// maximum number of requests to send per second (default 150)
	OOBRateLimit int

	// maximum number of afrog-pocs to be executed in parallel (default 25)
	OOBConcurrency int

	// Smart Control Concurrency
	Smart                 bool
	DisableFingerprint    bool
	EnableWebProbe        bool
	FingerprintFilterMode string
	Test                  bool

	// number of times to retry a failed request (default 1)
	Retries int

	//
	MaxHostError int

	// time to wait in seconds before timeout (default 10)
	Timeout int

	// http/socks5 proxy to use
	Proxy string

	MaxRespBodySize int

	BruteMaxRequests int

	// afrog process count (target total × pocs total)
	ProcessTotal uint32

	DisableOutputHtml bool

	OJ *output.OutputJson

	Header        goflags.StringSlice
	DefaultAccept bool

	Version bool

	Web bool

	// webhook
	Dingtalk bool

	// webhook wecom
	Wecom bool

	// resume
	Resume          string
	ResumeDoneTasks uint32

	// debug
	Debug     bool
	LiveStats bool

	// sort
	// -sort severity (default low, info, medium, high, critical)
	// -sort a-z
	Sort string

	// cyberspace search
	Cyberspace string

	// cyberspace search keywords
	Query string

	// query count
	QueryCount int

	// oobadapter, eg: `-oob ceyeio` or `-oob dnslogcn` or `-oob alphalog`
	OOB                string
	OOBKey             string
	OOBDomain          string
	OOBHttpUrl         string
	OOBApiUrl          string
	OOBPollInterval    int
	OOBHitRetention    int
	OOBFinalizeTimeout int

	// SDK模式标志,用于控制OOB检测行为
	SDKMode   bool
	EnableOOB bool

	// enable pre-scan host port scanning
	PortScan         bool
	PSPorts          string
	PSRateLimit      int
	PSTimeout        int
	PSRetries        int
	PSSkipDiscovery  bool
	PSS4Chunk        int
	OnPortScanResult func(host string, port int)
	OnHostDiscovered func(host string)
	OnPhaseProgress  func(phase string, status string, finished int64, total int64, percent int)
	OnScanInfoUpdate func(info ScanInfoUpdate)
	OnPedmLog        func(line string)

	// path to the afrog configuration file
	ConfigFile string

	// Validate POC YAML syntax
	Validate string

	CuratedEnabled     string
	CuratedEndpoint    string
	CuratedTimeout     int
	CuratedForceUpdate bool
}

func NewOptions

func NewOptions() (*Options, error)

func (*Options) CheckPocKeywords

func (o *Options) CheckPocKeywords(id, name, tags string) bool

func (*Options) CheckPocSeverityKeywords

func (o *Options) CheckPocSeverityKeywords(severity string) bool

func (*Options) CreatePocList

func (o *Options) CreatePocList() []poc.Poc

func (*Options) FilterPocSeveritySearch

func (o *Options) FilterPocSeveritySearch(pocId, pocInfoName, pocTags, severity string) bool

func (*Options) FingerprintPoCs added in v3.3.5

func (o *Options) FingerprintPoCs(allpocs []poc.Poc) ([]poc.Poc, []poc.Poc)

func (*Options) PrintPocList

func (o *Options) PrintPocList() error

func (*Options) ReadPocDetail

func (o *Options) ReadPocDetail()

func (*Options) ReversePoCs

func (o *Options) ReversePoCs(allpocs []poc.Poc) ([]poc.Poc, []poc.Poc)

func (*Options) SetOOBAdapter added in v3.0.2

func (opt *Options) SetOOBAdapter()

func (*Options) SetSearchKeyword

func (o *Options) SetSearchKeyword() bool

func (*Options) SetSeverityKeyword

func (o *Options) SetSeverityKeyword() bool

func (*Options) SmartControl

func (o *Options) SmartControl()

func (*Options) VerifyOptions

func (opt *Options) VerifyOptions() error

type POCSlices

type POCSlices []poc.Poc

定义包含 POC 结构的切片

func (POCSlices) Len

func (s POCSlices) Len() int

实现 sort.Interface 接口的 Len、Less 和 Swap 方法

func (POCSlices) Less

func (s POCSlices) Less(i, j int) bool

func (POCSlices) Swap

func (s POCSlices) Swap(i, j int)

type Reverse

type Reverse struct {
	Alphalog   Alphalog   `yaml:"alphalog"`
	Ceye       Ceye       `yaml:"ceye"`
	Dnslogcn   Dnslogcn   `yaml:"dnslogcn"`
	Eye        Eye        `yaml:"eye"`
	Interactsh Interactsh `yaml:"interactsh"`
	Jndi       Jndi       `yaml:"jndi"`
	Xray       Xray       `yaml:"xray"`
	Revsuit    Revsuit    `yaml:"revsuit"`
}

type Revsuit added in v3.0.8

type Revsuit struct {
	Token     string `yaml:"token"`
	DnsDomain string `yaml:"dns_domain"`
	HttpUrl   string `yaml:"http_url"`
	ApiUrl    string `yaml:"api_url"`
}

type ScanInfoUpdate added in v3.3.8

type ScanInfoUpdate struct {
	TotalTargets int
	Targets      []string
	TotalPocs    int
	TotalScans   int
	OOBEnabled   bool
	OOBStatus    string
}

type Webhook

type Webhook struct {
	Dingtalk Dingtalk `yaml:"dingtalk"`
	Wecom    Wecom    `yaml:"wecom"`
}

type Wecom added in v3.3.8

type Wecom struct {
	Tokens    []string `yaml:"tokens"`
	AtMobiles []string `yaml:"at_mobiles"`
	AtAll     bool     `yaml:"at_all"`
	Range     string   `yaml:"range"`
	Markdown  bool     `yaml:"markdown"`
}

type Xray added in v3.0.2

type Xray struct {
	XToken string `yaml:"x_token"`
	Domain string `yaml:"domain"`
	ApiUrl string `yaml:"api_url"`
}

Jump to

Keyboard shortcuts

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