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

TypeError: 'NoneType' object is not callable for basic example #125

Closed
SilverJan opened this issue Nov 2, 2022 · 8 comments · Fixed by #130
Closed

TypeError: 'NoneType' object is not callable for basic example #125

SilverJan opened this issue Nov 2, 2022 · 8 comments · Fixed by #130
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@SilverJan
Copy link

Describe the bug

When executing the basic example from https://pyattck.readthedocs.io/en/latest/ics/icsattck.html, an Exception is thrown.

To Reproduce

~ python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyattck import Attck
>>> attack_mitre = Attck()
>>> technique_list = attack_mitre.ics.techniques
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jan/.local/lib/python3.8/site-packages/pyattck/attck.py", line 289, in ics
    from .ics import ICSAttck
  File "/home/jan/.local/lib/python3.8/site-packages/pyattck/ics.py", line 7, in <module>
    class ICSAttck(Base):
  File "/home/jan/.local/lib/python3.8/site-packages/pyattck/ics.py", line 42, in ICSAttck
    __attck = MitreAttck(**Base.config.get_data("ics_attck_json"))
  File "/home/jan/.local/lib/python3.8/site-packages/pyattck_data/attack.py", line 55, in __init__
    raise te
  File "/home/jan/.local/lib/python3.8/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 "/home/jan/.local/lib/python3.8/site-packages/pyattck_data/attack.py", line 66, in __attrs_post_init__
    raise te
  File "/home/jan/.local/lib/python3.8/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

Expected behavior

No error

Screenshots

see logs above

Desktop (please complete the following information):

Ubuntu 20.04, python3

Additional context
Add any other context about the problem here.

@kastellanos
Copy link

It seems like the past month was released a new STIX object. The campaigns https://attack.mitre.org/campaigns/

What I found is that is not yet implemented on the pyattck-data lib.
https:/swimlane/pyattck-data/blob/e704a5c46d916ee3fb898b8c16902d8e7035fbe4/src/pyattck_data/attack.py#L27

@Derekt2
Copy link

Derekt2 commented Nov 7, 2022

is there a workaround?

@driesbuyck
Copy link

is there a workaround?

A very dirty hack I put in just to get my scripts working for now is to comment out the 'raise re' on line 66 in the file site-packages/pyattck_data/attack.py and replace it with a print statement until the repo owner can put out a fix.
image

@adamcysec
Copy link

This issue is still present. Pyattck is currently unusable.

@acasanova99
Copy link

I have opened this question on stack overflow.

The module is unusable due to this issue ATTOW

@MSAdministrator
Copy link
Collaborator

@SirSkizo thus will be resolved once this gets merged in swimlane/pyattck-data#80

@acasanova99
Copy link

Just in case anyone still troubleshooting with this issue:

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

I think you can close this issue. Thanks you all !!

@MSAdministrator
Copy link
Collaborator

This is being resolved in #130 - just waiting on tests to pass and then will merge

@MSAdministrator MSAdministrator self-assigned this Feb 10, 2023
@MSAdministrator MSAdministrator added bug Something isn't working enhancement New feature or request labels Feb 10, 2023
@MSAdministrator MSAdministrator linked a pull request Feb 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants