Skip to content

Commit d9661b4

Browse files
committed
output engine: threats: Generate THREATS.md file
Signed-off-by: John Andersen <[email protected]>
1 parent 3eaa2ab commit d9661b4

File tree

4 files changed

+576
-3
lines changed

4 files changed

+576
-3
lines changed

cve_bin_tool/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def main(argv=None):
186186
"-f",
187187
"--format",
188188
action="store",
189-
choices=["csv", "json", "console", "html", "pdf"],
189+
choices=["csv", "json", "console", "html", "pdf", "md"],
190190
help="update output format (default: console)",
191191
default="console",
192192
)

cve_bin_tool/output_engine/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ..version import VERSION
1818
from .console import output_console
1919
from .html import output_html
20+
from .threats import output_threats
2021
from .util import (
2122
add_extension_if_not,
2223
format_output,
@@ -390,6 +391,22 @@ def output_cves(self, outfile, output_type="console"):
390391
self.logger,
391392
outfile,
392393
)
394+
elif output_type == "md":
395+
if self.filename.endswith("THREATS.md"):
396+
output_threats(
397+
self.all_cve_data,
398+
self.scanned_dir,
399+
self.filename,
400+
self.themes_dir,
401+
self.total_files,
402+
self.products_with_cve,
403+
self.products_without_cve,
404+
self.merge_report,
405+
self.logger,
406+
outfile,
407+
)
408+
else:
409+
raise NotImplementedError("Only generating THREATS.md currently supported. Attempted output to {self.filename!r}.")
393410
else: # console, or anything else that is unrecognised
394411
output_console(
395412
self.all_cve_data,

0 commit comments

Comments
 (0)