rushter

hexora: Detect Malicious Python Code with Ruff and ML

Hexora scans Python code for malicious patterns using rule-based analysis, a file-level machine-learning score, and the AST parser from Astral's Ruff. It is aimed at security teams auditing packages, dependencies, and suspicious scripts.

View on GitHub Compare
Stars
173
Forks
9
Stars, last 30 days
+0
Last commit
20 days ago
Contributors
2

Our take

Activeregular commits and releases

Health score

34/100

How it is scored
Activity
59
Community
11
Issues
46
Pull requests
20

+0 stars in the last 30 days

  • Fewer contributors than 86% of the projects we track

Hexora is an actively maintained, focused Python malware-analysis tool, but adoption should account for its very concentrated contributor base and the need to validate findings in context.

Good fit if

  • You need rule-level findings and file-level scoring to help triage potentially malicious Python code.
  • Your security workflow includes auditing packages, scripts, or virtual environments and can review confidence-based results.
  • You can work with its Python 3.9+ and Rust 1.95 requirements and MIT-licensed code.

Look elsewhere if

  • You need a general-purpose Python linter rather than tooling focused on malicious behavior.
  • Your team requires development effort to be distributed across multiple active contributors. Most project contributions come from one person.
  • You need a tool whose detection is fully explained by rules, rather than one that also produces a machine-learning score.
All health signals
Last commit2026-10-10 (20 days ago)
Commits, last 90 days38
Releases, last 12 months7 (latest v0.3.2, 2026-10-10)
Contributors2 (top contributor: 99% of commits)
Issues closed, last 90 days1
Pull requests merged, last 90 days0
Project age15 months

Checked on 2026-10-31 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

173

Forks

9

Change since Nov 13, 2026: 0 stars·0 forks

Overview

Hexora is a static analysis tool for detecting malicious and harmful patterns in Python code. It combines a rule-based engine with a machine-learning model that scores whole files, and uses the AST parser from Astral's Ruff to parse code. The project is implemented in Rust and provides a Python package and command-line interface for analyzing Python source.

It is designed for security audits where suspicious behavior may appear in a package or script, including supply-chain investigations and review of newly uploaded PyPI packages. Findings include rule codes, source locations, descriptions, and confidence levels, helping analysts distinguish stronger signals from potentially legitimate uses of sensitive APIs.

Key Features

  • Scans individual Python files, directories, and installed packages.
  • Combines specific static-analysis rules with a machine-learning score for each file.
  • Reports findings with source locations, rule identifiers, explanations, and confidence levels.
  • Includes rules for execution, obfuscation, data access, exfiltration, suspicious imports, and install hooks.
  • Supports filtering by confidence and excluding selected rule codes to reduce noise.
  • Offers both a hexora command-line interface and Python functions for auditing paths or files.
  • Includes a Cargo-based benchmarking command for evaluating rules against a malicious-package dataset.

Use Cases

  • Security engineers can scan dependencies or virtual-environment packages when investigating a possible supply-chain attack.
  • Package maintainers can review a Python project before release for suspicious execution, data access, or install hooks.
  • Incident responders can inspect scripts and indicators collected from malicious-code investigations.
  • Analysts monitoring PyPI can use Hexora to triage newly published packages for suspicious behavior.

What you need

Detected in the repository

  • Python >=3.9 (from pyproject.toml)
  • Rust 1.95 or newer (from Cargo.toml)
  • Automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install with Python 3.9 or later:

pip install hexora

Then run hexora --help or audit a file with hexora audit path/to/file.py. See the repository README for options, Python API examples, and rule details.

Considerations

The project is active, with regular commits and releases, but its work is highly concentrated in one of its two contributors. Recent issue handling is limited in the supplied activity data, and no pull requests were merged in the measured period. The supplied project facts also report no test suite, so teams adopting it should assess detection behavior against their own code and known samples. Hexora's confidence levels are not proof of malicious intent: the README notes that some flagged behavior also has legitimate uses. The required Rust toolchain is relevant alongside the Python runtime, particularly for development or Cargo-based benchmarking.

Found this useful?

Share it with someone who would like hexora.

Comparisons