Skip to content

Commit 77c0ca3

Browse files
committed
Modify to print output file name
1 parent 6839e94 commit 77c0ca3

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ py-tlsh
88
pytz
99
XlsxWriter
1010
PyYAML
11-
fosslight_util>=1.3.11
11+
fosslight_util>=1.3.12
1212
dependency-check

src/fosslight_binary/_jar_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_vulnerability_info(file_with_path, vulnerability, vulnerability_items, r
9191
return vulnerability_items
9292

9393

94-
def ananlyze_jar_file(path_to_find_bin):
94+
def analyze_jar_file(path_to_find_bin):
9595
remove_owasp_item = []
9696
owasp_items = {}
9797
remove_vulnerability_items = []

src/fosslight_binary/binary_analysis.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ._binary_dao import get_oss_info_from_db
2222
from ._binary import BinaryItem
2323
from ._help import print_help_msg
24-
from ._jar_analysis import ananlyze_jar_file, merge_binary_list
24+
from ._jar_analysis import analyze_jar_file, merge_binary_list
2525

2626
_PKG_NAME = "fosslight_binary"
2727
logger = logging.getLogger(constant.LOGGER_NAME)
@@ -80,7 +80,8 @@ def init(path_to_find_bin, output_file_name, format):
8080
result_report = os.path.join(output_path, result_report)
8181
binary_txt_file = os.path.join(output_path, bin_txt_file)
8282
else:
83-
output_path = os.getcwd()
83+
logger.error(f"Format error. {msg}")
84+
sys.exit(1)
8485

8586
log_file = os.path.join(output_path, "fosslight_bin_log_" + _start_time + ".txt")
8687
logger, _result_log = init_log(log_file, True, logging.INFO, logging.DEBUG, _PKG_NAME, path_to_find_bin)
@@ -151,7 +152,7 @@ def find_binaries(path_to_find_bin, output_dir, format, dburl=""):
151152
# Run OWASP Dependency-check
152153
if found_jar:
153154
logger.info("Run OWASP Dependency-check to analyze .jar file")
154-
owasp_items, vulnerability_items = ananlyze_jar_file(path_to_find_bin)
155+
owasp_items, vulnerability_items = analyze_jar_file(path_to_find_bin)
155156
if owasp_items:
156157
return_list = merge_binary_list(owasp_items, vulnerability_items, return_list)
157158
extended_header = JAR_VUL_HEADER
@@ -174,23 +175,16 @@ def find_binaries(path_to_find_bin, output_dir, format, dburl=""):
174175
content_list.extend(scan_item.get_oss_report())
175176
sheet_list["BIN_FL_Binary"] = content_list
176177

177-
success_to_write, writing_msg = write_output_file(result_report, output_extension, sheet_list, extended_header)
178+
success_to_write, writing_msg, result_file = write_output_file(result_report, output_extension, sheet_list, extended_header)
178179
except Exception as ex:
179180
error_occured(error_msg=str(ex), exit=False)
180181

181182
# Print Result
182183
try:
183-
output_files = []
184-
if output_extension == "":
185-
output_extension = ".xlsx"
186-
if not windows:
187-
output_files.append(f"{result_report}.csv")
188-
output_files.insert(0, f"{result_report}{output_extension}")
189-
190-
logger.info(f"Writing Output file ({output_files[0]}"
191-
f"):{success_to_write} {writing_msg}")
192184
if success_to_write:
193-
_result_log["Output file"] = output_files
185+
logger.debug(f"Writing Output file ({result_file}), Ssuccess: {success_to_write}")
186+
else:
187+
logger.error(f"Fail to generate result file. msg:({writing_msg})")
194188
except Exception as ex:
195189
error_occured(error_msg=f"Print log:{ex}", exit=False)
196190

0 commit comments

Comments
 (0)