scanoss 1.12.3__py3-none-any.whl → 1.14.0__py3-none-any.whl
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.
- scanoss/__init__.py +1 -1
- scanoss/cli.py +6 -2
- scanoss/data/build_date.txt +1 -1
- scanoss/scanner.py +22 -8
- scanoss/spdxlite.py +5 -4
- scanoss/winnowing.py +1 -1
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/METADATA +6 -5
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/RECORD +12 -12
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/WHEEL +1 -1
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/LICENSE +0 -0
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/entry_points.txt +0 -0
- {scanoss-1.12.3.dist-info → scanoss-1.14.0.dist-info}/top_level.txt +0 -0
scanoss/__init__.py
CHANGED
scanoss/cli.py
CHANGED
|
@@ -72,6 +72,7 @@ def setup_args() -> None:
|
|
|
72
72
|
help='Use a dependency file instead of a folder (optional)')
|
|
73
73
|
p_scan.add_argument('--stdin', '-s', metavar='STDIN-FILENAME', type=str,
|
|
74
74
|
help='Scan the file contents supplied via STDIN (optional)')
|
|
75
|
+
p_scan.add_argument('--files', '-e', type=str, nargs="*", help='List of files to scan.')
|
|
75
76
|
p_scan.add_argument('--identify', '-i', type=str, help='Scan and identify components in SBOM file')
|
|
76
77
|
p_scan.add_argument('--ignore', '-n', type=str, help='Ignore components specified in the SBOM file')
|
|
77
78
|
p_scan.add_argument('--output', '-o', type=str, help='Output result file name (optional - default stdout).')
|
|
@@ -445,8 +446,8 @@ def scan(parser, args):
|
|
|
445
446
|
args: Namespace
|
|
446
447
|
Parsed arguments
|
|
447
448
|
"""
|
|
448
|
-
if not args.scan_dir and not args.wfp and not args.stdin and not args.dep:
|
|
449
|
-
print_stderr('Please specify a file/folder, fingerprint (--wfp), dependency (--dep), or STDIN (--stdin)')
|
|
449
|
+
if not args.scan_dir and not args.wfp and not args.stdin and not args.dep and not args.files:
|
|
450
|
+
print_stderr('Please specify a file/folder, files (--files), fingerprint (--wfp), dependency (--dep), or STDIN (--stdin)')
|
|
450
451
|
parser.parse_args([args.subparser, '-h'])
|
|
451
452
|
exit(1)
|
|
452
453
|
if args.pac and args.proxy:
|
|
@@ -556,6 +557,9 @@ def scan(parser, args):
|
|
|
556
557
|
contents = sys.stdin.buffer.read()
|
|
557
558
|
if not scanner.scan_contents(args.stdin, contents):
|
|
558
559
|
exit(1)
|
|
560
|
+
elif args.files:
|
|
561
|
+
if not scanner.scan_files_with_options(args.files, args.dep, scanner.winnowing.file_map):
|
|
562
|
+
exit(1)
|
|
559
563
|
elif args.scan_dir:
|
|
560
564
|
if not os.path.exists(args.scan_dir):
|
|
561
565
|
print_stderr(f'Error: File or folder specified does not exist: {args.scan_dir}.')
|
scanoss/data/build_date.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
date:
|
|
1
|
+
date: 20240829161941, utime: 1724948381
|
scanoss/scanner.py
CHANGED
|
@@ -25,7 +25,7 @@ import json
|
|
|
25
25
|
import os
|
|
26
26
|
import sys
|
|
27
27
|
import datetime
|
|
28
|
-
import
|
|
28
|
+
import importlib_resources
|
|
29
29
|
|
|
30
30
|
from progress.bar import Bar
|
|
31
31
|
from progress.spinner import Spinner
|
|
@@ -270,9 +270,10 @@ class Scanner(ScanossBase):
|
|
|
270
270
|
"""
|
|
271
271
|
data = None
|
|
272
272
|
try:
|
|
273
|
-
f_name =
|
|
274
|
-
with
|
|
275
|
-
|
|
273
|
+
f_name = importlib_resources.files(__name__) / 'data/build_date.txt'
|
|
274
|
+
with importlib_resources.as_file(f_name) as f:
|
|
275
|
+
with open(f, 'r', encoding='utf-8') as file:
|
|
276
|
+
data = file.read().rstrip()
|
|
276
277
|
except Exception as e:
|
|
277
278
|
Scanner.print_stderr(f'Warning: Problem loading build time details: {e}')
|
|
278
279
|
if not data or len(data) == 0:
|
|
@@ -522,8 +523,6 @@ class Scanner(ScanossBase):
|
|
|
522
523
|
else:
|
|
523
524
|
raw_output += ",\n \"%s\":[%s]" % (file, json.dumps(dep_file, indent=2))
|
|
524
525
|
# End for loop
|
|
525
|
-
else:
|
|
526
|
-
success = False
|
|
527
526
|
raw_output += "\n}"
|
|
528
527
|
parsed_json = None
|
|
529
528
|
try:
|
|
@@ -625,7 +624,6 @@ class Scanner(ScanossBase):
|
|
|
625
624
|
success = True
|
|
626
625
|
if not files:
|
|
627
626
|
raise Exception(f"ERROR: Please provide a non-empty list of filenames to scan")
|
|
628
|
-
self.print_msg(f'Scanning {len(files)} files...')
|
|
629
627
|
spinner = None
|
|
630
628
|
if not self.quiet and self.isatty:
|
|
631
629
|
spinner = Spinner('Fingerprinting ')
|
|
@@ -637,7 +635,23 @@ class Scanner(ScanossBase):
|
|
|
637
635
|
file_count = 0 # count all files fingerprinted
|
|
638
636
|
wfp_file_count = 0 # count number of files in each queue post
|
|
639
637
|
scan_started = False
|
|
638
|
+
filtered_files = []
|
|
639
|
+
# Filter the files to remove anything we shouldn't scan
|
|
640
640
|
for file in files:
|
|
641
|
+
filename = os.path.basename(file)
|
|
642
|
+
filtered_filenames = self.__filter_files([filename])
|
|
643
|
+
if not filtered_filenames or len(filtered_filenames) == 0:
|
|
644
|
+
self.print_debug(f'Skipping filtered file: {file}')
|
|
645
|
+
continue
|
|
646
|
+
paths = os.path.dirname(file).split(os.sep)
|
|
647
|
+
if len(self.__filter_dirs(paths)) == len(paths): # Nothing found to filter
|
|
648
|
+
filtered_files.append(file)
|
|
649
|
+
else:
|
|
650
|
+
self.print_debug(f'Skipping filtered (folder) file: {file}')
|
|
651
|
+
if len(filtered_files) > 0:
|
|
652
|
+
self.print_debug(f'Scanning {len(filtered_files)} files...')
|
|
653
|
+
# Process all the requested files
|
|
654
|
+
for file in filtered_files:
|
|
641
655
|
if self.threaded_scan and self.threaded_scan.stop_scanning():
|
|
642
656
|
self.print_stderr('Warning: Aborting fingerprinting as the scanning service is not available.')
|
|
643
657
|
break
|
|
@@ -697,7 +711,7 @@ class Scanner(ScanossBase):
|
|
|
697
711
|
if self.threaded_scan:
|
|
698
712
|
success = self.__run_scan_threaded(scan_started, file_count)
|
|
699
713
|
else:
|
|
700
|
-
Scanner.print_stderr(f'Warning: No files found to scan from: {
|
|
714
|
+
Scanner.print_stderr(f'Warning: No files found to scan from: {filtered_files}')
|
|
701
715
|
return success
|
|
702
716
|
|
|
703
717
|
def scan_files_with_options(self, files: [], deps_file: str = None, file_map: dict = None) -> bool:
|
scanoss/spdxlite.py
CHANGED
|
@@ -28,7 +28,7 @@ import hashlib
|
|
|
28
28
|
import datetime
|
|
29
29
|
import getpass
|
|
30
30
|
import re
|
|
31
|
-
import
|
|
31
|
+
import importlib_resources
|
|
32
32
|
|
|
33
33
|
from . import __version__
|
|
34
34
|
|
|
@@ -300,9 +300,10 @@ class SpdxLite:
|
|
|
300
300
|
:return: True if successful, False otherwise
|
|
301
301
|
"""
|
|
302
302
|
try:
|
|
303
|
-
f_name =
|
|
304
|
-
with
|
|
305
|
-
|
|
303
|
+
f_name = importlib_resources.files(__name__) / filename
|
|
304
|
+
with importlib_resources.as_file(f_name) as f:
|
|
305
|
+
with open(f, 'r', encoding='utf-8') as file:
|
|
306
|
+
data = json.load(file)
|
|
306
307
|
except Exception as e:
|
|
307
308
|
self.print_stderr(f'ERROR: Problem parsing SPDX license input JSON: {e}')
|
|
308
309
|
return False
|
scanoss/winnowing.py
CHANGED
|
@@ -307,7 +307,7 @@ class Winnowing(ScanossBase):
|
|
|
307
307
|
return ''
|
|
308
308
|
# Print file line
|
|
309
309
|
content_length = len(contents)
|
|
310
|
-
wfp_filename = file
|
|
310
|
+
wfp_filename = repr(file).strip("'") # return a utf-8 compatible version of the filename
|
|
311
311
|
if self.obfuscate: # hide the real size of the file and its name, but keep the suffix
|
|
312
312
|
wfp_filename = f'{self.ob_count}{pathlib.Path(file).suffix}'
|
|
313
313
|
self.ob_count = self.ob_count + 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: scanoss
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.0
|
|
4
4
|
Summary: Simple Python library to leverage the SCANOSS APIs
|
|
5
5
|
Home-page: https://scanoss.com
|
|
6
6
|
Author: SCANOSS
|
|
@@ -17,16 +17,17 @@ Requires-Python: >=3.7
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: requests
|
|
20
|
-
Requires-Dist: crc32c
|
|
20
|
+
Requires-Dist: crc32c>=2.2
|
|
21
21
|
Requires-Dist: binaryornot
|
|
22
22
|
Requires-Dist: progress
|
|
23
|
-
Requires-Dist: grpcio
|
|
24
|
-
Requires-Dist: protobuf
|
|
23
|
+
Requires-Dist: grpcio>1.42.0
|
|
24
|
+
Requires-Dist: protobuf>3.19.1
|
|
25
25
|
Requires-Dist: pypac
|
|
26
26
|
Requires-Dist: pyOpenSSL
|
|
27
27
|
Requires-Dist: google-api-core
|
|
28
|
+
Requires-Dist: importlib-resources
|
|
28
29
|
Provides-Extra: fast_winnowing
|
|
29
|
-
Requires-Dist: scanoss-winnowing
|
|
30
|
+
Requires-Dist: scanoss-winnowing>=0.5.0; extra == "fast-winnowing"
|
|
30
31
|
|
|
31
32
|
# SCANOSS Python Package
|
|
32
33
|
The SCANOSS python package provides a simple easy to consume library for interacting with SCANOSS APIs/Engine.
|
|
@@ -4,22 +4,22 @@ protoc_gen_swagger/options/annotations_pb2.py,sha256=b25EDD6gssUWnFby9gxgcpLIROT
|
|
|
4
4
|
protoc_gen_swagger/options/annotations_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
5
5
|
protoc_gen_swagger/options/openapiv2_pb2.py,sha256=vYElGp8E1vGHszvWqX97zNG9GFJ7u2QcdK9ouq0XdyI,14939
|
|
6
6
|
protoc_gen_swagger/options/openapiv2_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
7
|
-
scanoss/__init__.py,sha256=
|
|
8
|
-
scanoss/cli.py,sha256=
|
|
7
|
+
scanoss/__init__.py,sha256=PYRQO5k_j5mM7XuvgMnHH8E6yu_q0uICKeUgA6to0Mk,1163
|
|
8
|
+
scanoss/cli.py,sha256=rsLtipYmDjAQxEIKwQuf9Y5XAcl0p5hZs6ZQ_TcJ-eA,42812
|
|
9
9
|
scanoss/components.py,sha256=ZHZ1KA69shxOASZK7USD9yPTITpAc_RXL5q5zpDK23o,12590
|
|
10
10
|
scanoss/csvoutput.py,sha256=hBwr_Fc6mBdOdXgyQcdFrockYH-PJ0jblowlExJ6OPg,9925
|
|
11
11
|
scanoss/cyclonedx.py,sha256=G6HxI8z3NJsOjBRuQJ8ApHQaUOP9-lO8PIBjcJMHchg,12167
|
|
12
12
|
scanoss/filecount.py,sha256=o7xb6m387ucnsU4H1OXGzf_AdWsudhAHe49T8uX4Ieo,6660
|
|
13
13
|
scanoss/scancodedeps.py,sha256=dPJsv9BmEsaM1IEzceJCnwLyu6Z0JwPposxdY4q0DAg,10775
|
|
14
|
-
scanoss/scanner.py,sha256=
|
|
14
|
+
scanoss/scanner.py,sha256=VqLjJh7igR59gTA0jFHvueS6hh8JSs3QgEK7rzPuBbA,51210
|
|
15
15
|
scanoss/scanossapi.py,sha256=5OwRQZ23rdPOL4bA5fXI7xdKnJOgRYaL60HuzZPdu-I,12562
|
|
16
16
|
scanoss/scanossbase.py,sha256=WxYlWl6WxRArho4VKGFxEla8qYnjOXtF6EnwsHTrKm4,2319
|
|
17
17
|
scanoss/scanossgrpc.py,sha256=ythZkr6F0P0hl_KPYoHkos_IL97TxLKeYfAouX_CUnM,20491
|
|
18
18
|
scanoss/scantype.py,sha256=R2-ExLGOrYxaJFtIK2AEo2caD0XrN1zpF5q1qT9Zsyc,1326
|
|
19
|
-
scanoss/spdxlite.py,sha256=
|
|
19
|
+
scanoss/spdxlite.py,sha256=IsWP9o1D8ryT1_5LeobIEhWJXNFbffoWCy1yaeZY2X0,15638
|
|
20
20
|
scanoss/threadeddependencies.py,sha256=JotQC9X3nnviblKe--OPS-7rr1W-cZjuxsxSPL-tbPg,6284
|
|
21
21
|
scanoss/threadedscanning.py,sha256=T0tL8W1IEX_hLY5ksrAl_iQqtxT_KbyDhTDHo6a7xFE,9387
|
|
22
|
-
scanoss/winnowing.py,sha256=
|
|
22
|
+
scanoss/winnowing.py,sha256=HzMWRYh1XB4so71br-DUPpV6OlmymDfsnU-EOCCObJM,18734
|
|
23
23
|
scanoss/api/__init__.py,sha256=KlDD87JmyZP-10T-fuJo0_v2zt1gxWfTgs70wjky9xg,1139
|
|
24
24
|
scanoss/api/common/__init__.py,sha256=KlDD87JmyZP-10T-fuJo0_v2zt1gxWfTgs70wjky9xg,1139
|
|
25
25
|
scanoss/api/common/v2/__init__.py,sha256=KlDD87JmyZP-10T-fuJo0_v2zt1gxWfTgs70wjky9xg,1139
|
|
@@ -47,12 +47,12 @@ scanoss/api/vulnerabilities/__init__.py,sha256=FLQtiDiv85Q1Chk-sJ9ky9WOV1mulZhEK
|
|
|
47
47
|
scanoss/api/vulnerabilities/v2/__init__.py,sha256=FLQtiDiv85Q1Chk-sJ9ky9WOV1mulZhEKjiBihlwiaM,1139
|
|
48
48
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py,sha256=CFhF80av8tenGvn9AIsGEtRJPuV2dC_syA5JLZb2lDw,5464
|
|
49
49
|
scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py,sha256=HlS4k4Zmx6RIAqaO9I96jD-eyF5yU6Xx04pVm7pdqOg,6864
|
|
50
|
-
scanoss/data/build_date.txt,sha256=
|
|
50
|
+
scanoss/data/build_date.txt,sha256=8feY4PDqu0ixPx9lW8xrv7zGbeOE1zZpaCtdJgPoVKc,40
|
|
51
51
|
scanoss/data/spdx-exceptions.json,sha256=s7UTYxC7jqQXr11YBlIWYCNwN6lRDFTR33Y8rpN_dA4,17953
|
|
52
52
|
scanoss/data/spdx-licenses.json,sha256=A6Z0q82gaTLtnopBfzeIVZjJFxkdRW1g2TuumQc-lII,228794
|
|
53
|
-
scanoss-1.
|
|
54
|
-
scanoss-1.
|
|
55
|
-
scanoss-1.
|
|
56
|
-
scanoss-1.
|
|
57
|
-
scanoss-1.
|
|
58
|
-
scanoss-1.
|
|
53
|
+
scanoss-1.14.0.dist-info/LICENSE,sha256=LLUaXoiyOroIbr5ubAyrxBOwSRLTm35ETO2FmLpy8QQ,1074
|
|
54
|
+
scanoss-1.14.0.dist-info/METADATA,sha256=QjOh1Fz4JLUKb3Za39rv9XAy_Z4vbx84gQKp9EQhuP8,5936
|
|
55
|
+
scanoss-1.14.0.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
56
|
+
scanoss-1.14.0.dist-info/entry_points.txt,sha256=Uy28xnaDL5KQ7V77sZD5VLDXPNxYYzSr5tsqtiXVzAs,48
|
|
57
|
+
scanoss-1.14.0.dist-info/top_level.txt,sha256=V11PrQ6Pnrc-nDF9xnisnJ8e6-i7HqSIKVNqduRWcL8,27
|
|
58
|
+
scanoss-1.14.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|