hahwul/mzap

GitHub: hahwul/mzap

基于 Crystal 开发的 ZAP 多目标扫描编排工具,通过多实例负载分发提升批量 Web 安全扫描效率。

Stars: 106 | Forks: 17

# mzap `mzap` 是一个用于多目标 ZAP 扫描的 Crystal CLI 工具。 它将目标分发给一个或多个 ZAP API 主机,支持可选的等待模式,并可以导出报告。 ## 功能 - 多种扫描命令:`spider`、`ajaxspider`、`ascan` - 使用轮询(round-robin)调度的多主机分发 - 支持超时的可选等待/轮询模式 - 报告导出(`html`/`pdf`)及回退行为 - 针对 `spider`、`ajaxspider`、`ascan` 或 `all` 的停止命令 - 可选从 `$HOME/.config/mzap/config.toml` 及旧版路径加载配置 ## 环境要求 - Crystal `>= 1.19.1` - 一个运行中的 ZAP API 端点(或多个端点) ## 安装 ### Homebrew ``` brew install hahwul/mzap/mzap ``` ### 从源码构建 ``` shards install --frozen crystal build --release src/mzap_cli.cr -o bin/mzap ``` ### 不构建直接运行 ``` crystal run src/mzap_cli.cr -- version ``` ### Docker 镜像 ``` docker build -t mzap . docker run --rm -v "$PWD:/work" mzap spider --urls /work/samples/target.txt --apis http://host.docker.internal:8090 ``` ## 使用方法 ``` Usage: mzap [command] Subcommands: ajaxspider Start Ajax Spider scans in ZAP ascan Start Active Scan jobs in ZAP help Show help for a command spider Start Spider scans in ZAP stop Stop running scans version Show mzap version Flags: --apikey string ZAP API key (omit when API key auth is disabled) --apis string Comma-separated ZAP API host URLs e.g. --apis http://localhost:8090,http://192.168.0.4:8090 (default "http://localhost:8090") --config string Config file path (TOML supported; default: $HOME/.config/mzap/config.toml) --report-format Report format after scan completion (html/pdf) --report-out Report output path (default: mzap-report-.) --wait Wait for initiated scans to complete --wait-interval Poll interval in seconds while waiting (default 2) --wait-timeout Wait timeout in seconds (default 0: no timeout) -h, --help Show help for mzap --urls string Path to URL list file (e.g. --urls hosts.txt) ``` ## 示例 ``` # 使用两个 ZAP API 主机进行 spider 扫描 mzap spider --urls samples/target.txt --apis http://localhost:8090,http://192.168.0.4:8090 # 运行扫描,等待完成,并生成 HTML 报告 mzap spider --urls samples/target.txt --apis http://localhost:8090 --wait --report-format html --report-out reports/mzap.html # 停止所有正在运行的扫描类型 mzap stop all --apis http://localhost:8090 ``` ## 配置 `mzap` 在配置文件存在时会自动加载配置。 优先级为: 1. 显式指定的 `--config` 路径(如果存在) 2. `$HOME/.config/mzap/config.toml` 3. `$HOME/.config/mzap/config` + 扩展名变体 4. `$HOME/.mzap` + 扩展名变体 CLI 参数始终覆盖配置值。 ``` [mzap] apis = ["http://localhost:8090", "http://192.168.0.4:8090"] apikey = "your-zap-api-key" urls = "samples/target.txt" wait = true wait_interval = 2 wait_timeout = 0 report_format = "html" report_out = "reports/mzap.html" ``` ## GitHub Action 本仓库包含一个基于 Docker 的 GitHub Action(`action.yml`)。 ``` - name: Run mzap uses: hahwul/mzap@ with: arguments: "spider --urls samples/target.txt --apis http://localhost:8090" ``` ## 开发 ``` # 测试 crystal spec # release 构建 crystal build --release src/mzap_cli.cr -o bin/mzap ```
标签:Ajax Spider, BeEF, CLI, Crystal语言, DInvoke, Docker, IOC 共享, OWASP ZAP, Python安全, Talos规则, Web安全, WiFi技术, 主动扫描, 分布式扫描, 多目标扫描, 安全防御评估, 密码管理, 插件系统, 爬虫, 蓝队分析, 请求拦截