This project simulates a basic Cortex XSOAR playbook and integration that enriches IP addresses using a public threat intelligence API.
- Follows the XSOAR SDK integration format.
- Validates inputs to guard against unexpected behavior.
- Leverages
keyring
for secure API key storage. - Enriches data from AbuseIPDB.
- Supports both local CLI testing and compatibility with XSOAR’s
main()
structure.
git clone https://github.com/Jasmine-Bascom/ip-threat-enrichment-xsoar.git
cd ip-threat-enrichment-xsoar
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python -c "import keyring; keyring.set_password('xsoar', 'abuseipdb_api_key', 'your-api-key')"
Run the enrichment manually from the command line:
python ./Integrations/IPThreatEnrichment/IPThreatEnrichment.py 8.8.8.8
You should see JSON-style enrichment output for the IP address.
If no key is set, you'll see:
Error: API key not found. Please set it using keyring.
This project includes a set of automated tests using pytest to verify core functionality of the integration code.
- Input validation and API interaction logic are tested.
- Tests mock external dependencies (like API key retrieval via
keyring
) to isolate and focus on functionality. - For example, the API key retrieval is mocked in tests to ensure validation logic can be tested independently without requiring an actual API key.
-
Activate your virtual environment:
source venv/bin/activate
-
Run tests with pytest:
pytest
This script uses a format compatible with XSOAR custom integrations:
main()
expects input arguments usingdemisto.args()
- Uses
CommandResults
andreturn_results()
for structured XSOAR output - Outputs include IP, RiskScore, Country, ISP, and Domain
To adapt fully into XSOAR:
- Replace
sys.argv
withdemisto.args()
- Use the
CommonServerPython
import and utilities - Register the integration and test it via XSOAR UI with
!ip-enrich ip=8.8.8.8
ip-threat-enrichment-xsoar/
├── Integrations
│ ├── IPThreatEnrichment
│ ├── __init__.py
│ └── __pycache__
├── Local-Simulation
│ └── mockPlaybook.yml
├── Playbooks
│ ├── playbookBatchIPEnrichment.yml
│ ├── playbookIPEnrichment.yml
│ └── playbookMaliciousIPDecision.yml
├── README.md
├── requirements.txt
├── tests
│ ├── __init__.py
│ ├── __pycache__
│ └── test_ip_enrichment.py
└── venv
├── bin
├── include
├── lib
└── pyvenv.cfg
This project avoids hardcoded credentials. API keys are stored and retrieved using keyring
for secure local development. Inputs are validated using ipaddress
.
This project includes several YAML-formatted playbooks that simulate how threat enrichment workflows could be automated within Cortex XSOAR:
- Playbooks/playbookIPEnrichment.yml
Enriches a single IP address via the custom integration. Ideal for small-scale testing or ad hoc enrichment of specific indicators.
- Playbooks/playbookBatchIPEnrichment.yml
Performs enrichment on a list of IP addresses, simulating ingestion from SIEM alerts or external feeds.
- Playbooks/playbookMaliciousIPDecision.yml
Extends the basic enrichment by evaluating risk scores and branching into actions such as blocklisting or alerting, modeling real-world SOAR workflows.
- Local-Simulation/mockPlaybook.yml
A simplified YAML structure for simulating playbook logic outside of XSOAR. Useful for understanding the basic flow of validation and enrichment in a CLI-friendly format.
This demo was developed without access to a full Cortex XSOAR instance, but it follows official development patterns outlined in xsoar.pan.dev, including Python-based automation, modular structure, and API integration.
With access to a production XSOAR environment, I would expand this project by:
-
Packaging the script as a full custom integration using XSOAR’s integration framework
-
Creating a visual playbook to automate IP enrichment and incident handling
-
Connecting to live data sources (e.g., SIEM, EDR) to trigger the enrichment automatically
-
Storing results in incident fields and tracking enrichment metrics
-
Supporting full end-to-end testing in the XSOAR UI
This project demonstrates my understanding of SOAR principles and readiness to build scalable automations in a production environment.