2121logger = logging .getLogger (constant .LOGGER_NAME )
2222SRC_SHEET = 'SRC_FL_Source'
2323BIN_SHEET = 'BIN_FL_Binary'
24+ BIN_EXT_HEADER = {'BIN_FL_Binary' : ['ID' , 'Binary Name' , 'OSS Name' ,
25+ 'OSS Version' , 'License' , 'Download Location' ,
26+ 'Homepage' , 'Copyright Text' , 'Exclude' ,
27+ 'Comment' , 'Vulnerability Link' , 'TLSH' , 'SHA1' ]}
28+ BIN_HIDDEN_HEADER = {'TLSH' , "SHA1" }
2429
2530
2631def copy_file (source , destination ):
@@ -250,7 +255,7 @@ def correct_scanner_result(_output_dir, output_files, output_extension, exist_sr
250255 logger .warning (err_msg )
251256 if exist_bin :
252257 success , err_msg = write_output_with_osslist (bin_oss_list , _output_dir , output_files ['BIN' ],
253- output_extension , BIN_SHEET )
258+ output_extension , BIN_SHEET , BIN_EXT_HEADER , BIN_HIDDEN_HEADER )
254259 if not success :
255260 logger .warning (err_msg )
256261 if duplicates :
@@ -260,18 +265,19 @@ def correct_scanner_result(_output_dir, output_files, output_extension, exist_sr
260265 return
261266
262267
263- def write_output_with_osslist (oss_list , output_dir , output_file , output_extension , sheetname ):
268+ def write_output_with_osslist (oss_list , output_dir , output_file , output_extension , sheetname , extended_hdr = {}, hidden_hdr = {} ):
264269 new_oss_list = []
265270 sheet_list = {}
266271 sheet_list [sheetname ] = []
267272
268273 for src_item in oss_list :
269- new_oss_list .append (src_item .get_print_array ()[0 ])
274+ scanner_name = constant .supported_sheet_and_scanner [sheetname ]
275+ new_oss_list .append (src_item .get_print_array (scanner_name )[0 ])
270276 sheet_list [sheetname ].extend (new_oss_list )
271277 if os .path .exists (os .path .join (output_dir , output_file )):
272278 os .remove (os .path .join (output_dir , output_file ))
273279 success , err_msg , _ = write_output_file (os .path .join (output_dir , output_file ).rstrip (output_extension ),
274- output_extension , sheet_list )
280+ output_extension , sheet_list , extended_hdr , hidden_hdr )
275281 return success , err_msg
276282
277283
0 commit comments