Skip to content

Commit f46fb40

Browse files
committed
Add support for *-plus ZAP report formats
ZAP reports can come in an enhanced "plus" format, which also contains the full request and response headers and payload. This commit adds support for selecting these formats to ZAP Advanced. To enable them, simply add '-r XML-plus' to the parameters in the Scan definition. The XML-plus format is compatible with the regular XML format used by the parser. Signed-off-by: Max Maass <max.maass@iteratec.com>
1 parent 6b7e0d8 commit f46fb40

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

scanners/zap-advanced/scanner/zapclient/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def get_parser_args(args=None):
116116
parser.add_argument("-r",
117117
"--report-type",
118118
help='The OWASP ZAP Report Type.',
119-
choices=['XML', 'JSON', 'HTML', 'MD'],
119+
choices=['XML', 'XML-plus', 'JSON', 'JSON-plus', 'HTML', 'HTML-plus', 'MD'],
120120
default=None,
121121
required=False)
122122
return parser.parse_args(args)

scanners/zap-advanced/scanner/zapclient/zap_automation.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,21 @@ def __start_scanner(self, target: str):
146146
def get_report_template_for_file_type(self, file_type: str):
147147
if file_type == "XML":
148148
return "traditional-xml"
149+
elif file_type == "XML-plus":
150+
return "traditional-xml-plus"
149151
elif file_type == "JSON":
150152
return "traditional-json"
153+
elif file_type == "JSON-plus":
154+
return "traditional-json-plus"
151155
elif file_type == "HTML":
152156
return "traditional-html"
157+
elif file_type == "HTML-plus":
158+
return "traditional-html-plus"
153159
elif file_type == "MD":
154160
return "traditional-md"
155161
else:
156162
raise RuntimeError(
157-
"Report file type: '" + file_type + "' hasn't been implemented. Available: XML, JSON, HTML or MD")
163+
"Report file type: '" + file_type + "' hasn't been implemented. Available: XML, XML-plus, JSON, JSON-plus, HTML, HTML-plus, or MD")
158164

159165
def generate_report_file(self, file_path: str, report_type: str):
160166
# To retrieve ZAP report in XML or HTML format
@@ -163,7 +169,9 @@ def generate_report_file(self, file_path: str, report_type: str):
163169
if report_type is None:
164170
report_type = "XML"
165171

166-
report_file = "zap-results." + report_type.lower()
172+
# Remove any trailing "-plus" from the file ending, as this is an artifact of the
173+
# XML-plus / JSON-plus / HTML-plus report format selector.
174+
report_file = "zap-results." + report_type.lower().replace('-plus', '')
167175
self.__zap.reports.generate(
168176
title="ZAP Report",
169177
template=self.get_report_template_for_file_type(report_type),

0 commit comments

Comments
 (0)