Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: error on py3.12 for distutils #181

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions mitreattack/collections/stix_to_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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."
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="mitreattack-python",
version="3.0.7",
version="4.0.0",
author="MITRE ATT&CK, MITRE Corporation",
author_email="[email protected]",
description="MITRE ATT&CK python library",
Expand Down Expand Up @@ -52,7 +52,6 @@
"requests",
"rich",
"stix2",
"stix2-elevator",
"tabulate",
"taxii2-client",
"tqdm",
Expand Down