Skip to main content

YARA generator inspired by yarGen

Project description

yarobot

License: GPL v3 Python Version Rust

yarobot is a high-performance YARA rule generator inspired by yarGen, designed to automatically create quality YARA rules from malware samples while minimizing false positives through intelligent goodware database comparison.

🚀 Features

  • Automated YARA Rule Generation: Create both simple and super rules from malware samples
  • Intelligent Scoring System: Advanced string scoring with goodware database comparison
  • High Performance: Core engine written in Rust for maximum speed

🛠 Installation

Install from PyPI

pip install yarobot

Build Prerequisites

  • Python 3.11 or higher
  • Rust toolchain (for building the native extension)

Install from Source

git clone https://github.com/ogre2007/yarobot
cd yarobot
pip install .

📖 Quick Start

1. Update Goodware Databases

yarobot update-remote # from yarGen project. Doenst work yet. Just go to ex. 3

2. Generate Rules from Malware Samples

py -m yarobot.generate /path/to/malware/samples --output-rule-file my_rules.yar

3. Create Custom Goodware Database

py -m yarobot.database create /path/to/goodware/files --recursive

🎯 Usage Examples

Basic Rule Generation

py -m yarobot.generate /malware/samples \
  --min-size 8 \
  --max-size 128 \
  --min-score 5 \
  --output-rule-file detection_rules.yar

Start as service

server-side:

py -m yarobot.service

client-side:

curl -X POST -F "files=@tests\\data\\binary" http://localhost:5000/api/analyze -F "min_score=5" -F "get_opcodes=true"

Advanced Configuration

py -m yarobot.generate /malware/samples \
  --opcodes \
  --recursive \
  --author "My Security Team" \
  --ref "Internal Investigation 2024" \
  --superrule-overlap 5 \
  --strings-per-rule 15

Database Management

# Update existing database with new goodware samples
(TODO) py -m yarobot.database update /path/to/new/goodware --identifier corporate 

# Create new database from scratch
py -m yarobot.database create /path/to/goodware --opcodes

🔧 Configuration Options

Rule Generation Options

  • --min-size, --max-size: String length boundaries
  • --min-score: Minimum string score threshold
  • --opcodes: Enable opcode feature for additional detection capabilities
  • --superrule-overlap: Minimum overlapping strings for super rule creation
  • --recursive: Scan directories recursively
  • --excludegood: Force exclusion of all goodware strings
  • --oe: only executable extensions

Database Options

  • --identifier: Database identifier for multi-environment support
  • --update: Update existing databases with new samples
  • --only-executable: Only process executable file extensions

🏗 Architecture

yarobot combines the performance of Rust with the flexibility of Python:

Core Components

  • Rust Engine (yarobot-rs): High-performance file processing and string analysis
  • Python Interface: CLI management, database operations, and rule formatting
  • Scoring Engine: Intelligent string scoring with goodware comparison
  • Rule Generator: YARA rule synthesis and optimization

Database Structure

  • good-strings.db: Common strings from goodware samples
  • good-opcodes.db: Opcode frequency database
  • good-imphashes.db: Import hash database
  • good-exports.db: Export function database

🤝 Contributing

We welcome contributions!

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

TODO

  • dropzone mode
  • http-service
  • fix/drop imphash/exports
  • default databases
  • rule generation rewriting
  • tokenizer code separated in different package
  • dex opcode extraction

📄 License

This project is licensed under the GPLv3 License - see the LICENSE file for details.

🙏 Acknowledgments

  • Based on yarGen by Florian Roth
  • Built with Pyo3 for Python-Rust integration
  • Uses goblin for binary parsing

📞 Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yarobot-0.2.2.tar.gz (998.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

yarobot-0.2.2-cp313-cp313-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.13Windows x86-64

yarobot-0.2.2-cp313-cp313-manylinux_2_34_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

File details

Details for the file yarobot-0.2.2.tar.gz.

File metadata

  • Download URL: yarobot-0.2.2.tar.gz
  • Upload date:
  • Size: 998.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for yarobot-0.2.2.tar.gz
Algorithm Hash digest
SHA256 812921b03d1d58b210f50552e186d9d81d770f3356907e306c7e8e301cc951b9
MD5 d1c7c64a212b922f5f7bbcc8aef30441
BLAKE2b-256 a5bffebb69871457f0299dc3b6b9304f7a09d24e4af8362aceaaa7585cd50b1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for yarobot-0.2.2.tar.gz:

Publisher: python-publish.yml on ogre2007/yarobot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yarobot-0.2.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: yarobot-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for yarobot-0.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 63976c90b77a06f3eae376637dfdbe875924a0616103f7e5bf2838faf5f11383
MD5 5441abc04859ec157052c81f44e161de
BLAKE2b-256 695847c6576fbe2ac326d667cd40c819be1436d5a90c2f45c2daa7e225f32e00

See more details on using hashes here.

File details

Details for the file yarobot-0.2.2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for yarobot-0.2.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 70a7dfa5dcf97a0f71b4ec4faa243834f30a13e9d5856de06863ca58080dbf51
MD5 5227538e6a576b1ae41a6bdf01fe374b
BLAKE2b-256 b0a009d7c6cf9bd1596f54a28c6282a02a8db328307e298edb5612c88c337d54

See more details on using hashes here.

Provenance

The following attestation bundles were made for yarobot-0.2.2-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: python-publish.yml on ogre2007/yarobot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page