|
27 | 27 | import logging
|
28 | 28 | import os
|
29 | 29 | import platform
|
| 30 | +import shutil |
30 | 31 | import sys
|
31 | 32 | import textwrap
|
32 | 33 | import time
|
|
64 | 65 | InvalidExtensionError,
|
65 | 66 | MirrorError,
|
66 | 67 | PDFOutputUnavailable,
|
| 68 | + VEXError, |
67 | 69 | excepthook,
|
68 | 70 | )
|
69 | 71 | from cve_bin_tool.input_engine import InputEngine, TriageData
|
@@ -544,6 +546,13 @@ def main(argv=None):
|
544 | 546 | )
|
545 | 547 |
|
546 | 548 | deprecated_group = parser.add_argument_group("Deprecated")
|
| 549 | + deprecated_group.add_argument( |
| 550 | + "--triage-input-file", |
| 551 | + action="store", |
| 552 | + help="replaced by --vex-file", |
| 553 | + default="", |
| 554 | + ) |
| 555 | + |
547 | 556 | deprecated_group.add_argument(
|
548 | 557 | "-x",
|
549 | 558 | "--extract",
|
@@ -658,6 +667,31 @@ def main(argv=None):
|
658 | 667 | """
|
659 | 668 | LOGGER.warning(warning_nolinux)
|
660 | 669 |
|
| 670 | + # warning about deprecated "--triage-input-file" argument |
| 671 | + if args["triage_input_file"]: |
| 672 | + LOGGER.error( |
| 673 | + " --triage-input-file has been deprecated. Please use --vex-file in future." |
| 674 | + ) |
| 675 | + args["vex_file"] = args["triage_input_file"] |
| 676 | + if args["vex_file"].endswith(".vex"): |
| 677 | + # Auto-switch it to .json |
| 678 | + LOGGER.error(".vex extension no longer supported, please use .json") |
| 679 | + |
| 680 | + file_copy = Path(args["vex_file"] + ".cve-bin-tool-auto.json") |
| 681 | + original_file = Path(args["vex_file"]) |
| 682 | + if not file_copy.exists(): |
| 683 | + LOGGER.error("Trying to make a copy with .json extension for this run.") |
| 684 | + LOGGER.error("You will need to use this copy in future scans.") |
| 685 | + shutil.copy(original_file, file_copy) |
| 686 | + args["vex_file"] = str(file_copy) |
| 687 | + else: |
| 688 | + # abort and let the user deal with it |
| 689 | + LOGGER.error( |
| 690 | + "Looks like a previous run of cve-bin-tool already made a copy." |
| 691 | + ) |
| 692 | + LOGGER.error(f"Try re-running with --vex-file {file_copy}") |
| 693 | + return ERROR_CODES[VEXError] |
| 694 | + |
661 | 695 | # CSVScanner related settings
|
662 | 696 | score = 0
|
663 | 697 | if args["severity"]:
|
|
0 commit comments