MISP / PyMISP

Python library using the MISP Rest API
Other
431 stars 278 forks source link

MISP Server Error while using PyMISP API Script #905

Open SurajPatel06 opened 1 year ago

SurajPatel06 commented 1 year ago

Unable to connect to the MISP Software using the Py MISP API along with the Authorization Key and username, Facing Errors as mentioned below while trying to do the same activity:

MISPServerError: Error code 500: {"name":"An Internal Error Has Occurred.","message":"An Internal Error Has Occurred.","url":"\/servers\/getVersion"}

PyMISPError: Unable to connect to MISP (https://1**.*0*.**.**0/). Please make sure the API key and the URL are correct (http/https is required): Error code 500: {"name":"An Internal Error Has Occurred.","message":"An Internal Error Has Occurred.","url":"\/servers\/getVersion"}

Unable to access the software setup as well: Error: An Internal Error Has Occurred. Please try your action again. If the problem persists, please contact administrator.

aliekberkara commented 3 months ago

I'm having the same problem.

Rafiot commented 3 months ago

That's not enough details for me to help you in any way.

When you get a 500 error, it means the instance is not working at all. Is the web interface working for you? And if yes, please go look at the logs to see why you're getting a 500.

aliekberkara commented 3 months ago

Misp and OpenCTI work smoothly on my 1...13 and 1...10 servers. I want to integrate Misp into OpenCTI. I do this via portainer. I made the settings of the Misp Connector in the docker-compose.yml file via Portainer. However, although the Misp Connector appears to be working, there is no data flow. When I examine the logs, I encounter the following error. That's my problem.

{"timestamp": "2024-05-22T12:46:47.153598Z", "level": "ERROR", "name": "MISP", "message": "Error fetching misp event again: Error code 500:\n{\"name\":\"An Internal Error Has Occurred.\",\"message\":\"An Internal Error Has Occurred.\",\"url\":\"\\/events\\/restSearch\"}", "exc_info": "Traceback (most recent call last):\n File \"/opt/opencti-connector-misp/misp.py\", line 393, in run\n events = self.misp.search(\"events\", **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 2755, in search\n normalized_response = self._check_json_response(response)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 3706, in _check_json_response\n r = self._check_response(response, expect_json=True)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 3725, in _check_response\n raise MISPServerError(f'Error code 500:\\n{response.text}')\npymisp.exceptions.MISPServerError: Error code 500:\n{\"name\":\"An Internal Error Has Occurred.\",\"message\":\"An Internal Error Has Occurred.\",\"url\":\"\\/events\\/restSearch\"}\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/opt/opencti-connector-misp/misp.py\", line 401, in run\n events = self.misp.search(\"events\", **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 2755, in search\n normalized_response = self._check_json_response(response)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 3706, in _check_json_response\n r = self._check_response(response, expect_json=True)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.11/site-packages/pymisp/api.py\", line 3725, in _check_response\n raise MISPServerError(f'Error code 500:\\n{response.text}')\npymisp.exceptions.MISPServerError: Error code 500:\n{\"name\":\"An Internal Error Has Occurred.\",\"message\":\"An Internal Error Has Occurred.\",\"url\":\"\\/events\\/restSearch\"}"}

Rafiot commented 3 months ago

yeah, there is nothing I can tell you with that stack trace.

But the call seems to be coming from that script: /opt/opencti-connector-misp/misp.py, so I'll invite you to get in touch with the developers.