/MISP-TAXII-Forwarder

MISP to TAXII STIX Forwarder

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

MISP to TAXII STIX Forwarder

This script is designed to fetch Cyber Threat Intelligence (CTI) data from MISP (Malware Information Sharing Platform), convert the data to STIX (Structured Threat Information eXpression) format, and then forward the STIX package to a TAXII (Trusted Automated eXchange of Indicator Information) server. This allows organizations to share threat intelligence in a standardized format, which improves interoperability and threat detection capabilities. Requirements

Python 3
PyMISP: pip install pymisp
python-stix: pip install python-stix
python-cabby: pip install python-cabby

Usage

Edit the configuration variables in the script, such as misp_api_key, misp_url, tag_to_search, and the TAXII server configuration.

Run the script using python script_name.py. The script will continuously monitor MISP for new events and forward them to the TAXII server as they are found.

How the Script Works

The script starts by initializing a PyMISP object to interact with the MISP instance and a log function to log messages.

In the main loop, the script reads a list of previously processed event IDs from a file (processed_events_ids.txt). If the file does not exist, an empty set is created.

The script fetches all events with the specified tag from the MISP instance that have not been processed yet.

For each new event, the script iterates through its attributes and creates corresponding STIX indicators. These indicators are added to a STIX package.

The script saves the STIX package to an XML file.

The script pushes the STIX package to the configured TAXII server.

The script updates the list of processed event IDs and saves it back to the file.

The script sleeps for a specified duration (e.g., 30 minutes) before starting the loop again.

Key Functions

get_misp_events: Fetches events with the specified tag from MISP.
process_events: Converts MISP events to STIX indicators and adds them to a STIX package.
save_stix_package_to_file: Saves a STIX package to an XML file.
push_stix_package_to_taxii: Pushes a STIX package to a TAXII server.

Customization

To customize the script for your specific use case, you can modify the configuration variables at the top of the script, as well as the specific attribute types that are processed and converted to STIX indicators. You can also customize the sleep duration between checking for new events.