The response is not in JSON
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 491
- Forks
- 290
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 3
Description
Hi Team Pymisp,
I'm trying to send events to Azure Sentinel but receive the error Unknown error: the response is not in JSON.
Config.py content excluding graph_auth
targetProduct = 'Azure Sentinel'
misp_event_filters = []
action = 'alert'
passiveOnly = False
days_to_expire = 30
misp_key = 'XXXXXXXXXXXXXX'
misp_domain = 'XXXXXXXXXXXXXXXXX'
misp_verifycert = False
Error Log
(mispToSentinel) XXX@XXX:~/mispToSentinel/security-api-solutions/Samples/MISP$ sudo python3 script.py
fetching & parsing data from misp...
Unknown error: the response is not in JSON.
Something is broken server-side, please send us everything that follows (careful with the auth key):
Request headers:
{'User-Agent': 'PyMISP 2.4.144 - Python 3.6', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Cookie': 'MISP-2906f9eb-3ab4-4838-8a5b-6c42305b4b8c=r4vcgpirqpcbve8onbfhoroi6n', 'Content-Length': '265', 'Authorization': '', 'content-type': 'application/json'}
Request body:
{"returnFormat": "json", "withAttachments": 0, "metadata": 0, "enforceWarninglist": 0, "includeEventUuid": 0, "includeEventTags": 0, "sgReferenceOnly": 0, "includeContext": 0, "headerless": 0, "includeSightings": 0, "includeDecayScore": 0, "includeCorrelations": 0}
Response (if any):
Traceback (most recent call last):
File "script.py", line 100, in <module>
main()
File "script.py", line 69, in main
events = _get_events()
File "script.py", line 16, in _get_events
return [event['Event'] for event in misp.search(controller='events', return_format='json')]
File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 2473, in search
normalized_response = self._check_json_response(response)
File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 3400, in _check_json_response
r = self._check_response(response, expect_json=True)
File "/usr/local/lib/python3.6/dist-packages/pymisp/api.py", line 3417, in _check_response
raise MISPServerError(f'Error code 500:\n{response.text}')
pymisp.exceptions.MISPServerError: Error code 500:
Can you help?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with script.py at _get_events and trace the call into pymisp/api.py, especially _check_json_response and _check_response. Reproduce the request and inspect the server response and relevant MISP logs; done means identifying why the events request returns HTTP 500 with no JSON and documenting a confirmed cause or fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100