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.
Files changed (22) hide show
  1. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/PKG-INFO +1 -1
  2. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/requirements.txt +1 -1
  3. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/setup.py +1 -1
  4. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_binary.py +0 -1
  5. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/binary_analysis.py +30 -7
  6. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/cli.py +1 -1
  7. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/PKG-INFO +1 -1
  8. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/requires.txt +1 -1
  9. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSE +0 -0
  10. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSES/Apache-2.0.txt +0 -0
  11. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/LICENSES/LicenseRef-3rd_party_licenses.txt +0 -0
  12. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/MANIFEST.in +0 -0
  13. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/README.md +0 -0
  14. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/setup.cfg +0 -0
  15. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/__init__.py +0 -0
  16. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_binary_dao.py +0 -0
  17. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_help.py +0 -0
  18. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary/_jar_analysis.py +0 -0
  19. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/SOURCES.txt +0 -0
  20. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/dependency_links.txt +0 -0
  21. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/entry_points.txt +0 -0
  22. {fosslight_binary-5.0.0 → fosslight_binary-5.1.0}/src/fosslight_binary.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight_binary
3
- Version: 5.0.0
3
+ Version: 5.1.0
4
4
  Summary: FOSSLight Binary Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_binary_scanner
6
6
  Author: LG Electronics
@@ -8,5 +8,5 @@ py-tlsh
8
8
  pytz
9
9
  XlsxWriter
10
10
  PyYAML
11
- fosslight_util>=2.0.0
11
+ fosslight_util>=2.1.0
12
12
  dependency-check
@@ -33,7 +33,7 @@ if __name__ == "__main__":
33
33
 
34
34
  setup(
35
35
  name=_PACKAEG_NAME,
36
- version='5.0.0',
36
+ version='5.1.0',
37
37
  package_dir={"": "src"},
38
38
  packages=find_packages(where='src'),
39
39
  description='FOSSLight Binary Scanner',
@@ -24,7 +24,6 @@ class BinaryItem(FileItem):
24
24
  super().__init__("")
25
25
  self.exclude = False
26
26
  self.source_name_or_path = ""
27
- self.checksum = TLSH_CHECKSUM_NULL
28
27
  self.tlsh = TLSH_CHECKSUM_NULL
29
28
  self.vulnerability_items = []
30
29
  self.binary_name_without_path = ""
@@ -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 check_output_formats, write_output_file
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 = check_output_formats(output_file_name, formats)
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 output_extension == _json_ext:
99
- output_files[i] = f"fosslight_opossum_bin_{_start_time}"
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
- output_files[i] = f"fosslight_report_bin_{_start_time}"
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, BIN_EXT_HEADER, HIDE_HEADER))
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)
@@ -18,7 +18,7 @@ def main():
18
18
  path_to_find_bin = ""
19
19
  path_to_exclude = []
20
20
  output_dir = ""
21
- format = ""
21
+ format = []
22
22
  db_url = ""
23
23
  simple_mode = False
24
24
  correct_mode = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fosslight-binary
3
- Version: 5.0.0
3
+ Version: 5.1.0
4
4
  Summary: FOSSLight Binary Scanner
5
5
  Home-page: https://github.com/fosslight/fosslight_binary_scanner
6
6
  Author: LG Electronics
@@ -8,7 +8,7 @@ py-tlsh
8
8
  pytz
9
9
  XlsxWriter
10
10
  PyYAML
11
- fosslight_util>=2.0.0
11
+ fosslight_util>=2.1.0
12
12
  dependency-check
13
13
 
14
14
  [:"darwin" in sys_platform]