Skip to content

[Bug] Support for Python 3.12 - Missing distutils #176

@jessek

Description

@jessek

Expected Behavior

The library should function under Python3.12

Actual Behavior

The library attempts to load the distutils module, which was removed in Python3.12. See https://docs.python.org/3.10/library/distutils.html for background on the deprecation and removal of distutils.

Steps to Reproduce the Problem

  1. Install mitreattack-python with python3 -m pip install mitreattack-python
  2. Run python3 and attempt to load library:
% python3 --version
Python 3.12.4

% python3
Python 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> from mitreattack.navlayers.core import Layer

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jessek/tmp/lib/python3.12/site-packages/mitreattack/__init__.py", line 3, in <module>
    from .collections import *
  File "/Users/jessek/tmp/lib/python3.12/site-packages/mitreattack/collections/__init__.py", line 3, in <module>
    from .stix_to_collection import *
  File "/Users/jessek/tmp/lib/python3.12/site-packages/mitreattack/collections/stix_to_collection.py", line 9, in <module>
    from stix2elevator.stix_stepper import step_bundle
  File "/Users/jessek/tmp/lib/python3.12/site-packages/stix2elevator/__init__.py", line 12, in <module>
    from stix.core import STIXPackage
  File "/Users/jessek/tmp/lib/python3.12/site-packages/stix/__init__.py", line 5, in <module>
    from .base import (Entity, EntityList, TypedCollection, TypedList,  # noqa
  File "/Users/jessek/tmp/lib/python3.12/site-packages/stix/base.py", line 20, in <module>
    from . import utils
  File "/Users/jessek/tmp/lib/python3.12/site-packages/stix/utils/__init__.py", line 382, in <module>
    from .parser import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jessek/tmp/lib/python3.12/site-packages/stix/utils/parser.py", line 7, in <module>
    import mixbox.parser
  File "/Users/jessek/tmp/lib/python3.12/site-packages/mixbox/parser.py", line 5, in <module>
    from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

>>>

Possible Solution

This may be related to #163, and removing support for STIX1 will remove the dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions