swimlane / pyattck

A Python package to interact with the Mitre ATT&CK Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON error

priamai opened this issue · comments

Describe the bug

Getting this JSON error:

File ~/DevOps/github/firstorg2023/venv/lib/python3.10/site-packages/requests/models.py:975, in Response.json(self, **kwargs)
    971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1833357 (char 1833356)

To Reproduce


from pyattck import Attck

attack = Attck()

for technique in attack.enterprise.techniques:
    print(technique.id)
    print(technique.name)

Expected behavior
List of techniques.

Screenshots

Desktop (please complete the following information):

  • OS: Linux
  • Pip version: Version: 7.1.2

Additional context
Add any other context about the problem here.

Something is off with the file and how it's generated

image

You can edit the file, change these values to something so the json doesn't break (e.g. empty strings and then load it from local when constructing the Attck object in your code.

commented

Something is off with the file and how it's generated

image

You can edit the file, change these values to something so the json doesn't break (e.g. empty strings and then load it from local when constructing the Attck object in your code.

I also encountered the same problem, may I ask where is the file path you modified?

I changed the path from which it pulls the json file and it works fine:

attack = Attck(enterprise_attck_json="https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json")
print(attack.enterprise.techniques[0].tactics[0].name)