2121from ._binary_dao import get_oss_info_from_db
2222from ._binary import BinaryItem
2323from ._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"
2727logger = 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