From 788795e8f416ac665bc024a75b63f1353d78f667 Mon Sep 17 00:00:00 2001 From: Peter Mosmans Date: Mon, 16 Oct 2017 13:16:41 +1000 Subject: [PATCH] Display unique finding code as well --- chatops/python/pentext_id.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chatops/python/pentext_id.py b/chatops/python/pentext_id.py index d09a91b..4305a44 100644 --- a/chatops/python/pentext_id.py +++ b/chatops/python/pentext_id.py @@ -38,7 +38,7 @@ except ImportError as exception: sys.exit(-1) -VERSION = '0.1' +VERSION = '0.2.0' class LogFormatter(logging.Formatter): @@ -146,6 +146,8 @@ def main(): try: # Parse document into an ElementTree tree = etree.parse(filename, etree.XMLParser(strip_cdata=False)) + # Read finding code + code = tree.getroot().attrib['findingCode'] # Grab all elements from the findings section for elements in tree.xpath('//section[@id="findings"]'): # Iterate through all elements, looking for the findings @@ -160,7 +162,7 @@ def main(): locate_finding(findings, args) else: for i, href in enumerate(findings, start=1): - print("{0:2d} {1}".format(i, href)) + print("{0}-{1:02d} {2}".format(code, i, href)) if __name__ == "__main__":