Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletions afrog.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ type SDKOptions struct {
Headers []string

// ========== OOB配置 ==========
EnableOOB bool // 是否启用OOB检测 (默认: false)
OOB string // OOB适配器类型: ceyeio, dnslogcn, alphalog, xray, revsuit
OOBKey string // OOB API密钥
OOBDomain string // OOB域名
OOBApiUrl string // OOB API地址
OOBHttpUrl string // OOB HTTP地址
OOBRateLimit int
OOBConcurrency int
EnableOOB bool // 是否启用OOB检测 (默认: false)
OOB string // OOB适配器类型: ceyeio, dnslogcn, alphalog, xray, revsuit
OOBKey string // OOB API密钥
OOBDomain string // OOB域名
OOBApiUrl string // OOB API地址
OOBHttpUrl string // OOB HTTP地址
OOBRateLimit int
OOBConcurrency int
OOBFinalizeTimeout int

// ========== 输出配置 ==========
Expand Down Expand Up @@ -626,6 +626,15 @@ func (s *SDKScanner) run() error {
}

if r.IsVul {
if s.options.Severity != "" {
sev := strings.TrimSpace(r.PocInfo.Info.Severity)
if sev == "" {
sev = "info"
}
if !s.matchesSeverity(sev) {
return
}
}
s.mu.Lock()
s.results = append(s.results, r)
atomic.AddInt32(&s.stats.FoundVulns, 1)
Expand Down Expand Up @@ -908,6 +917,18 @@ func (s *SDKScanner) IsStopping() bool {
return s.options.VulnerabilityScannerBreakpoint
}

func (s *SDKScanner) matchesSeverity(sev string) bool {
if s.options.Severity == "" {
return true
}
for _, keyword := range strings.Split(s.options.Severity, ",") {
if strings.EqualFold(sev, strings.TrimSpace(keyword)) {
return true
}
}
return false
}

// SetProxy 动态设置代理
func (s *SDKScanner) SetProxy(proxy string) {
s.options.Proxy = proxy
Expand Down
23 changes: 23 additions & 0 deletions cmd/afrog/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ func main() {
rst.FullTarget = rst.Target
}

if len(options.Severity) > 0 {
sev := strings.ToLower(strings.TrimSpace(rst.PocInfo.Info.Severity))
if !stringsInSlice(sev, options.SeverityKeywords) {
continue
}
}

lock.Lock()
fmt.Fprint(os.Stderr, "\r\033[2K\r")

Expand Down Expand Up @@ -364,6 +371,13 @@ func main() {
}

if result.IsVul {
if len(options.Severity) > 0 {
sev := strings.ToLower(strings.TrimSpace(result.PocInfo.Info.Severity))
if !stringsInSlice(sev, options.SeverityKeywords) {
return
}
}

lock.Lock()
fmt.Fprint(os.Stderr, "\r\033[2K\r")

Expand Down Expand Up @@ -522,3 +536,12 @@ func expandTildePath(v string) string {
}
return filepath.Clean(s)
}

func stringsInSlice(target string, slice []string) bool {
for _, s := range slice {
if strings.EqualFold(target, s) {
return true
}
}
return false
}
16 changes: 9 additions & 7 deletions pkg/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ type Options struct {
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
OOB string
OOBKey string
OOBDomain string
OOBHttpUrl string
OOBApiUrl string
OOBPollInterval int
OOBHitRetention int
OOBFinalizeTimeout int

// SDK模式标志,用于控制OOB检测行为
Expand Down Expand Up @@ -589,6 +589,8 @@ func (opt *Options) VerifyOptions() error {
if !(len(opt.Target) > 0 || len(opt.TargetsFile) > 0 || (len(opt.Cyberspace) > 0 && len(opt.Query) > 0)) {
}

opt.SetSeverityKeyword()

return nil
}

Expand Down