From 671f0befacc806bf2870884eefb14e32b9491f44 Mon Sep 17 00:00:00 2001 From: Steven Marks Date: Mon, 4 Nov 2024 13:20:37 +0000 Subject: [PATCH 1/2] fix: error on py3.12 for distutils --- mitreattack/collections/stix_to_collection.py | 25 +------------------ requirements-dev.txt | 1 - setup.py | 3 +-- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/mitreattack/collections/stix_to_collection.py b/mitreattack/collections/stix_to_collection.py index 770c9c47..d3e1ea82 100644 --- a/mitreattack/collections/stix_to_collection.py +++ b/mitreattack/collections/stix_to_collection.py @@ -6,8 +6,6 @@ import traceback from uuid import uuid4 from datetime import datetime -from stix2elevator.stix_stepper import step_bundle -from stix2elevator.options import initialize_options, ElevatorOptions # https://github.com/mitre-attack/attack-stix-data/blob/docs/data-sources/USAGE.md#the-attck-spec X_MITRE_SPEC_VERSION = "2.1.0" @@ -32,28 +30,7 @@ def stix_to_collection(bundle, name, version, description=None): return bundle bundle_version = bundle.get("spec_version", "") - if bundle_version == "2.0": - try: - print( - "[NOTE] - version 2.0 spec detected. Forcibly upgrading the bundle to 2.1 to support " - "collections." - ) - initialize_options(ElevatorOptions(custom_property_prefix="mitre", silent=True)) - working_bundle = step_bundle(working_bundle) - print( - "[NOTE] - NOTICE: ATT&CK in STIX 2.1 includes additional fields which were not present on the " - "STIX 2.0 data. These fields have not been added automatically and their absence may affect " - "compatibility with ingesting software. Please see " - "https://github.com/mitre-attack/attack-stix-data/blob/master/USAGE.md for more information." - ) - except Exception as e: - print( - f"[ERROR] - Unexpected issue encountered when trying to upgrade from 2.0 to 2.1: {e}. " - f"Terminating..." - ) - print(f"[ERROR] - Full Error trace: {traceback.print_exc(e)}") - return None - elif bundle_version != "2.1": + if bundle_version != "2.1": print( f"[ERROR] - version {bundle_version or '[NOT FOUND]'} is not one of [2.0, 2.1]. " f"This module only processes stix 2.0 and stix 2.1 bundles." diff --git a/requirements-dev.txt b/requirements-dev.txt index 9cec17a2..5beeba79 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,7 +12,6 @@ Pillow>=10.1.0 requests>=2.31.0 rich>=13.6.0 stix2>=3.0.1 -stix2-elevator>=4.1.7 tabulate>=0.9.0 taxii2-client>=2.3.0 tqdm>=4.66.1 diff --git a/setup.py b/setup.py index cfab0413..854e1b4b 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="mitreattack-python", - version="3.0.7", + version="3.0.8", author="MITRE ATT&CK, MITRE Corporation", author_email="attack@mitre.org", description="MITRE ATT&CK python library", @@ -52,7 +52,6 @@ "requests", "rich", "stix2", - "stix2-elevator", "tabulate", "taxii2-client", "tqdm", From f2f64e6133084a81fc1f0ceb074db401c319a336 Mon Sep 17 00:00:00 2001 From: Steven Marks Date: Tue, 12 Nov 2024 18:38:05 +0000 Subject: [PATCH 2/2] chore: bump version correctly --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 854e1b4b..67a22c63 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="mitreattack-python", - version="3.0.8", + version="4.0.0", author="MITRE ATT&CK, MITRE Corporation", author_email="attack@mitre.org", description="MITRE ATT&CK python library",