scanoss 1.14.0__tar.gz → 1.15.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.
- {scanoss-1.14.0/src/scanoss.egg-info → scanoss-1.15.0}/PKG-INFO +1 -1
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/__init__.py +1 -1
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/cli.py +219 -48
- scanoss-1.15.0/src/scanoss/data/build_date.txt +1 -0
- scanoss-1.15.0/src/scanoss/results.py +301 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scancodedeps.py +29 -3
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scanner.py +42 -30
- scanoss-1.15.0/src/scanoss/scanoss_settings.py +189 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scanossapi.py +10 -20
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scanossbase.py +21 -0
- scanoss-1.15.0/src/scanoss/scanpostprocessor.py +159 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/threadeddependencies.py +75 -5
- {scanoss-1.14.0 → scanoss-1.15.0/src/scanoss.egg-info}/PKG-INFO +1 -1
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss.egg-info/SOURCES.txt +3 -0
- scanoss-1.14.0/src/scanoss/data/build_date.txt +0 -1
- {scanoss-1.14.0 → scanoss-1.15.0}/LICENSE +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/PACKAGE.md +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/README.md +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/pyproject.toml +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/setup.cfg +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/options/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/options/annotations_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/options/annotations_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/options/openapiv2_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/protoc_gen_swagger/options/openapiv2_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/common/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/common/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/common/v2/scanoss_common_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/common/v2/scanoss_common_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/components/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/components/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/components/v2/scanoss_components_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/components/v2/scanoss_components_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/cryptography/v2/scanoss_cryptography_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/dependencies/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/dependencies/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/dependencies/v2/scanoss_dependencies_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/scanning/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/scanning/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/scanning/v2/scanoss_scanning_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/semgrep/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/semgrep/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/semgrep/v2/scanoss_semgrep_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/vulnerabilities/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/vulnerabilities/v2/__init__.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/api/vulnerabilities/v2/scanoss_vulnerabilities_pb2_grpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/components.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/csvoutput.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/cyclonedx.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/data/spdx-exceptions.json +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/data/spdx-licenses.json +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/filecount.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scanossgrpc.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/scantype.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/spdxlite.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/threadedscanning.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss/winnowing.py +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss.egg-info/dependency_links.txt +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss.egg-info/entry_points.txt +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss.egg-info/requires.txt +0 -0
- {scanoss-1.14.0 → scanoss-1.15.0}/src/scanoss.egg-info/top_level.txt +0 -0
|
@@ -23,12 +23,17 @@
|
|
|
23
23
|
"""
|
|
24
24
|
import argparse
|
|
25
25
|
import os
|
|
26
|
+
from pathlib import Path
|
|
26
27
|
import sys
|
|
28
|
+
from array import array
|
|
27
29
|
|
|
28
30
|
import pypac
|
|
29
31
|
|
|
32
|
+
from .threadeddependencies import SCOPE
|
|
30
33
|
from .scanner import Scanner
|
|
34
|
+
from .scanoss_settings import ScanossSettings
|
|
31
35
|
from .scancodedeps import ScancodeDeps
|
|
36
|
+
from .scanner import FAST_WINNOWING, Scanner
|
|
32
37
|
from .scantype import ScanType
|
|
33
38
|
from .filecount import FileCount
|
|
34
39
|
from .cyclonedx import CycloneDx
|
|
@@ -37,6 +42,7 @@ from .csvoutput import CsvOutput
|
|
|
37
42
|
from .components import Components
|
|
38
43
|
from . import __version__
|
|
39
44
|
from .scanner import FAST_WINNOWING
|
|
45
|
+
from .results import Results
|
|
40
46
|
|
|
41
47
|
|
|
42
48
|
def print_stderr(*args, **kwargs):
|
|
@@ -100,6 +106,15 @@ def setup_args() -> None:
|
|
|
100
106
|
help='Scancode command and path if required (optional - default scancode).')
|
|
101
107
|
p_scan.add_argument('--sc-timeout', type=int, default=600,
|
|
102
108
|
help='Timeout (in seconds) for scancode to complete (optional - default 600)')
|
|
109
|
+
p_scan.add_argument('--dep-scope', '-ds', type=SCOPE, help='Filter dependencies by scope - default all (options: dev/prod)')
|
|
110
|
+
p_scan.add_argument('--dep-scope-inc', '-dsi', type=str,help='Include dependencies with declared scopes')
|
|
111
|
+
p_scan.add_argument('--dep-scope-exc', '-dse', type=str, help='Exclude dependencies with declared scopes')
|
|
112
|
+
p_scan.add_argument(
|
|
113
|
+
'--settings',
|
|
114
|
+
type=str,
|
|
115
|
+
help='Settings file to use for scanning (optional - default scanoss.json)',
|
|
116
|
+
)
|
|
117
|
+
|
|
103
118
|
|
|
104
119
|
# Sub-command: fingerprint
|
|
105
120
|
p_wfp = subparsers.add_parser('fingerprint', aliases=['fp', 'wfp'],
|
|
@@ -243,6 +258,47 @@ def setup_args() -> None:
|
|
|
243
258
|
p_p_proxy.add_argument('--url', required=False, type=str, default="https://api.osskb.org",
|
|
244
259
|
help='URL to test (default: https://api.osskb.org).')
|
|
245
260
|
|
|
261
|
+
p_results = subparsers.add_parser(
|
|
262
|
+
'results',
|
|
263
|
+
aliases=['res'],
|
|
264
|
+
description=f"SCANOSS Results commands: {__version__}",
|
|
265
|
+
help='Process scan results',
|
|
266
|
+
)
|
|
267
|
+
p_results.add_argument(
|
|
268
|
+
'filepath',
|
|
269
|
+
metavar='FILEPATH',
|
|
270
|
+
type=str,
|
|
271
|
+
nargs='?',
|
|
272
|
+
help='Path to the file containing the results',
|
|
273
|
+
)
|
|
274
|
+
p_results.add_argument(
|
|
275
|
+
'--match-type',
|
|
276
|
+
'-mt',
|
|
277
|
+
help='Filter results by match type (comma-separated, e.g., file,snippet)',
|
|
278
|
+
)
|
|
279
|
+
p_results.add_argument(
|
|
280
|
+
'--status',
|
|
281
|
+
'-s',
|
|
282
|
+
help='Filter results by file status (comma-separated, e.g., pending, identified)',
|
|
283
|
+
)
|
|
284
|
+
p_results.add_argument(
|
|
285
|
+
'--has-pending',
|
|
286
|
+
action='store_true',
|
|
287
|
+
help='Filter results to only include files with pending status',
|
|
288
|
+
)
|
|
289
|
+
p_results.add_argument(
|
|
290
|
+
'--output',
|
|
291
|
+
'-o',
|
|
292
|
+
help='Output result file',
|
|
293
|
+
)
|
|
294
|
+
p_results.add_argument(
|
|
295
|
+
'--format',
|
|
296
|
+
'-f',
|
|
297
|
+
choices=['json', 'plain'],
|
|
298
|
+
help='Output format (default: plain)',
|
|
299
|
+
)
|
|
300
|
+
p_results.set_defaults(func=results)
|
|
301
|
+
|
|
246
302
|
# Global Scan command options
|
|
247
303
|
for p in [p_scan]:
|
|
248
304
|
p.add_argument('--apiurl', type=str,
|
|
@@ -288,7 +344,7 @@ def setup_args() -> None:
|
|
|
288
344
|
|
|
289
345
|
# Help/Trace command options
|
|
290
346
|
for p in [p_scan, p_wfp, p_dep, p_fc, p_cnv, p_c_loc, p_c_dwnld, p_p_proxy, c_crypto, c_vulns, c_search,
|
|
291
|
-
c_versions, c_semgrep]:
|
|
347
|
+
c_versions, c_semgrep, p_results]:
|
|
292
348
|
p.add_argument('--debug', '-d', action='store_true', help='Enable debug messages')
|
|
293
349
|
p.add_argument('--trace', '-t', action='store_true', help='Enable trace messages, including API posts')
|
|
294
350
|
p.add_argument('--quiet', '-q', action='store_true', help='Enable quiet mode')
|
|
@@ -446,42 +502,70 @@ def scan(parser, args):
|
|
|
446
502
|
args: Namespace
|
|
447
503
|
Parsed arguments
|
|
448
504
|
"""
|
|
449
|
-
if
|
|
450
|
-
|
|
505
|
+
if (
|
|
506
|
+
not args.scan_dir
|
|
507
|
+
and not args.wfp
|
|
508
|
+
and not args.stdin
|
|
509
|
+
and not args.dep
|
|
510
|
+
and not args.files
|
|
511
|
+
):
|
|
512
|
+
print_stderr(
|
|
513
|
+
'Please specify a file/folder, files (--files), fingerprint (--wfp), dependency (--dep), or STDIN (--stdin)'
|
|
514
|
+
)
|
|
451
515
|
parser.parse_args([args.subparser, '-h'])
|
|
452
516
|
exit(1)
|
|
453
517
|
if args.pac and args.proxy:
|
|
454
518
|
print_stderr('Please specify one of --proxy or --pac, not both')
|
|
455
519
|
parser.parse_args([args.subparser, '-h'])
|
|
456
520
|
exit(1)
|
|
457
|
-
|
|
458
|
-
|
|
521
|
+
|
|
522
|
+
if args.identify and args.settings:
|
|
523
|
+
print_stderr(f'ERROR: Cannot specify both --identify and --settings options.')
|
|
524
|
+
exit(1)
|
|
525
|
+
|
|
526
|
+
def is_valid_file(file_path: str) -> bool:
|
|
527
|
+
if not os.path.exists(file_path) or not os.path.isfile(file_path):
|
|
528
|
+
print_stderr(f'Specified file does not exist or is not a file: {file_path}')
|
|
529
|
+
return False
|
|
530
|
+
if not Scanner.valid_json_file(file_path):
|
|
531
|
+
return False
|
|
532
|
+
return True
|
|
533
|
+
|
|
534
|
+
scan_settings = ScanossSettings(
|
|
535
|
+
debug=args.debug, trace=args.trace, quiet=args.quiet
|
|
536
|
+
)
|
|
537
|
+
|
|
459
538
|
if args.identify:
|
|
460
|
-
|
|
461
|
-
scan_type = 'identify'
|
|
462
|
-
if not os.path.exists(sbom_path) or not os.path.isfile(sbom_path):
|
|
463
|
-
print_stderr(f'Specified --identify file does not exist or is not a file: {sbom_path}')
|
|
464
|
-
exit(1)
|
|
465
|
-
if not Scanner.valid_json_file(sbom_path): # Make sure it's a valid JSON file
|
|
539
|
+
if not is_valid_file(args.identify) or args.ignore:
|
|
466
540
|
exit(1)
|
|
467
|
-
|
|
468
|
-
|
|
541
|
+
scan_settings.load_json_file(args.identify).set_file_type(
|
|
542
|
+
'legacy'
|
|
543
|
+
).set_scan_type('identify')
|
|
469
544
|
elif args.ignore:
|
|
470
|
-
|
|
471
|
-
scan_type = 'blacklist'
|
|
472
|
-
if not os.path.exists(sbom_path) or not os.path.isfile(sbom_path):
|
|
473
|
-
print_stderr(f'Specified --ignore file does not exist or is not a file: {sbom_path}')
|
|
545
|
+
if not is_valid_file(args.ignore):
|
|
474
546
|
exit(1)
|
|
475
|
-
|
|
547
|
+
scan_settings.load_json_file(args.ignore).set_file_type('legacy').set_scan_type(
|
|
548
|
+
'blacklist'
|
|
549
|
+
)
|
|
550
|
+
elif args.settings:
|
|
551
|
+
if not is_valid_file(args.settings):
|
|
476
552
|
exit(1)
|
|
553
|
+
scan_settings.load_json_file(args.settings).set_file_type('new').set_scan_type(
|
|
554
|
+
'identify'
|
|
555
|
+
)
|
|
556
|
+
|
|
477
557
|
if args.dep:
|
|
478
558
|
if not os.path.exists(args.dep) or not os.path.isfile(args.dep):
|
|
479
|
-
print_stderr(
|
|
559
|
+
print_stderr(
|
|
560
|
+
f'Specified --dep file does not exist or is not a file: {args.dep}'
|
|
561
|
+
)
|
|
480
562
|
exit(1)
|
|
481
563
|
if not Scanner.valid_json_file(args.dep): # Make sure it's a valid JSON file
|
|
482
564
|
exit(1)
|
|
483
565
|
if args.strip_hpsm and not args.hpsm and not args.quiet:
|
|
484
|
-
print_stderr(
|
|
566
|
+
print_stderr(
|
|
567
|
+
f'Warning: --strip-hpsm option supplied without enabling HPSM (--hpsm). Ignoring.'
|
|
568
|
+
)
|
|
485
569
|
|
|
486
570
|
scan_output: str = None
|
|
487
571
|
if args.output:
|
|
@@ -520,37 +604,72 @@ def scan(parser, args):
|
|
|
520
604
|
print_stderr(f'Using flags {flags}...')
|
|
521
605
|
elif not args.quiet:
|
|
522
606
|
if args.timeout < 5:
|
|
523
|
-
print_stderr(
|
|
607
|
+
print_stderr(
|
|
608
|
+
f'POST timeout (--timeout) too small: {args.timeout}. Reverting to default.'
|
|
609
|
+
)
|
|
524
610
|
if args.retry < 0:
|
|
525
|
-
print_stderr(
|
|
611
|
+
print_stderr(
|
|
612
|
+
f'POST retry (--retry) too small: {args.retry}. Reverting to default.'
|
|
613
|
+
)
|
|
526
614
|
|
|
527
|
-
if not os.access(
|
|
615
|
+
if not os.access(
|
|
616
|
+
os.getcwd(), os.W_OK
|
|
617
|
+
): # Make sure the current directory is writable. If not disable saving WFP
|
|
528
618
|
print_stderr(f'Warning: Current directory is not writable: {os.getcwd()}')
|
|
529
619
|
args.no_wfp_output = True
|
|
530
620
|
if args.ca_cert and not os.path.exists(args.ca_cert):
|
|
531
621
|
print_stderr(f'Error: Certificate file does not exist: {args.ca_cert}.')
|
|
532
622
|
exit(1)
|
|
533
623
|
pac_file = get_pac_file(args.pac)
|
|
534
|
-
scan_options = get_scan_options(args)
|
|
535
|
-
|
|
536
|
-
scanner = Scanner(
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
624
|
+
scan_options = get_scan_options(args) # Figure out what scanning options we have
|
|
625
|
+
|
|
626
|
+
scanner = Scanner(
|
|
627
|
+
debug=args.debug,
|
|
628
|
+
trace=args.trace,
|
|
629
|
+
quiet=args.quiet,
|
|
630
|
+
api_key=args.key,
|
|
631
|
+
url=args.apiurl,
|
|
632
|
+
scan_output=scan_output,
|
|
633
|
+
output_format=output_format,
|
|
634
|
+
flags=flags,
|
|
635
|
+
nb_threads=args.threads,
|
|
636
|
+
post_size=args.post_size,
|
|
637
|
+
timeout=args.timeout,
|
|
638
|
+
no_wfp_file=args.no_wfp_output,
|
|
639
|
+
all_extensions=args.all_extensions,
|
|
640
|
+
all_folders=args.all_folders,
|
|
641
|
+
hidden_files_folders=args.all_hidden,
|
|
642
|
+
scan_options=scan_options,
|
|
643
|
+
sc_timeout=args.sc_timeout,
|
|
644
|
+
sc_command=args.sc_command,
|
|
645
|
+
grpc_url=args.api2url,
|
|
646
|
+
obfuscate=args.obfuscate,
|
|
647
|
+
ignore_cert_errors=args.ignore_cert_errors,
|
|
648
|
+
proxy=args.proxy,
|
|
649
|
+
grpc_proxy=args.grpc_proxy,
|
|
650
|
+
pac=pac_file,
|
|
651
|
+
ca_cert=args.ca_cert,
|
|
652
|
+
retry=args.retry,
|
|
653
|
+
hpsm=args.hpsm,
|
|
654
|
+
skip_size=args.skip_size,
|
|
655
|
+
skip_extensions=args.skip_extension,
|
|
656
|
+
skip_folders=args.skip_folder,
|
|
657
|
+
skip_md5_ids=args.skip_md5,
|
|
658
|
+
strip_hpsm_ids=args.strip_hpsm,
|
|
659
|
+
strip_snippet_ids=args.strip_snippet,
|
|
660
|
+
scan_settings=scan_settings
|
|
661
|
+
)
|
|
662
|
+
|
|
548
663
|
if args.wfp:
|
|
549
664
|
if not scanner.is_file_or_snippet_scan():
|
|
550
|
-
print_stderr(
|
|
665
|
+
print_stderr(
|
|
666
|
+
f'Error: Cannot specify WFP scanning if file/snippet options are disabled ({scan_options})'
|
|
667
|
+
)
|
|
551
668
|
exit(1)
|
|
552
669
|
if scanner.is_dependency_scan() and not args.dep:
|
|
553
|
-
print_stderr(
|
|
670
|
+
print_stderr(
|
|
671
|
+
f'Error: Cannot specify WFP & Dependency scanning without a dependency file (--dep)'
|
|
672
|
+
)
|
|
554
673
|
exit(1)
|
|
555
674
|
scanner.scan_wfp_with_options(args.wfp, args.dep)
|
|
556
675
|
elif args.stdin:
|
|
@@ -558,26 +677,37 @@ def scan(parser, args):
|
|
|
558
677
|
if not scanner.scan_contents(args.stdin, contents):
|
|
559
678
|
exit(1)
|
|
560
679
|
elif args.files:
|
|
561
|
-
if not scanner.scan_files_with_options(
|
|
680
|
+
if not scanner.scan_files_with_options(
|
|
681
|
+
args.files, args.dep, scanner.winnowing.file_map
|
|
682
|
+
):
|
|
562
683
|
exit(1)
|
|
563
684
|
elif args.scan_dir:
|
|
564
685
|
if not os.path.exists(args.scan_dir):
|
|
565
|
-
print_stderr(
|
|
686
|
+
print_stderr(
|
|
687
|
+
f'Error: File or folder specified does not exist: {args.scan_dir}.'
|
|
688
|
+
)
|
|
566
689
|
exit(1)
|
|
567
690
|
if os.path.isdir(args.scan_dir):
|
|
568
|
-
if not scanner.scan_folder_with_options(args.scan_dir, args.dep, scanner.winnowing.file_map
|
|
691
|
+
if not scanner.scan_folder_with_options(args.scan_dir, args.dep, scanner.winnowing.file_map,
|
|
692
|
+
args.dep_scope, args.dep_scope_inc, args.dep_scope_exc):
|
|
569
693
|
exit(1)
|
|
570
694
|
elif os.path.isfile(args.scan_dir):
|
|
571
|
-
if not scanner.scan_file_with_options(args.scan_dir, args.dep, scanner.winnowing.file_map
|
|
695
|
+
if not scanner.scan_file_with_options(args.scan_dir, args.dep, scanner.winnowing.file_map,
|
|
696
|
+
args.dep_scope, args.dep_scope_inc, args.dep_scope_exc):
|
|
572
697
|
exit(1)
|
|
573
698
|
else:
|
|
574
|
-
print_stderr(
|
|
699
|
+
print_stderr(
|
|
700
|
+
f'Error: Path specified is neither a file or a folder: {args.scan_dir}.'
|
|
701
|
+
)
|
|
575
702
|
exit(1)
|
|
576
703
|
elif args.dep:
|
|
577
704
|
if not args.dependencies_only:
|
|
578
|
-
print_stderr(
|
|
705
|
+
print_stderr(
|
|
706
|
+
f'Error: No file or folder specified to scan. Please add --dependencies-only to decorate dependency file only.'
|
|
707
|
+
)
|
|
579
708
|
exit(1)
|
|
580
|
-
if not scanner.scan_folder_with_options(".", args.dep, scanner.winnowing.file_map
|
|
709
|
+
if not scanner.scan_folder_with_options(".", args.dep, scanner.winnowing.file_map,args.dep_scope,
|
|
710
|
+
args.dep_scope_inc, args.dep_scope_exc):
|
|
581
711
|
exit(1)
|
|
582
712
|
else:
|
|
583
713
|
print_stderr('No action found to process')
|
|
@@ -664,10 +794,11 @@ def utils_cert_download(_, args):
|
|
|
664
794
|
:param _: ignore/unused
|
|
665
795
|
:param args: Parsed arguments
|
|
666
796
|
"""
|
|
667
|
-
from urllib.parse import urlparse
|
|
668
797
|
import socket
|
|
669
|
-
from OpenSSL import SSL, crypto
|
|
670
798
|
import traceback
|
|
799
|
+
from urllib.parse import urlparse
|
|
800
|
+
|
|
801
|
+
from OpenSSL import SSL, crypto
|
|
671
802
|
|
|
672
803
|
file = sys.stdout
|
|
673
804
|
if args.output:
|
|
@@ -878,6 +1009,46 @@ def comp_versions(parser, args):
|
|
|
878
1009
|
exit(1)
|
|
879
1010
|
|
|
880
1011
|
|
|
1012
|
+
def results(parser, args):
|
|
1013
|
+
"""
|
|
1014
|
+
Run the "results" sub-command
|
|
1015
|
+
Parameters
|
|
1016
|
+
----------
|
|
1017
|
+
parser: ArgumentParser
|
|
1018
|
+
command line parser object
|
|
1019
|
+
args: Namespace
|
|
1020
|
+
Parsed arguments
|
|
1021
|
+
"""
|
|
1022
|
+
if not args.filepath:
|
|
1023
|
+
print_stderr('ERROR: Please specify a file containing the results')
|
|
1024
|
+
parser.parse_args([args.subparser, "-h"])
|
|
1025
|
+
exit(1)
|
|
1026
|
+
|
|
1027
|
+
file_path = Path(args.filepath).resolve()
|
|
1028
|
+
|
|
1029
|
+
if not file_path.is_file():
|
|
1030
|
+
print_stderr(f"The specified file {args.filepath} does not exist")
|
|
1031
|
+
exit(1)
|
|
1032
|
+
|
|
1033
|
+
results = Results(
|
|
1034
|
+
debug=args.debug,
|
|
1035
|
+
trace=args.trace,
|
|
1036
|
+
quiet=args.quiet,
|
|
1037
|
+
filepath=file_path,
|
|
1038
|
+
match_type=args.match_type,
|
|
1039
|
+
status=args.status,
|
|
1040
|
+
output_file=args.output,
|
|
1041
|
+
output_format=args.format,
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
if args.has_pending:
|
|
1045
|
+
results.get_pending_identifications().present()
|
|
1046
|
+
if results.has_results():
|
|
1047
|
+
exit(1)
|
|
1048
|
+
else:
|
|
1049
|
+
results.apply_filters().present()
|
|
1050
|
+
|
|
1051
|
+
|
|
881
1052
|
def main():
|
|
882
1053
|
"""
|
|
883
1054
|
Run the ScanOSS CLI
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
date: 20240917105611, utime: 1726570571
|