MISP Exercise 4
Last updated
Last updated
In this Lab you are going to interact with the REST API from your MISP instance. It is important to understand how this works, because many of the tools accessing MISP are doing it through the API. This would also allow you to automate certain steps or workflows in MISP.
The goal is to see what the MISP REST API has to offer and develop some queries.
Start docker image
cd /home/hacker/misp-docker-image docker-compose up
Login with the following credentials:
LAB URL: http://misp.localhost
User: investigator@misp-lab4.com Password: compass
An API stands for Application Programming Interface. This interface allows different application to communicate with each other. They can share data and execute actions over an API. As an example a monitoring system could get the 10 most recent event from MISP via it's API and then display this information in the monitoring system for the user.
This is just one examples, there are so many more. APIs are also often used to automate a workflow that is boring to to manually by hand.
The MISP API Documentatio can be found here: https://www.misp-project.org/documentation/openapi.html#operation/addEvent
The API does not let just anyone create events on your MISP instance. As you may have seen in the OpenAPI documentation, you need an AuthKey to confirm that you are indeed permitted to do this call.
Open your profile by clicking Global Actions -> My Profile
We have to generate a new authentication key, because the key that was created on initial install can no longer be viewed by the user. Therefore we will now create a new key.
Click on Auth keys
, then Add authentication key
and select the user investigator@misp-lab4.com. You can optionally add a comment, allowed IPs and an expiration data. Empty fields also work. Click submit to generate the key.
Authkey: Qn0YLxykel69UDOEFL3bChiQ9vqfRzvpx7Vj4Oie
Paste the following command into your shell:
JSON Output:
The command above did create a new Event in our MISP Instance:
cd /home/hacker/Desktop/ take misp-python pipenv --python 3 shell pipenv install pymisp touch misp-script.py code . pip3 install pymisp
Python code:
Check the newly created MISP Event: