Impossible to retrieve data form pyattck module

Question:

I am using the pyattck module to retrieve information from mitre att&ck.

Versions:

      - pyattck==7.0.0
      - pyattck-data==2.5.2

Then, I just created a simple main.py file to test the module.

from pyattck import Attck

def main():
    attck = Attck()

    for technique in attck.enterprise.techniques:
        print(technique.name)

if __name__ == '__main__':
    main()

When running the main.py script I get the following exception:

Traceback (most recent call last):
  File "/<path>/main.py", line 15, in <module>
    main()
  File "/<path>/main.py", line 8, in main
    for technique in attck.enterprise.techniques:
  File "/<path_venv>/lib/python3.10/site-packages/pyattck/attck.py", line 253, in enterprise
    from .enterprise import EnterpriseAttck
  File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 7, in <module>
    class EnterpriseAttck(Base):
  File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 42, in EnterpriseAttck
    __attck = MitreAttck(**Base.config.get_data("enterprise_attck_json"))
  File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 55, in __init__
    raise te
  File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 53, in __init__
    self.__attrs_init__(**kwargs)
  File "<attrs generated init pyattck_data.attack.MitreAttck>", line 14, in __attrs_init__
  File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 66, in __attrs_post_init__
    raise te
  File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 62, in __attrs_post_init__
    data = TYPE_MAP.get(item['type'])(**item)
TypeError: 'NoneType' object is not callable

Anyone knows where is the issue? Maybe I have forgotten to import something? It would be helpful to know if this module actually works in another version. This one is the lasted stable one ATTOW.

UPDATE
There is am issue with this project. Mitre added some new features that are not supported by the module and make it unusable.

There is an issue on github related to this.

Asked By: A.Casanova

||

Answers:

They have already fixed this issue in future releases. You just need to update your package pyattck-data form the bugged version 2.5.2 to 2.6.1 (or any newer).

If you are using pip, just run this:

pip install --upgrade pyattck-data 

If you are using conda (inside your venv):

conda update pyattck-data
Answered By: A.Casanova
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.