Mzap::CLI
Inherits Reference / Object
Constants
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_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_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 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 help Show help for a command\n pscan Wait for Passive Scan completion in ZAP\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"
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"
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"}
SUBCOMMAND_HELP = {"spider" => HELP_SPIDER, "ajaxspider" => HELP_AJAXSPIDER, "ascan" => HELP_ASCAN, "pscan" => HELP_PSCAN, "stop" => HELP_STOP, "version" => HELP_VERSION}
Class methods
run(argv : Array(String) = ARGV, stdout_io : IO = STDOUT, stderr_io : IO = STDERR) : Int32
Source