Skip to content

Commit 4855eee

Browse files
authored
Merge pull request #90 from fosslight/develop
Add TLSH, SHA1 column for binary analysis
2 parents 1ef6608 + 97c3a75 commit 4855eee

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ openpyxl
44
progress
55
pyyaml
66
beautifulsoup4
7-
fosslight_util>=1.4.40
7+
fosslight_util>=1.4.41
88
fosslight_source>=1.7.3
99
fosslight_dependency>=3.7.4
10-
fosslight_binary>=4.1.24
10+
fosslight_binary>=4.1.28
1111
fosslight_prechecker>=3.0.1

src/fosslight_scanner/common.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
logger = logging.getLogger(constant.LOGGER_NAME)
2222
SRC_SHEET = 'SRC_FL_Source'
2323
BIN_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

2631
def 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

Comments
 (0)