JSONDecodeError with pyattck version 4.0.0 and 4.0.1
amirjalali65 opened this issue · comments
Hi,
Started getting JSONDecodeError
in version 4.0.0
and 4.0.1
:
>>>from pyattck import Attck
>>>attack = Attck()
>>>attack.enterprise.techniques
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../venv/lib/python3.9/site-packages/pyattck/attck.py", line 266, in enterprise
from .enterprise.enterprise import Enterprise
File ".../venv/lib/python3.9/site-packages/pyattck/enterprise/__init__.py", line 1, in <module>
from .enterprise import Enterprise
File ".../venv/lib/python3.9/site-packages/pyattck/enterprise/enterprise.py", line 1, in <module>
from .technique import AttckTechnique
File ".../venv/lib/python3.9/site-packages/pyattck/enterprise/technique.py", line 1, in <module>
from .attckobject import AttckObject
File ".../venv/lib/python3.9/site-packages/pyattck/enterprise/attckobject.py", line 4, in <module>
class AttckObject(object):
File ".../venv/lib/python3.9/site-packages/pyattck/enterprise/attckobject.py", line 17, in AttckObject
nist_controls_json = Configuration.get_data(Configuration.config_data.get('nist_controls_json'))['objects']
File ".../venv/lib/python3.9/site-packages/pyattck/configuration.py", line 108, in get_data
data = cls.__download_url_data(value)
File ".../venv/lib/python3.9/site-packages/pyattck/configuration.py", line 16, in __download_url_data
return request('GET', url, **cls.requests_kwargs).json()
File ".../venv/lib/python3.9/site-packages/requests/models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 4 (char 3)
Same issue here. No idea why since the last change was a few weeks ago. It started yesterday for me.
I just looked at the reference NIST control JSON is gone https://raw.githubusercontent.com/center-for-threat-informed-defense/attack-control-framework-mappings/master/frameworks/nist800-53-r4/stix/nist800-53-r4-controls.json
I’ll try and see why later this evening - currently AFK
All
just a new directory.
just used this config, key difference is the nist_controls_json. Also note r5 is released.
attack = Attck(
nested_subtechniques=True,
save_config=False,
config_file_path='../pyattckEnv/lib/python3.9/site-packages/pyattck/my_configuration.py',
data_path='~/pyattckEnv/lib/python3.9/site-packages/pyattck/data',
enterprise_attck_json="https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json",
pre_attck_json="https://raw.githubusercontent.com/mitre/cti/master/pre-attack/pre-attack.json",
mobile_attck_json="https://raw.githubusercontent.com/mitre/cti/master/mobile-attack/mobile-attack.json",
nist_controls_json="https://raw.githubusercontent.com/center-for-threat-informed-defense/attack-control-framework-mappings/master/frameworks/ATT%26CK-v9.0/nist800-53-r4/stix/nist800-53-r4-controls.json",
generated_attck_json="https://github.com/swimlane/pyattck/blob/master/generated_attck_data.json?raw=True",
generated_nist_json="https://github.com/swimlane/pyattck/blob/master/attck_to_nist_controls.json?raw=True",
#**kwargs
) #attack object to poll att&ck matrix from mitre's repository
and it works.
Awesome! Thanks @lime2992 ! I’ll push an update and see / test if we can upgrade to r5 as well. Thanks for the help all!
@lime2992 @amirjalali65 I just pushed an update to the 4_1_0 branch and it's running through CI now. If all goes well it will be published soon.
This has been resolved and released as part of 4.1.0