Mzap::CLI
Constants
FAIL_ON_LEVELS = {"informational", "low", "medium", "high"}
Accepted enumerated values, shared between validation and help text intent.
HELP_AJAXSPIDER = "Start Ajax Spider scans in ZAP\n\nUsage:\n mzap ajaxspider --urls <file> [flags]\n\nExamples:\n mzap ajaxspider --urls targets.txt --apis http://localhost:8090\n mzap ajaxspider --urls targets.txt --apis http://localhost:8090 --wait\n\n#{SCAN_FLAGS_TEXT}"
HELP_ASCAN = "Start Active Scan jobs in ZAP\n\nUsage:\n mzap ascan --urls <file> [flags]\n\nExamples:\n mzap ascan --urls targets.txt --apis http://localhost:8090\n mzap ascan --urls targets.txt --apis http://localhost:8090 --policy \"API-Minimal-Scan\"\n mzap ascan --urls targets.txt --apis http://localhost:8090 --wait --report-format html\n\n#{SCAN_FLAGS_TEXT}\n --policy string ZAP scan policy name for active scan"
HELP_CLIENTSPIDER = "Start Client Spider scans in ZAP\n\nThe Client Spider is the modern, browser-based crawler introduced in ZAP 2.16.\nIt requires ZAP >= 2.16 with the \"Client Side Integration\" add-on installed.\n\nUsage:\n mzap clientspider --urls <file> [flags]\n\nExamples:\n mzap clientspider --urls targets.txt --apis http://localhost:8090\n mzap clientspider --urls targets.txt --apis http://localhost:8090 --wait --report-format html\n\n#{SCAN_FLAGS_TEXT}"
HELP_IMPORT = "Import API definitions into ZAP\n\nSeeds ZAP's Sites Tree from API definitions so the endpoints can be passively\nscanned and reported, or actively scanned afterwards with `mzap ascan`.\nEach line in --urls is a spec location: a local file path or an http(s):// URL.\n\nUsage:\n mzap import --format <openapi|soap|graphql|postman> --urls <file> [flags]\n\nExamples:\n mzap import --format openapi --urls specs.txt --apis http://localhost:8090\n mzap import --format openapi --urls specs.txt --target-url https://api.example.com --wait --report-format sarif --fail-on high\n echo https://api.example.com/openapi.json | mzap import --format openapi --urls -\n\nFlags:\n --format string API definition format: openapi, soap, graphql, or postman\n --urls string Path to spec list file (file paths or http(s):// URLs, one per line)\n --target-url string Target/endpoint URL override (openapi target & host override; graphql endpoint)\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n --context string ZAP context file to import before importing specs\n --wait Wait for passive scanning to settle after import\n --wait-interval Poll interval in seconds while waiting (default 2)\n --wait-timeout Wait timeout in seconds (default 0: no timeout)\n --report-format Report format after import completion (html/pdf/json/md/sarif)\n --report-out Report output path (default: mzap-report-<timestamp>.<ext>)\n --fail-on string Fail with exit code 1 if alerts at or above risk level\n -h, --help Show help"
HELP_POLICIES = "List active-scan policies in ZAP\n\nDiscovers the scan policy names available on each host (useful for the ascan\n--policy flag). Pass --policy <name> to report scanner counts for that policy.\n\nUsage:\n mzap policies [--policy <name>] [flags]\n\nExamples:\n mzap policies --apis http://localhost:8090\n mzap policies --policy \"API-Minimal-Scan\" --apis http://localhost:8090\n\nFlags:\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --policy string Report scanner counts for this policy instead of listing names\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n -h, --help Show help"
HELP_PSCAN = "Wait for Passive Scan completion in ZAP\n\nUsage:\n mzap pscan [flags]\n\nExamples:\n mzap pscan --apis http://localhost:8090\n mzap pscan --apis http://localhost:8090 --wait-timeout 300 --report-format html\n\n#{PSCAN_FLAGS_TEXT}"
HELP_SITESTREE = "Export or prune the ZAP Sites Tree\n\nUses ZAP 2.16+ text-based Sites Tree files to support differential/incremental\nscanning in CI. The file path is resolved by the ZAP daemon, so on remote or\nDocker ZAP the file is written/read on the ZAP host, not the mzap host.\n\nUsage:\n mzap sitestree export <path> [flags]\n mzap sitestree prune <path> [flags]\n\nExamples:\n mzap sitestree export baseline.tree --apis http://localhost:8090\n mzap sitestree prune baseline.tree --apis http://localhost:8090\n\nFlags:\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n -h, --help Show help"
HELP_SPIDER = "Start Spider scans in ZAP\n\nUsage:\n mzap spider --urls <file> [flags]\n\nExamples:\n mzap spider --urls targets.txt --apis http://localhost:8090\n mzap spider --urls targets.txt --apis http://localhost:8090 --wait --report-format html\n\n#{SCAN_FLAGS_TEXT}"
HELP_STOP = "Stop running scans\n\nUsage:\n mzap stop <type> [flags]\n\nTypes:\n spider Stop all Spider scans\n ajaxspider Stop Ajax Spider scans\n clientspider Stop Client Spider scans\n ascan Stop all Active Scans\n all Stop all scan types\n\nExamples:\n mzap stop spider --apis http://localhost:8090\n mzap stop all --apis http://localhost:8090\n\nFlags:\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n -h, --help Show help"
HELP_TEXT = "Usage:\n mzap [command]\n\nSubcommands:\n ajaxspider Start Ajax Spider scans in ZAP\n ascan Start Active Scan jobs in ZAP\n clientspider Start Client Spider scans in ZAP (ZAP 2.16+)\n help Show help for a command\n import Import API definitions (openapi/soap/graphql/postman)\n policies List active-scan policies in ZAP\n pscan Wait for Passive Scan completion in ZAP\n sitestree Export or prune the ZAP Sites Tree (ZAP 2.16+)\n spider Start Spider scans in ZAP\n stop Stop running scans\n version Show mzap version\n\nFlags:\n --apikey string ZAP API key (omit when API key auth is disabled)\n --apis string Comma-separated ZAP API host URLs\n e.g. --apis http://localhost:8090,http://192.168.0.4:8090 (default \"http://localhost:8090\")\n --config string Config file path (TOML supported; default: $HOME/.config/mzap/config.toml)\n --context string ZAP context file to import before scanning\n --fail-on string Fail with exit code 1 if alerts at or above risk level\n (informational/low/medium/high). Implies --wait\n --report-format Report format after scan completion (html/pdf/json/md/sarif)\n --report-out Report output path (default: mzap-report-<timestamp>.<ext>)\n --concurrency Number of parallel scan dispatches (default 1)\n --wait Wait for initiated scans to complete\n --wait-interval Poll interval in seconds while waiting (default 2)\n --wait-timeout Wait timeout in seconds (default 0: no timeout)\n -h, --help Show help for mzap\n --urls string Path to URL list file (e.g. --urls hosts.txt)"
HELP_VERSION = "Show mzap version\n\nUsage:\n mzap version"
IMPORT_FORMATS = {"openapi", "soap", "graphql", "postman"}
INT_FLAGS = {"--wait-interval", "--wait-timeout", "--concurrency", "--retry", "--retry-delay"}
PSCAN_FLAGS_TEXT = "Flags:\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n --wait-interval Poll interval in seconds while waiting (default 2)\n --wait-timeout Wait timeout in seconds (default 0: no timeout)\n --report-format Report format after scan completion (html/pdf/json/md/sarif)\n --report-out Report output path (default: mzap-report-<timestamp>.<ext>)\n -h, --help Show help"
REPORT_FORMATS = {"html", "pdf", "json", "md", "sarif"}
SCAN_FLAGS_TEXT = "Flags:\n --urls string Path to URL list file (e.g. --urls hosts.txt)\n --apis string Comma-separated ZAP API host URLs (default \"http://localhost:8090\")\n --apikey string ZAP API key (omit when API key auth is disabled)\n --concurrency Number of parallel scan dispatches (default 1)\n --config string Config file path (default: $HOME/.config/mzap/config.toml)\n --context string ZAP context file to import before scanning\n --wait Wait for initiated scans to complete\n --wait-interval Poll interval in seconds while waiting (default 2)\n --wait-timeout Wait timeout in seconds (default 0: no timeout)\n --report-format Report format after scan completion (html/pdf/json/md/sarif)\n --report-out Report output path (default: mzap-report-<timestamp>.<ext>)\n -h, --help Show help"
STRING_FLAGS = {"--config", "--apikey", "--urls", "--apis", "--report-format", "--report-out", "--policy", "--context", "--fail-on", "--format", "--target-url"}
SUBCOMMAND_HELP = {"spider" => HELP_SPIDER, "ajaxspider" => HELP_AJAXSPIDER, "clientspider" => HELP_CLIENTSPIDER, "ascan" => HELP_ASCAN, "import" => HELP_IMPORT, "policies" => HELP_POLICIES, "sitestree" => HELP_SITESTREE, "pscan" => HELP_PSCAN, "stop" => HELP_STOP, "version" => HELP_VERSION}