1
1
'''
2
- Export the vulnerabilites from a project version to CSV. Can be used to apply batch vulnerability
2
+ Export the vulnerabilites from a project as CSV. Can be used to apply batch vulnerability
3
3
remediation with vuln_batch_remediation.py
4
4
'''
5
5
from blackduck import Client
@@ -25,6 +25,7 @@ def main():
25
25
parser = argparse .ArgumentParser (prog = program_name , usage = "%(prog)s [options]" , description = "Automated Assessment" )
26
26
parser .add_argument ("--output" , required = False ,help = "csv output path" )
27
27
parser .add_argument ("--project" , required = True , help = "project name" )
28
+ parser .add_argument ("--base-url" , required = False , help = "base url" , default = "https://blackduck.omicron.at" )
28
29
parser .add_argument ("--version" , required = False , help = "project version, e.g. latest" )
29
30
parser .add_argument ("--component" , required = False , help = "component name" )
30
31
args = parser .parse_args ()
@@ -39,7 +40,7 @@ def main():
39
40
40
41
bd = Client (
41
42
token = API_TOKEN ,
42
- base_url = "https://blackduck.omicron.at" ,
43
+ base_url = args . base_url ,
43
44
verify = False # TLS certificate verification
44
45
)
45
46
@@ -64,11 +65,7 @@ def main():
64
65
name = remediation ['vulnerabilityName' ]
65
66
status = remediation ['remediationStatus' ]
66
67
description = remediation ['description' ].replace ('\r ' , '' ).replace ('\n ' , '' )
67
-
68
- try :
69
- comment = remediation ['remediationComment' ].replace ('\r ' , '' ).replace ('\n ' , '' )
70
- except KeyError :
71
- comment = ""
68
+ comment = remediation .get ('remediationComment' , "" ).replace ('\r ' , '' ).replace ('\n ' , '' )
72
69
73
70
row = [name , status , comment , componentName , componentVersion , description ]
74
71
csv_writer .writerow (row )
0 commit comments