tessl install tessl/pypi-pymisp@2.5.0Python API for MISP threat intelligence platform enabling programmatic access to MISP instances.
Agent Success
Agent success rate when using this tile
96%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.25x
Baseline
Agent success rate without this tile
77%
Build a simple command-line tool for managing threat intelligence events in a MISP instance. The tool should support creating, retrieving, updating, publishing, and deleting events.
The tool should implement the following functionality:
Create a Python module event_manager.py that provides the following functions:
Each function should properly handle errors and return appropriate success/failure indicators.
from typing import Optional, Dict, Any
def init_connection(url: str, api_key: str) -> Any:
"""
Initialize connection to MISP instance.
Args:
url: MISP instance URL
api_key: API authentication key
Returns:
Connected MISP client instance
"""
def create_event(client: Any, info: str, threat_level: str, distribution: int = 1) -> Dict[str, Any]:
"""
Create a new event in MISP.
Args:
client: MISP client instance
info: Event description/title
threat_level: Threat level (high, medium, low, undefined)
distribution: Distribution level (0-4)
Returns:
Created event data with id and other properties
"""
def get_event(client: Any, event_id: Any) -> Dict[str, Any]:
"""
Retrieve event by ID or UUID.
Args:
client: MISP client instance
event_id: Event ID or UUID
Returns:
Event details dictionary
"""
def update_event(client: Any, event_id: Any, **updates) -> Dict[str, Any]:
"""
Update an existing event.
Args:
client: MISP client instance
event_id: Event ID or UUID
**updates: Key-value pairs of properties to update
Returns:
Updated event data
"""
def publish_event(client: Any, event_id: Any, send_alert: bool = False) -> bool:
"""
Publish an event for distribution.
Args:
client: MISP client instance
event_id: Event ID or UUID
send_alert: Whether to send email alerts
Returns:
True if successful, False otherwise
"""
def delete_event(client: Any, event_id: Any) -> bool:
"""
Delete an event from MISP.
Args:
client: MISP client instance
event_id: Event ID or UUID
Returns:
True if successful, False otherwise
"""@generates
Python library for interacting with MISP threat intelligence platform.
@satisfied-by