scanoss 1.12.2__py3-none-any.whl → 1.13.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/cyclonedx.py +10 -8
- scanoss/data/build_date.txt +1 -1
- scanoss/scanner.py +17 -4
- scanoss/spdxlite.py +14 -12
- {scanoss-1.12.2.dist-info → scanoss-1.13.0.dist-info}/METADATA +1 -1
- {scanoss-1.12.2.dist-info → scanoss-1.13.0.dist-info}/RECORD +12 -12
- {scanoss-1.12.2.dist-info → scanoss-1.13.0.dist-info}/LICENSE +0 -0
- {scanoss-1.12.2.dist-info → scanoss-1.13.0.dist-info}/WHEEL +0 -0
- {scanoss-1.12.2.dist-info → scanoss-1.13.0.dist-info}/entry_points.txt +0 -0
- {scanoss-1.12.2.dist-info → scanoss-1.13.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/cyclonedx.py
CHANGED
|
@@ -83,12 +83,13 @@ class CycloneDx(ScanossBase):
|
|
|
83
83
|
fd[field] = deps.get(field, '')
|
|
84
84
|
licenses = deps.get('licenses')
|
|
85
85
|
fdl = []
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
if licenses:
|
|
87
|
+
dc = []
|
|
88
|
+
for lic in licenses:
|
|
89
|
+
name = lic.get("name")
|
|
90
|
+
if name not in dc: # Only save the license name once
|
|
91
|
+
fdl.append({'id': name})
|
|
92
|
+
dc.append(name)
|
|
92
93
|
fd['licenses'] = fdl
|
|
93
94
|
cdx[purl] = fd
|
|
94
95
|
else:
|
|
@@ -137,8 +138,9 @@ class CycloneDx(ScanossBase):
|
|
|
137
138
|
fd[field] = d.get(field)
|
|
138
139
|
licenses = d.get('licenses')
|
|
139
140
|
fdl = []
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
if licenses:
|
|
142
|
+
for lic in licenses:
|
|
143
|
+
fdl.append({'id': lic.get("name")})
|
|
142
144
|
fd['licenses'] = fdl
|
|
143
145
|
cdx[purl] = fd
|
|
144
146
|
# self.print_stderr(f'VD: {vdx}')
|
scanoss/data/build_date.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
date:
|
|
1
|
+
date: 20240605132032, utime: 1717593632
|
scanoss/scanner.py
CHANGED
|
@@ -522,8 +522,6 @@ class Scanner(ScanossBase):
|
|
|
522
522
|
else:
|
|
523
523
|
raw_output += ",\n \"%s\":[%s]" % (file, json.dumps(dep_file, indent=2))
|
|
524
524
|
# End for loop
|
|
525
|
-
else:
|
|
526
|
-
success = False
|
|
527
525
|
raw_output += "\n}"
|
|
528
526
|
parsed_json = None
|
|
529
527
|
try:
|
|
@@ -625,7 +623,6 @@ class Scanner(ScanossBase):
|
|
|
625
623
|
success = True
|
|
626
624
|
if not files:
|
|
627
625
|
raise Exception(f"ERROR: Please provide a non-empty list of filenames to scan")
|
|
628
|
-
self.print_msg(f'Scanning {len(files)} files...')
|
|
629
626
|
spinner = None
|
|
630
627
|
if not self.quiet and self.isatty:
|
|
631
628
|
spinner = Spinner('Fingerprinting ')
|
|
@@ -637,7 +634,23 @@ class Scanner(ScanossBase):
|
|
|
637
634
|
file_count = 0 # count all files fingerprinted
|
|
638
635
|
wfp_file_count = 0 # count number of files in each queue post
|
|
639
636
|
scan_started = False
|
|
637
|
+
filtered_files = []
|
|
638
|
+
# Filter the files to remove anything we shouldn't scan
|
|
640
639
|
for file in files:
|
|
640
|
+
filename = os.path.basename(file)
|
|
641
|
+
filtered_filenames = self.__filter_files([filename])
|
|
642
|
+
if not filtered_filenames or len(filtered_filenames) == 0:
|
|
643
|
+
self.print_debug(f'Skipping filtered file: {file}')
|
|
644
|
+
continue
|
|
645
|
+
paths = os.path.dirname(file).split(os.sep)
|
|
646
|
+
if len(self.__filter_dirs(paths)) == len(paths): # Nothing found to filter
|
|
647
|
+
filtered_files.append(file)
|
|
648
|
+
else:
|
|
649
|
+
self.print_debug(f'Skipping filtered (folder) file: {file}')
|
|
650
|
+
if len(filtered_files) > 0:
|
|
651
|
+
self.print_debug(f'Scanning {len(filtered_files)} files...')
|
|
652
|
+
# Process all the requested files
|
|
653
|
+
for file in filtered_files:
|
|
641
654
|
if self.threaded_scan and self.threaded_scan.stop_scanning():
|
|
642
655
|
self.print_stderr('Warning: Aborting fingerprinting as the scanning service is not available.')
|
|
643
656
|
break
|
|
@@ -697,7 +710,7 @@ class Scanner(ScanossBase):
|
|
|
697
710
|
if self.threaded_scan:
|
|
698
711
|
success = self.__run_scan_threaded(scan_started, file_count)
|
|
699
712
|
else:
|
|
700
|
-
Scanner.print_stderr(f'Warning: No files found to scan from: {
|
|
713
|
+
Scanner.print_stderr(f'Warning: No files found to scan from: {filtered_files}')
|
|
701
714
|
return success
|
|
702
715
|
|
|
703
716
|
def scan_files_with_options(self, files: [], deps_file: str = None, file_map: dict = None) -> bool:
|
scanoss/spdxlite.py
CHANGED
|
@@ -100,12 +100,13 @@ class SpdxLite:
|
|
|
100
100
|
fd[field] = deps.get(field, '')
|
|
101
101
|
licenses = deps.get('licenses')
|
|
102
102
|
fdl = []
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
if licenses:
|
|
104
|
+
dc = []
|
|
105
|
+
for lic in licenses:
|
|
106
|
+
name = lic.get("name")
|
|
107
|
+
if name not in dc: # Only save the license name once
|
|
108
|
+
fdl.append({'id': name})
|
|
109
|
+
dc.append(name)
|
|
109
110
|
fd['licenses'] = fdl
|
|
110
111
|
summary[purl] = fd
|
|
111
112
|
else: # Normal file id type
|
|
@@ -128,12 +129,13 @@ class SpdxLite:
|
|
|
128
129
|
fd[field] = d.get(field)
|
|
129
130
|
licenses = d.get('licenses')
|
|
130
131
|
fdl = []
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
if licenses:
|
|
133
|
+
dc = []
|
|
134
|
+
for lic in licenses:
|
|
135
|
+
name = lic.get("name")
|
|
136
|
+
if name not in dc: # Only save the license name once
|
|
137
|
+
fdl.append({'id': name})
|
|
138
|
+
dc.append(name)
|
|
137
139
|
fd['licenses'] = fdl
|
|
138
140
|
summary[purl] = fd
|
|
139
141
|
return summary
|
|
@@ -4,19 +4,19 @@ 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=u1SpkxVGNwD-IXesiouaSu8W-ItPFNjvBWNM6EbBYd0,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
|
-
scanoss/cyclonedx.py,sha256=
|
|
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=Gyq40tbFW69IgWVAcTmKKn6FgTMMMs7Eh1KBKpQAZwY,51123
|
|
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=poLtzD2eaSL5X7adYbH3blxKAFO8Asf_1nIZj3ewXCA,15559
|
|
20
20
|
scanoss/threadeddependencies.py,sha256=JotQC9X3nnviblKe--OPS-7rr1W-cZjuxsxSPL-tbPg,6284
|
|
21
21
|
scanoss/threadedscanning.py,sha256=T0tL8W1IEX_hLY5ksrAl_iQqtxT_KbyDhTDHo6a7xFE,9387
|
|
22
22
|
scanoss/winnowing.py,sha256=lGRTtm5QqLQiu6PUV2lF5qI82g43OKyJ8-QsOV9Xp7w,18664
|
|
@@ -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=zD6AS2I72efNahM0-wXO-pr1RZFb654-eb5k92d1LS4,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.13.0.dist-info/LICENSE,sha256=LLUaXoiyOroIbr5ubAyrxBOwSRLTm35ETO2FmLpy8QQ,1074
|
|
54
|
+
scanoss-1.13.0.dist-info/METADATA,sha256=Ot8w1hKTSO-pJ_mX-XuuXz3MNgMFmOUjLdyKV_3ST1A,5906
|
|
55
|
+
scanoss-1.13.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
56
|
+
scanoss-1.13.0.dist-info/entry_points.txt,sha256=Uy28xnaDL5KQ7V77sZD5VLDXPNxYYzSr5tsqtiXVzAs,48
|
|
57
|
+
scanoss-1.13.0.dist-info/top_level.txt,sha256=V11PrQ6Pnrc-nDF9xnisnJ8e6-i7HqSIKVNqduRWcL8,27
|
|
58
|
+
scanoss-1.13.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|