module

Mzap::Client

Inspection / maintenance concern for Mzap::Client: discovery of active-scan policies (so the --policy flag is usable) and Sites Tree export/prune for ZAP 2.16+ differential/incremental scanning in CI.

Constants

ACCESS_API = "/JSON/core/action/accessUrl/"
AJAX_SPIDER_API = "/JSON/ajaxSpider/action/scan/"
AJAX_SPIDER_STOP = "/JSON/ajaxSpider/action/stop/"
AJAX_STATUS = "/JSON/ajaxSpider/view/status/"
ALERTS_SUMMARY_API = "/JSON/alert/view/alertsSummary/"
ASCAN_API = "/JSON/ascan/action/scan/"
ASCAN_SCANNERS_API = "/JSON/ascan/view/scanners/"
ASCAN_STATUS = "/JSON/ascan/view/status/"
ASCAN_STOP = "/JSON/ascan/action/stopAllScans/"
CLIENT_SPIDER_API = "/JSON/clientSpider/action/scan/"
CLIENT_SPIDER_STAT = "/JSON/clientSpider/view/status/"
CLIENT_SPIDER_STOP = "/JSON/clientSpider/action/stop/"
ERROR_STATUSES = {"error", "failed", "failure", "aborted"}
EXPORT_SITES_TREE_API = "/JSON/exim/action/exportSitesTree/"
GRAPHQL_IMPORT_FILE_API = "/JSON/graphql/action/importFile/"
GRAPHQL_IMPORT_URL_API = "/JSON/graphql/action/importUrl/"
HTML_REPORT_API = "/OTHER/core/other/htmlreport/"
OPENAPI_IMPORT_FILE_API = "/JSON/openapi/action/importFile/"
OPENAPI_IMPORT_URL_API = "/JSON/openapi/action/importUrl/"
PDF_REPORT_API = "/OTHER/core/other/pdfreport/"
POSTMAN_IMPORT_FILE_API = "/JSON/postman/action/importFile/"
POSTMAN_IMPORT_URL_API = "/JSON/postman/action/importUrl/"
PRUNE_SITES_TREE_API = "/JSON/exim/action/pruneSitesTree/"
PSCAN_RECORDS_TO_SCAN = "/JSON/pscan/view/recordsToScan/"
REPORT_GENERATE_API = "/JSON/reports/action/generate/"
REPORT_TITLE = "mzap report"
RISK_LEVELS = {"informational" => 0, "low" => 1, "medium" => 2, "high" => 3}
RUNNING_STATUSES = {"running", "inprogress", "in_progress", "started", "busy"}
SCAN_POLICY_NAMES_API = "/JSON/ascan/view/scanPolicyNames/"
SOAP_IMPORT_FILE_API = "/JSON/soap/action/importFile/"
SOAP_IMPORT_URL_API = "/JSON/soap/action/importUrl/"
SPIDER_API = "/JSON/spider/action/scan/"
SPIDER_STATUS = "/JSON/spider/view/status/"
SPIDER_STOP = "/JSON/spider/action/stopAllScans/"
TEMPLATE_HTML = "traditional-html"
TEMPLATE_JSON = "traditional-json"
TEMPLATE_MD = "traditional-md"
TEMPLATE_PDF = "traditional-pdf"

Instance methods

active_scan(urls : String, *, apis : String, options : Options, reporter : Reporter = Reporter.new) : Bool
Source
ajax_spider(urls : String, *, apis : String, options : Options, reporter : Reporter = Reporter.new) : Bool
Source
client_spider(urls : String, *, apis : String, options : Options, reporter : Reporter = Reporter.new) : Bool

Client Spider is the modern, browser-based crawler introduced in ZAP 2.16 (the "client" add-on). Requires ZAP >= 2.16 with the Client Side Integration add-on installed; otherwise the scan dispatch surfaces a clear API error.

Source
export_sites_tree(apis : String, *, file_path : String, options : Options, reporter : Reporter = Reporter.new) : Nil

Exports each host's Sites Tree to a file. NOTE: the path is resolved by the ZAP daemon (not mzap), so on remote/Docker ZAP the file lands on the ZAP host.

Source
import_api(urls : String, *, format : String, target_url : String = "", apis : String, options : Options, reporter : Reporter = Reporter.new) : Bool

Imports each spec from the urls list file (one location per line; a local file path or an http(s):// URL) into every API host, round-robin. After import, reuses the passive-settle + report + fail-on pipeline. Returns true only when --fail-on is set and the gate is tripped.

Source
list_policies(apis : String, *, policy : String = "", options : Options, reporter : Reporter = Reporter.new) : Nil

Lists active-scan policy names per host. When policy is given, reports the scanner counts for that policy instead, so users can tune it.

Source
passive_scan(apis : String, *, options : Options, reporter : Reporter = Reporter.new) : Bool
Source
prune_sites_tree(apis : String, *, file_path : String, options : Options, reporter : Reporter = Reporter.new) : Nil

Prunes each host's Sites Tree using a previously exported file (daemon-side path, see export_sites_tree).

Source
run(urls : String, apis : String, scan_type : String, options : Options, reporter : Reporter = Reporter.new) : Bool
Source
spider(urls : String, *, apis : String, options : Options, reporter : Reporter = Reporter.new) : Bool
Source
stop_active_scan(apis : String, *, options : Options, reporter : Reporter = Reporter.new) : Nil
Source
stop_ajax_spider(apis : String, *, options : Options, reporter : Reporter = Reporter.new) : Nil
Source
stop_client_spider(apis : String, *, options : Options, reporter : Reporter = Reporter.new) : Nil
Source
stop_spider(apis : String, *, options : Options, reporter : Reporter = Reporter.new) : Nil
Source