Skip to content

Commit e21ee75

Browse files
committed
Add scanner info sheet
Signed-off-by: jiyeong.seok <[email protected]>
1 parent abe64ef commit e21ee75

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fosslight_util>=1.4.39
1+
fosslight_util>=1.4.40
22
fosslight_source>=1.6.16
33
fosslight_binary>=4.1.3
44
beautifulsoup4

src/fosslight_android/_write_excel.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@
77
import logging
88
from fosslight_util.write_txt import write_txt_file
99
from fosslight_util.constant import LOGGER_NAME
10-
from fosslight_util.write_excel import hide_column
10+
from fosslight_util.write_excel import hide_column, write_cover_sheet
1111

1212
logger = logging.getLogger(LOGGER_NAME)
1313
HIDDEN_HEADER = ['TLSH', 'SHA1']
1414

1515

16-
def write_result_to_excel(out_file_name, row_list):
16+
def write_result_to_excel(out_file_name, row_list, cover=''):
1717
header_row = ['ID', 'Binary Name', 'Source Code Path', 'NOTICE.html', 'OSS Name', 'OSS Version', 'License',
1818
'Download Location', 'Homepage',
1919
'Copyright Text',
2020
'License Text', 'Exclude', 'Comment', 'Need Check', 'TLSH', 'SHA1']
2121
sheet_name = "BIN (Android)"
2222
try:
2323
workbook = xlsxwriter.Workbook(out_file_name)
24+
if cover:
25+
write_cover_sheet(workbook, cover)
2426
worksheet = create_worksheet(workbook, sheet_name, header_row)
2527
write_result_to_sheet(worksheet, row_list)
2628
hide_column(worksheet, header_row, HIDDEN_HEADER)
@@ -45,7 +47,7 @@ def create_worksheet(workbook, sheet_name, header_row):
4547
return worksheet
4648

4749

48-
def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file):
50+
def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file, cover=''):
4951
excel_list = []
5052
final_str = ['Binary Name\tSource Code Path\tNOTICE.html\tOSS Name\tOSS Version\tLicense\tNeed '
5153
'Check\tComment\ttlsh\tchecksum']
@@ -60,6 +62,6 @@ def write_result_to_txt_and_excel(out_excel_file, final_bin_info, out_txt_file):
6062
sys.exit(1)
6163

6264
success, error_msg = write_txt_file(out_txt_file, '\n'.join(final_str))
63-
write_result_to_excel(out_excel_file, excel_list)
65+
write_result_to_excel(out_excel_file, excel_list, cover)
6466
else:
6567
logger.warning("Nothing is detected from the scanner so output file is not generated.")

src/fosslight_android/android_binary_analysis.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from fosslight_binary.binary_analysis import return_bin_only
5555
import argparse
5656
from pathlib import Path
57+
from fosslight_util.cover import CoverItem
5758

5859
EXCEPTIONAL_PATH = [r"(/)+gen/META/lic_intermediates/"]
5960
android_log_lines = []
@@ -856,7 +857,10 @@ def main():
856857
from ._src_analysis import find_item_to_analyze
857858
final_bin_info = find_item_to_analyze(final_bin_info, python_script_dir, now, path_to_exclude)
858859

859-
write_result_to_txt_and_excel(result_excel_file, final_bin_info, result_txt_file)
860+
cover = CoverItem(tool_name=PKG_NAME,
861+
start_time=now,
862+
input_path=python_script_dir)
863+
write_result_to_txt_and_excel(result_excel_file, final_bin_info, result_txt_file, cover)
860864
result_log["Output FOSSLight Report"] = result_excel_file
861865
result_log["Output result text file"] = result_txt_file
862866

0 commit comments

Comments
 (0)