swimlane / pyattck

A Python package to interact with the Mitre ATT&CK Framework
MIT License
468 stars 87 forks source link

JSONDecodeError: Expecting value: line 1 column 1808074 (char 1808073) #137

Closed rafaeldelrey closed 1 year ago

rafaeldelrey commented 1 year ago

Describe the bug Tried to run the example on the main page and got a JSONDecodeError. Tested on a MacBook M2 and Ubuntu, both with Python 3.10 on miniconda environment.

To Reproduce Sample code to enumerate techniques

kastellanos commented 1 year ago

Tracking the problem root cause I got the following:

The problem

The issue was caused by a problematic JSON string, which contained an unexpected value. Specifically, the string was: {"data_source": NaN }. When the sample code attempted to decode this string using the response.json() function from the requests library, it encountered an error due to the unexpected value.

It's important to note that this issue is not specific to the pyattck library, but rather a problem with the JSON format and/or the requests library that uses a json library that shows that error.

To reproduce the error, the sample code tries to use the simplejson==3.19.1 library if it is installed, and falls back to the built-in json library if it is not. In this case, the error only occurred when using simplejson.

Solution

To resolve this issue, you can downgrade the simplejson==3.19.1 library to version simplejson==3.18.4, or remove it altogether. Alternatively, you can modify the JSON string to remove the unexpected value.

MSAdministrator commented 1 year ago

This should be resolved now. Please reopen if not.