A detection engineering workbench with LLM capabilities
Project description
DetectIQ
DetectIQ is an AI-powered security rule management platform that helps create, analyze, and optimize detection rules across multiple security platforms. It can be used with the provided UI, or just with Python scripts using the self contained detectiq/core module. See examples in the examples directory for more information.
- Quickstart
- Current Features
- Road Map
- Screenshots
- Using as a Package
- Environment Configuration
- Development
- Contributing
- License
- Support & Community
- Acknowledgments
⚠️ IMPORTANT DISCLAIMER
This project is currently a Proof of Concept and is under active development:
- Features are incomplete and actively being developed
- Bugs and breaking changes are expected
- Project structure and APIs may change significantly
- Documentation may be outdated or incomplete
- Not recommended for production use at this time
- Security features are still being implemented
We welcome all feedback and contributions, but please use at your own risk!
Quickstart
To get started, run the commands below. For more information, refer to the docs!
Step 1. Clone the repository.
git clone https://github.com/AttackIQ/DetectIQ.git
Step 2. Set your environment variables (using .env.example as a template).
cp .env.example .env
Step 3. Run the provided start.sh script and pass install as an argument.
bash start.sh install
Step 4. Run the provided start.sh script and pass run as an argument.
bash start.sh run
Step 5. Use your favorite browser to navigate to http://localhost:3000.
Current Features
AI-Powered Detection
- Create and optimize detection rules using OpenAI's LLM models
- Intelligent rule suggestions based on context and best practices
- Automated rule validation and testing
- Upload malware samples and PCAP files for static analysis, automatically adding context for YARA and Snort rule creation
- LLM Rule creation analysis and detection logic returned in the rule creation response
Rule Repository Integration
- Enhanced by community-tested repositories:
- SigmaHQ Core Ruleset
- YARA-Forge Rules
- Snort3 Community Ruleset
- Automatically check and update repositories with rule changes
- Vectorize rules for efficient similarity comparison for more context-aware rule creation engine
Static Analysis Integration
- Automated file analysis for YARA rules
- PCAP analysis for Snort rule creation
- Implicit log analysis for Sigma rule optimization (Explicit Analysis Coming Soon)
Multi-Platform Integration
- Automatic Sigma rule translation to various SIEM queries using
pySigmaandSigmAIQwrapper - Seamlessly create Splunk Enterprise Security correlation rules from Sigma rules
Road Map
- Custom/local LLM models, embeddings, and vector stores
- More integrations with SIEMs such as Elastic and Microsoft XDR
- Explicit log analysis for Sigma rule optimization
- Rule testing and validation
- Rule searching, e.g. "Do I have a rule in place that can detect this?"
- Deployment tracking and workflow automation
- Rule management UI Enhancements
- Authentication and Authorization
- Project refactoring for production readiness
- Chatbot (langchain agents) UI with memory
- Docker containerization and deployment
- Rule management without OpenAI requirements
- More non-webapp examples
Screenshots
Rule Dashboard with Splunk Deployment Option
Rule Dashboard with Splunk Deployment Option
Sigma Rule Creation
Sigma Rule Creation from threat report snippet
YARA Rule Creation
YARA Rule Creation using file analysis from uploaded mimikatz.exe sample
Settings Page
Settings Page
About Page
About Page
Using as a Package
DetectIQ can be installed as a Python package from PyPI:
pip install detectiq
This allows you to leverage DetectIQ's detection rule management capabilities in your own Python projects:
import asyncio
from typing import cast
import os
# Set OpenAI API key
os.environ["OPENAI_API_KEY"] = "your-api-key"
from langchain.schema.language_model import BaseLanguageModel
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from detectiq.core.llm.yara_rules import YaraLLM
from detectiq.core.llm.toolkits.base import create_rule_agent
from detectiq.core.llm.toolkits.yara_toolkit import YaraToolkit
async def main():
# Initialize LLMs
agent_llm = cast(BaseLanguageModel, ChatOpenAI(temperature=0, model="gpt-4o"))
rule_creation_llm = cast(BaseLanguageModel, ChatOpenAI(temperature=0, model="gpt-4o"))
# Initialize YARA tools
yara_llm = YaraLLM(
embedding_model=OpenAIEmbeddings(model="text-embedding-3-small"),
agent_llm=agent_llm,
rule_creation_llm=rule_creation_llm,
rule_dir="./rules",
vector_store_dir="./vectorstore",
)
# Create agent
yara_agent = create_rule_agent(
rule_type="yara",
vectorstore=yara_llm.vectordb,
rule_creation_llm=yara_llm.rule_creation_llm,
agent_llm=yara_llm.agent_llm,
toolkit_class=YaraToolkit,
)
# Create a rule
result = await yara_agent.ainvoke({"input": "Create a YARA rule to detect ransomware"})
print(result.get("output"))
if __name__ == "__main__":
asyncio.run(main())
For more detailed examples, see the examples directory.
For instructions on publishing the package to PyPI, see PUBLISHING.md.
Environment Configuration
DetectIQ uses environment variables for configuration. A comprehensive example with documentation is provided in .env.example.
To configure the application:
-
Copy the example file to
.env:cp .env.example .env
-
Edit the
.envfile with your specific settings:# Required for LLM functionality OPENAI_API_KEY=your-api-key-here # Optional configurations LOG_LEVEL=INFO DEBUG=False
-
The same
.envfile can be used for both the web application and the examples.
Development
DetectIQ includes a comprehensive Makefile to assist with development, testing, and publishing tasks.
Prerequisites
Before development, ensure you have:
- Python 3.9+ installed
- Poetry installed
- Required development dependencies:
make install-dev
This will install all development dependencies, including:
- Testing tools (pytest)
- Code quality tools (black, ruff)
- Package building tools (build, twine)
- Keyring backends (keyrings.alt) for token management
Makefile Commands
To view all available commands:
make help
Common Development Commands
# Installation
make install/local # Complete local installation (backend + frontend)
# Running the application
make run/local # Run both backend and frontend servers
# Code quality
make format # Format Python files using black
make ruff # Run Ruff linter
make test # Run tests with coverage
# Package management
make update # Update dependencies
make version # Display current version
make version-patch # Bump patch version (0.0.X)
make version-minor # Bump minor version (0.X.0)
make version-major # Bump major version (X.0.0)
# PyPI publishing
make pypi-build # Build package for PyPI
make pypi-check # Check package with twine
make pypi-publish # Publish to PyPI
For more details on publishing the package, see PUBLISHING.md.
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project uses multiple licenses:
- Core Project: LGPL v2.1
- Sigma Rules: Detection Rule License (DRL)
- YARA Rules: YARAForge License
- Snort Rules: GPL with VRT License
Support & Community
- Join our SigmaHQ Discord for discussions
- Report issues via GitHub Issues
Acknowledgments
- SigmaHQ Community
- YARA-Forge Contributors
- Snort Community
- OpenAI for GPT-4o Integration
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file detectiq-0.1.24.tar.gz.
File metadata
- Download URL: detectiq-0.1.24.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.2 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6809d6e0eeccddfb0fe5f8411647d5775c61dd9d9afccde0b63deab5193b160f
|
|
| MD5 |
7626acf61c0a02ea291269343005ac9f
|
|
| BLAKE2b-256 |
4c5c9c05573f730f8672457cac85473e969bd65580d3b10ce02f4704b3960ea1
|
File details
Details for the file detectiq-0.1.24-py3-none-any.whl.
File metadata
- Download URL: detectiq-0.1.24-py3-none-any.whl
- Upload date:
- Size: 1.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.2 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6c0d27f3a48ac70bc30c1e59a0dbcddd5721e61033a35315277f217efd83b4c
|
|
| MD5 |
ed6600368fba5ddb0c4f4e58bd7bb524
|
|
| BLAKE2b-256 |
e0000afcb0907ff447a7d45ac04cedfeec971186cbe6ac510a40a79050357a89
|