fosslight-binary 4.1.31__tar.gz → 4.1.32__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/PKG-INFO +1 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/requirements.txt +1 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/setup.py +1 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/_help.py +2 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/binary_analysis.py +30 -26
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/cli.py +3 -3
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/PKG-INFO +1 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/requires.txt +1 -1
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/LICENSE +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/LICENSES/Apache-2.0.txt +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/LICENSES/LicenseRef-3rd_party_licenses.txt +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/MANIFEST.in +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/README.md +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/setup.cfg +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/__init__.py +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/_binary.py +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/_binary_dao.py +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary/_jar_analysis.py +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/SOURCES.txt +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/dependency_links.txt +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/entry_points.txt +0 -0
- {fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/top_level.txt +0 -0
|
@@ -18,7 +18,8 @@ _HELP_MESSAGE_BINARY = """
|
|
|
18
18
|
-e <path>\t\t\t Path to exclude from analysis (files and directories)
|
|
19
19
|
-o <output_path>\t\t Output path
|
|
20
20
|
\t\t\t\t (If you want to generate the specific file name, add the output path with file name.)
|
|
21
|
-
-f <format
|
|
21
|
+
-f <format> [<format> ...]\t Output file formats (excel, csv, opossum, yaml)
|
|
22
|
+
\t\t\t\t Multiple formats can be specified separated by space.
|
|
22
23
|
-d <db_url>\t\t\t DB Connection(format :'postgresql://username:password@host:port/database_name')
|
|
23
24
|
--notice\t\t\t Print the open source license notice text.
|
|
24
25
|
--no_correction\t\t\t Enter if you don't want to correct OSS information with sbom-info.yaml
|
|
@@ -13,7 +13,7 @@ import yaml
|
|
|
13
13
|
import stat
|
|
14
14
|
from fosslight_util.set_log import init_log
|
|
15
15
|
import fosslight_util.constant as constant
|
|
16
|
-
from fosslight_util.output_format import
|
|
16
|
+
from fosslight_util.output_format import check_output_formats, write_output_file
|
|
17
17
|
from ._binary_dao import get_oss_info_from_db
|
|
18
18
|
from ._binary import BinaryItem
|
|
19
19
|
from ._jar_analysis import analyze_jar_file, merge_binary_list
|
|
@@ -46,7 +46,7 @@ BIN_EXT_HEADER = {'BIN_FL_Binary': ['ID', 'Binary Path', 'OSS Name',
|
|
|
46
46
|
'Comment', 'Vulnerability Link', 'TLSH', 'SHA1']}
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
def init(path_to_find_bin, output_file_name,
|
|
49
|
+
def init(path_to_find_bin, output_file_name, formats, path_to_exclude=[]):
|
|
50
50
|
global _root_path, logger, _start_time
|
|
51
51
|
|
|
52
52
|
_json_ext = ".json"
|
|
@@ -59,22 +59,24 @@ def init(path_to_find_bin, output_file_name, format, path_to_exclude=[]):
|
|
|
59
59
|
if not path_to_find_bin.endswith(os.path.sep):
|
|
60
60
|
_root_path += os.path.sep
|
|
61
61
|
|
|
62
|
-
success, msg, output_path,
|
|
62
|
+
success, msg, output_path, output_files, output_extensions = check_output_formats(output_file_name, formats)
|
|
63
|
+
|
|
63
64
|
if success:
|
|
64
65
|
if output_path == "":
|
|
65
66
|
output_path = os.getcwd()
|
|
66
67
|
else:
|
|
67
68
|
output_path = os.path.abspath(output_path)
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
while len(output_files) < len(output_extensions):
|
|
71
|
+
output_files.append(None)
|
|
72
|
+
for i, output_extension in enumerate(output_extensions):
|
|
73
|
+
if output_files[i] is None or output_files[i] == "":
|
|
74
|
+
if output_extension == _json_ext:
|
|
75
|
+
output_files[i] = f"fosslight_opossum_bin_{_start_time}"
|
|
76
|
+
else:
|
|
77
|
+
output_files[i] = f"fosslight_report_bin_{_start_time}"
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
combined_paths_and_files = [os.path.join(output_path, file) for file in output_files]
|
|
78
80
|
else:
|
|
79
81
|
logger.error(f"Format error - {msg}")
|
|
80
82
|
sys.exit(1)
|
|
@@ -86,7 +88,7 @@ def init(path_to_find_bin, output_file_name, format, path_to_exclude=[]):
|
|
|
86
88
|
error_occured(error_msg=msg,
|
|
87
89
|
result_log=_result_log,
|
|
88
90
|
exit=True)
|
|
89
|
-
return _result_log,
|
|
91
|
+
return _result_log, combined_paths_and_files, output_extensions
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
def get_file_list(path_to_find, abs_path_to_exclude):
|
|
@@ -130,11 +132,11 @@ def get_file_list(path_to_find, abs_path_to_exclude):
|
|
|
130
132
|
return file_cnt, bin_list, found_jar
|
|
131
133
|
|
|
132
134
|
|
|
133
|
-
def find_binaries(path_to_find_bin, output_dir,
|
|
135
|
+
def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=False,
|
|
134
136
|
correct_mode=True, correct_filepath="", path_to_exclude=[]):
|
|
135
137
|
|
|
136
|
-
_result_log,
|
|
137
|
-
path_to_find_bin, output_dir,
|
|
138
|
+
_result_log, result_reports, output_extensions = init(
|
|
139
|
+
path_to_find_bin, output_dir, formats, path_to_exclude)
|
|
138
140
|
|
|
139
141
|
total_bin_cnt = 0
|
|
140
142
|
total_file_cnt = 0
|
|
@@ -143,7 +145,7 @@ def find_binaries(path_to_find_bin, output_dir, format, dburl="", simple_mode=Fa
|
|
|
143
145
|
writing_msg = ""
|
|
144
146
|
hide_header = {'TLSH', "SHA1"}
|
|
145
147
|
content_list = []
|
|
146
|
-
|
|
148
|
+
results = []
|
|
147
149
|
bin_list = []
|
|
148
150
|
base_dir_name = os.path.basename(path_to_find_bin)
|
|
149
151
|
abs_path_to_exclude = [os.path.abspath(os.path.join(base_dir_name, path)) for path in path_to_exclude if path.strip() != ""]
|
|
@@ -197,20 +199,22 @@ def find_binaries(path_to_find_bin, output_dir, format, dburl="", simple_mode=Fa
|
|
|
197
199
|
if total_bin_cnt == 0:
|
|
198
200
|
cover.comment += "(No binary detected.) "
|
|
199
201
|
cover.comment += f"/ Total number of files: {total_file_cnt}"
|
|
200
|
-
|
|
201
|
-
|
|
202
|
+
for combined_path_and_file, output_extension in zip(result_reports, output_extensions):
|
|
203
|
+
results.append(write_output_file(combined_path_and_file, output_extension, sheet_list, BIN_EXT_HEADER, hide_header, cover))
|
|
204
|
+
|
|
202
205
|
except Exception as ex:
|
|
203
206
|
error_occured(error_msg=str(ex), exit=False)
|
|
204
207
|
|
|
205
|
-
|
|
206
|
-
if
|
|
207
|
-
|
|
208
|
+
for success_to_write, writing_msg, result_file in results:
|
|
209
|
+
if success_to_write:
|
|
210
|
+
if result_file:
|
|
211
|
+
logger.info(f"Output file :{result_file}")
|
|
212
|
+
else:
|
|
213
|
+
logger.warning(f"{writing_msg}")
|
|
214
|
+
if cover.comment:
|
|
215
|
+
logger.info(cover.comment)
|
|
208
216
|
else:
|
|
209
|
-
logger.
|
|
210
|
-
if cover.comment:
|
|
211
|
-
logger.info(cover.comment)
|
|
212
|
-
else:
|
|
213
|
-
logger.error(f"Fail to generate result file.:{writing_msg}")
|
|
217
|
+
logger.error(f"Fail to generate result file.:{writing_msg}")
|
|
214
218
|
|
|
215
219
|
try:
|
|
216
220
|
print_result_log(success=True, result_log=_result_log,
|
|
@@ -30,7 +30,7 @@ def main():
|
|
|
30
30
|
parser.add_argument('-p', '--path', type=str, required=False)
|
|
31
31
|
parser.add_argument('-o', '--output', type=str, required=False)
|
|
32
32
|
parser.add_argument('-d', '--dburl', type=str, default='', required=False)
|
|
33
|
-
parser.add_argument('-f', '--
|
|
33
|
+
parser.add_argument('-f', '--formats', type=str, required=False, nargs="*")
|
|
34
34
|
parser.add_argument('-e', '--exclude', nargs="*", required=False, default=[])
|
|
35
35
|
parser.add_argument('--notice', action='store_true', required=False)
|
|
36
36
|
parser.add_argument('--no_correction', action='store_true', required=False)
|
|
@@ -66,8 +66,8 @@ def main():
|
|
|
66
66
|
if args.dburl: # -d option
|
|
67
67
|
db_url = args.dburl
|
|
68
68
|
|
|
69
|
-
if args.
|
|
70
|
-
format = args.
|
|
69
|
+
if args.formats: # -f option
|
|
70
|
+
format = list(args.formats)
|
|
71
71
|
|
|
72
72
|
if args.no_correction:
|
|
73
73
|
correct_mode = False
|
|
File without changes
|
|
File without changes
|
{fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/LICENSES/LicenseRef-3rd_party_licenses.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_binary-4.1.31 → fosslight_binary-4.1.32}/src/fosslight_binary.egg-info/top_level.txt
RENAMED
|
File without changes
|