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. screenshot

🚀 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

Create Custom Goodware Database (if needed)

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

Generate Rules from Malware Samples (cli)

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

Start as web service

py -m yarobot.app [-g <goodware dbs path>]
app

then locate http://localhost:5000 or use api directly from anywhere:

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 -g <goodware dbs path> \
  --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

  • http-service
  • web interface
  • store regexps in config
  • token merging
  • fix/drop imphash/exports
  • default databases
  • rule generation rewriting
  • tokenizer code separated in different package

📄 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.4.1.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

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

yarobot-0.4.1-py3-none-any.whl (64.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yarobot-0.4.1.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yarobot-0.4.1.tar.gz
Algorithm Hash digest
SHA256 2803e4964fb9dc91b95a83ad0cc077fd270a1d5d7f1c9f7259e1bd1531c2a521
MD5 01f3df224f2f049f8cfbc0f7661acc81
BLAKE2b-256 17e9470132944e05757ed75bcb07f1801ca3481b661888cba08fc5dab2c7e530

See more details on using hashes here.

File details

Details for the file yarobot-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: yarobot-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 64.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yarobot-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed7967c0afbc588cde7e083c71768427fc48f318c5d64bd9eab8bd3048ba93a4
MD5 920d6c4470f4584f9c9d8b9d5651353a
BLAKE2b-256 1bef9166132f3008f13e0804b9098c2e73ad31129c9c6b8b1d296c8f68651e12

See more details on using hashes here.

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