Developed by: Q.A
The Splunk2Sigma Converter is a web-based tool designed to convert Splunk search queries (savedsearches.conf) into Sigma rules (.yml format). It leverages AI to ensure that complex Splunk queries are accurately transformed into Sigma rules. The tool includes a custom validator that enhances the generated Sigma rule by checking for common issues and providing auto-corrections. This custom validation process helps ensure that the Sigma rules are both accurate and compliant with Sigma standards, reducing the need for manual fixes.
This tool is particularly useful for threat detection engineers and cybersecurity professionals who need to standardize and share detection rules across different SIEM (Security Information and Event Management) systems.
- AI-Powered Conversion: Utilizes OpenAI to convert Splunk
savedsearches.confqueries into Sigma rule YAML format. - Custom Validation: Includes a custom validation process that automatically detects and corrects common issues in the generated Sigma rules, ensuring they adhere to Sigma standards.
- Error Handling: If the custom validator detects unresolved issues, the rule is sent back to the AI for correction, ensuring higher accuracy and compliance.
- Responsive Design: Built using Bootstrap, ensuring compatibility across various devices.
├── config.py # Configuration file for the API key and other settings
├── convert.py # Main Flask application file that handles the conversion and validation logic
├── requirements.txt # List of dependencies required for the backend
├── Procfile # Heroku-specific file for defining the type of application
├── temp_sigma_rule.yml # Temporary file used for validation
├── test_rule.yml # Sample Sigma rule for testing purposes
├── .github/
│ └── workflows/
│ └── deploy.yml # GitHub Actions workflow for deploying the frontend
├── index.html # Main HTML file for the frontend interface
├── script.js # JavaScript file for handling frontend logic and API communication
├── style.css # Custom CSS file for styling the frontend
└── README.md # This file
-
Clone the repository:
git clone https://github.com/QA-Cyber/Splunk2Sigma.git cd Splunk2Sigma -
Set up a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up environment variables:
-
Create a
.envfile in the root of your project with your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
-
-
Run the Flask app:
python convert.py
-
Access the app:
- Open your browser and go to
http://127.0.0.1:5000.
- Open your browser and go to
-
Modify the
script.js:-
Update the
fetchrequest URL to point to your local backend:const response = await fetch('http://127.0.0.1:5000/convert', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ splunkInput, backend, format }) });
-
-
Open the
index.htmlfile:- You can directly open this file in a web browser. The frontend will now interact with the backend running on your local machine.
-
Input the Splunk Query:
- In the
savedsearch.conftext area, input your Splunk query.
- In the
-
Select Query Language & Format:
- The default settings are
Splunkandsavedsearches.conf, respectively.
- The default settings are
-
Convert:
- Click on the
Convertbutton. The Sigma rule will be generated and validated automatically.
- Click on the
-
View the Sigma Rule:
- The converted Sigma rule will be displayed on the right side, along with the validation status.
-
CORS Errors:
- Ensure the CORS settings in the Flask app (
convert.py) allow requests from your frontend origin. You can configure it by updating theCORSsettings to allow requests from your specific frontend URL.
- Ensure the CORS settings in the Flask app (
-
Validation Errors:
- If Sigma rule validation fails, ensure that the generated rule adheres to the correct Sigma format. You might need to manually adjust the generated rule or refine the input query.
-
Backend Logs:
-
You can view the logs of your Flask app to debug any issues:
flask run --reload
-
-
Browser Console:
- Use the browser’s developer tools to inspect any network requests or errors. This is useful for debugging issues with the frontend or API communication.
If you would like to contribute to the Splunk2Sigma Converter project, please follow the steps below:
-
Fork the repository:
- Click on the "Fork" button at the top right of this repository's GitHub page.
-
Create a new branch:
-
Create a new branch for your feature or bugfix:
git checkout -b feature-name
-
-
Make your changes:
- Implement your feature or bugfix in your branch.
-
Commit your changes:
-
Add and commit your changes with a descriptive commit message:
git add . git commit -m "Description of the feature or fix"
-
-
Push to your branch:
-
Push your changes to your forked repository:
git push origin feature-name
-
-
Create a Pull Request:
- Go to the original repository on GitHub, and click on the "Pull Requests" tab.
- Click the "New Pull Request" button, and select your branch from your forked repository.
- Provide a clear description of your changes and submit the pull request.
Thank you for contributing to the project!
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in accordance with the terms of the license.
For more details, please refer to the LICENSE file in the repository.
For any questions, suggestions, or issues, please feel free to open an issue in this repository.
You can also follow and interact with the project on GitHub Pages: Splunk2Sigma.
Developed by: Q.A