fosslight-binary 5.0.0__tar.gz → 5.1.0__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-5.0.0 → fosslight_binary-5.1.0}/PKG-INFO +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/requirements.txt +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/setup.py +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_binary.py +0 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/binary_analysis.py +30 -7
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/cli.py +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/PKG-INFO +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/requires.txt +1 -1
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSE +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSES/Apache-2.0.txt +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSES/LicenseRef-3rd_party_licenses.txt +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/MANIFEST.in +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/README.md +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/setup.cfg +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/__init__.py +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_binary_dao.py +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_help.py +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_jar_analysis.py +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/SOURCES.txt +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/dependency_links.txt +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/entry_points.txt +0 -0
- {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/top_level.txt +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
|
+
import platform
|
|
8
9
|
from datetime import datetime
|
|
9
10
|
from binaryornot.check import is_binary
|
|
10
11
|
import magic
|
|
@@ -13,7 +14,7 @@ import yaml
|
|
|
13
14
|
import stat
|
|
14
15
|
from fosslight_util.set_log import init_log
|
|
15
16
|
import fosslight_util.constant as constant
|
|
16
|
-
from fosslight_util.output_format import
|
|
17
|
+
from fosslight_util.output_format import check_output_formats_v2, write_output_file
|
|
17
18
|
from ._binary_dao import get_oss_info_from_db
|
|
18
19
|
from ._binary import BinaryItem, TLSH_CHECKSUM_NULL
|
|
19
20
|
from ._jar_analysis import analyze_jar_file, merge_binary_list
|
|
@@ -83,7 +84,7 @@ def init(path_to_find_bin, output_file_name, formats, path_to_exclude=[]):
|
|
|
83
84
|
if not path_to_find_bin.endswith(os.path.sep):
|
|
84
85
|
_root_path += os.path.sep
|
|
85
86
|
|
|
86
|
-
success, msg, output_path, output_files, output_extensions =
|
|
87
|
+
success, msg, output_path, output_files, output_extensions, formats = check_output_formats_v2(output_file_name, formats)
|
|
87
88
|
|
|
88
89
|
if success:
|
|
89
90
|
if output_path == "":
|
|
@@ -93,12 +94,33 @@ def init(path_to_find_bin, output_file_name, formats, path_to_exclude=[]):
|
|
|
93
94
|
|
|
94
95
|
while len(output_files) < len(output_extensions):
|
|
95
96
|
output_files.append(None)
|
|
97
|
+
to_remove = [] # elements of spdx format on windows that should be removed
|
|
96
98
|
for i, output_extension in enumerate(output_extensions):
|
|
97
99
|
if output_files[i] is None or output_files[i] == "":
|
|
98
|
-
if
|
|
99
|
-
|
|
100
|
+
if formats:
|
|
101
|
+
if formats[i].startswith('spdx'):
|
|
102
|
+
if platform.system() != 'Windows':
|
|
103
|
+
output_files[i] = f"fosslight_spdx_bin_{_start_time}"
|
|
104
|
+
else:
|
|
105
|
+
logger.warning('spdx format is not supported on Windows. Please remove spdx from format.')
|
|
106
|
+
to_remove.append(i)
|
|
107
|
+
else:
|
|
108
|
+
if output_extension == _json_ext:
|
|
109
|
+
output_files[i] = f"fosslight_opossum_bin_{_start_time}"
|
|
110
|
+
else:
|
|
111
|
+
output_files[i] = f"fosslight_report_bin_{_start_time}"
|
|
100
112
|
else:
|
|
101
|
-
|
|
113
|
+
if output_extension == _json_ext:
|
|
114
|
+
output_files[i] = f"fosslight_opossum_bin_{_start_time}"
|
|
115
|
+
else:
|
|
116
|
+
output_files[i] = f"fosslight_report_bin_{_start_time}"
|
|
117
|
+
for index in sorted(to_remove, reverse=True):
|
|
118
|
+
# remove elements of spdx format on windows
|
|
119
|
+
del output_files[index]
|
|
120
|
+
del output_extensions[index]
|
|
121
|
+
del formats[index]
|
|
122
|
+
if len(output_extensions) < 1:
|
|
123
|
+
sys.exit(0)
|
|
102
124
|
|
|
103
125
|
combined_paths_and_files = [os.path.join(output_path, file) for file in output_files]
|
|
104
126
|
else:
|
|
@@ -221,8 +243,9 @@ def find_binaries(path_to_find_bin, output_dir, formats, dburl="", simple_mode=F
|
|
|
221
243
|
scan_item.set_cover_comment("(No binary detected.) ")
|
|
222
244
|
scan_item.set_cover_comment(f"Total number of files: {total_file_cnt}")
|
|
223
245
|
|
|
224
|
-
for combined_path_and_file, output_extension in zip(result_reports, output_extensions):
|
|
225
|
-
results.append(write_output_file(combined_path_and_file, output_extension, scan_item,
|
|
246
|
+
for combined_path_and_file, output_extension, output_format in zip(result_reports, output_extensions, formats):
|
|
247
|
+
results.append(write_output_file(combined_path_and_file, output_extension, scan_item,
|
|
248
|
+
BIN_EXT_HEADER, HIDE_HEADER, output_format))
|
|
226
249
|
|
|
227
250
|
except Exception as ex:
|
|
228
251
|
error_occured(error_msg=str(ex), exit=False)
|
|
File without changes
|
|
File without changes
|
{fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/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
|
|
File without changes
|
{fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/top_level.txt
RENAMED
|
File without changes
|