diff --git a/src/cli.py b/src/cli.py index 2de2c42..c3f8d29 100644 --- a/src/cli.py +++ b/src/cli.py @@ -54,7 +54,7 @@ def is_yaml (filename): kb_file = value('-k') scan_files = values('-s') report_file = value('-r') - output_content_file = value('-o') + output_file = value('-o') if template_file and report_file: report = Report() @@ -77,21 +77,37 @@ def is_yaml (filename): report.kb_load_yaml(kb_file) else: report.kb_load_json(kb_file) - if output_content_file: + if output_file: json_ext = '.json' - with open(output_content_file, 'w') as h: - if output_content_file[-len(json_ext):] == json_ext: + with open(output_file, 'w') as h: + if output_file[-len(json_ext):] == json_ext: h.write(report.content_dump_json().encode('utf-8')) else: h.write(report.content_dump_yaml().encode('utf-8')) + print 'Output content file saved.' report.xml_apply_meta() report.save_report_xml(report_file) print 'Report saved.' + elif scan_files and output_file: + if len(scan_files) > 1: + print 'Only single scan-file can be provided!' + else: + scan = Scan(scan_files[0]) + json_ext = '.json' + with open(output_file, 'w') as h: + if output_file[-len(json_ext):] == json_ext: + h.write(scan.dump_json().encode('utf-8')) + else: + h.write(scan.dump_yaml().encode('utf-8')) + print 'Output scan file saved.' else: print 'Usage: ' print print ' ' + self.title + '.exe -t template-file [-c content-file] [-k kb-file] [[-s scan-file] ...] -r output-report-file [-o output-content-file]' - print ' generate report (and optionally - content yaml)' + print ' generate report (and optionally - content as yaml / json)' + print + print ' ' + self.title + '.exe -s scan-file -o output-scan-file' + print ' convert scan xml to yaml or json format (derived from output file extension)' print print ' ' + self.title + '.exe [--help]' print ' display usage and exit' diff --git a/src/version.py b/src/version.py index 6ed4d4d..2fa7f9e 100755 --- a/src/version.py +++ b/src/version.py @@ -31,9 +31,12 @@ class Version(object): Generate reports based on HP WebInspect, BurpSuite Pro scans, own custom data, knowledge base and Microsoft Office Word templates. ''' - version = '0.9.8' - date = 'Tue May 9 10:21:47 2017' + version = '0.9.9' + date = 'Wed May 10 09:42:18 2017' changelog = ''' + 0.9.9 - Wed May 10 09:42:18 2017 + - Added CLI option for converting scan xml file to yaml or json + 0.9.8 - Tue May 9 10:21:47 2017 - Added CLI option for (optional) outputting content to file (yaml / json)