file_target_scan

command
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

文件批量扫描示例(v3.0 Engine API + ScanCallback)

本示例演示 (*Engine).ScanCallback 流式回调批量扫描。

优势

相比 v2.0 自己写 sync.WaitGroup + sync.Mutex + chan 的方式:

  • 不需要等所有目标完成才能拿到结果(边扫边处理)
  • 不需要自己管理 goroutine pool(WithURLConcurrency 控制并发)
  • 回调返回 false 可主动取消整批扫描

运行

cd example/file_target_scan
go run main.go

核心代码

engine, _ := sdk.NewEngine(ctx,
    sdk.WithFingerOptions(options),
    sdk.WithURLConcurrency(20),    // 同时扫描 20 个目标
    sdk.WithRuleConcurrency(200),  // 单目标内部规则并发
)
defer engine.Close()

cb := func(r *sdk.TargetResult) bool {
    fmt.Printf("✓ %s [%d] matches=%d\n", r.URL, r.StatusCode, len(r.Matches))
    return true // false 取消整批
}

err := engine.ScanCallback(ctx, targets, cb)

输入文件格式

targets.txt,每行一个目标:

example.com
github.com
https://www.baidu.com
192.168.1.1:8080

Documentation

Overview

file_target_scan 演示从文件读取目标列表批量扫描。

  • (*Engine).ScanCallback 实时处理每个目标的结果
  • WithURLConcurrency 控制并发数

Jump to

Keyboard shortcuts

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