Documentation
¶
Overview ¶
- Package cmd @Author: zhizhuo @IDE:GoLand @File: banner.go @Date: 2025/2/20 下午3:39*
Package cli 是 gxx 的命令行前端:参数解析、目标加载、进度与终端显示。
识别与结果输出全部由 SDK 完成,命令行的 JSON / CSV / TXT / Socket 输出与 SDK 的 Writer 是同一套实现和同一种数据结构。
Package cli 命令行参数解析。
参数解析只依赖标准库 flag:SDK 与 CLI 共用的 types 包不再为一个字符串切片 引入第三方命令行框架及其传递依赖。
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Banner = strings.TrimSpace(`
_______ ___ _
/ __\ \/\ \//
| | _\ / \ /
| |_/// \ / \
\____/__/\/__/\\`) + "\n\n\t\tVersion: " + defaultVersion +
"\n\t\tAuthor: " + defaultAuthor +
"\n\t\tBuild: " + getBuildDate()
Banner 程序启动时显示的横幅
var ErrHelp = flag.ErrHelp
ErrHelp 表示用户请求了帮助信息;用法已输出,调用方应以 0 退出。
Functions ¶
func LoadTargets ¶ added in v1.5.0
LoadTargets 返回去重后的扫描目标,保持输入顺序。
命令行目标优先于目标文件。文件每行一个目标,空行与 # 开头的注释行被跳过。 去重按资产入口判断:协议、主机、端口相同且路径与查询串相同的写法只保留第一个 (http://a.com 与 http://A.com:80/ 是同一个入口;http 与 https 是不同的资产)。
func OutputFormat ¶ added in v1.5.0
func OutputFormat(jsonOutput bool, outputPath string) sdk.OutputFormat
OutputFormat 确定输出格式:-json 优先,其余按扩展名识别,默认 txt。
Types ¶
type Options ¶ added in v1.5.0
type Options struct {
Targets []string // -u:扫描目标
TargetsFile string // -f:目标文件,每行一个
Threads int // -t:目标并发数
RuleThreads int // -rt:指纹规则并发数
Output string // -o:输出文件
JSONOutput bool // -json:强制 JSON Lines 输出
SockOutput string // -sock:Unix socket 输出
Proxy string // -proxy:代理地址
RuleFile string // -p:单个规则文件
RuleDir string // -pf:规则目录
Timeout int // -timeout:请求超时(秒)
Rate int // -rate:全部请求的总速率上限(次/秒),0 不限制
RateMinute int // -rpm:全部请求的总速率上限(次/分钟),0 不限制
HostRate int // -host-rate:单台主机的速率上限(次/秒),0 不限制
HostRatePerPort bool // -host-rate-per-port:每主机限速按端口分别计算
Debug bool // -debug
NoFileLog bool // -no-file-log
}
Options 命令行选项。