Skip to main content

Detects banned/insecure functions in binary files using radare2 decompilers.

Project description

BannedFuncDetector

BannedFuncDetector

Detect banned/insecure functions in binary files using radare2 decompilers

PyPI Version Python Versions License CI Status Coverage

GitHub Stars GitHub Issues Buy Me a Coffee


Overview

BannedFuncDetector is a Python tool that scans binary files to detect banned or insecure functions. It supports traditional radare2 decompilers and AI-assisted decompilation to provide readable output and highlight risky calls.

Key Features

Feature Description
Binary Analysis Analyze PE/ELF/Mach-O binaries for banned functions
Multiple Decompilers r2ghidra, r2dec, default, and decai (AI assistant)
Directory Scans Analyze one file or whole directories
Parallel Processing Speed up directory scans
JSON Reports Results saved per target with structured output
Library Mode Use via CLI or import as a Python package

Supported Decompilers

Default (pdc)  r2ghidra (pdg)  r2dec (pdd)  decai (AI assistant)

Installation

From PyPI (Recommended)

pip install bannedfuncdetector

From Source

git clone https://github.com/seifreed/BannedFuncDetector.git
cd BannedFuncDetector
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e .

Quick Start

# Analyze a single binary
bannedfunc -f /path/to/binary

# Analyze a directory
bannedfunc -d /path/to/binaries --parallel

# Use r2dec
bannedfunc -f /path/to/binary --decompiler r2dec

Usage

Command Line Interface

# Basic analysis
bannedfunc -f /path/to/binary

# Analyze a directory with parallel workers
bannedfunc -d /path/to/binaries --parallel

# Save output to a custom directory
bannedfunc -f /path/to/binary -o output

# Force a decompiler
bannedfunc -f /path/to/binary --decompiler r2ghidra --force-decompiler

# Skip decompilation analysis (names only)
bannedfunc -f /path/to/binary --skip-analysis

Available Options

Option Description
-f, --file Executable file to analyze
-d, --directory Directory with executables to analyze
-o, --output Output directory for results
--decompiler Decompiler to use (default, r2ghidra, r2dec, decai)
--force-decompiler Force the specified decompiler
--parallel Process files in parallel (directory only)
--skip-banned Skip banned function name checks
--skip-analysis Skip decompilation analysis
--check-requirements Check system requirements before running
-v, --verbose Show detailed information

Python Library

Basic Usage

from bannedfuncdetector.bannedfunc import analyze_file

result = analyze_file(
    "/path/to/binary",
    decompiler_type="r2ghidra",
    output_dir="output",
)

print(result)

Directory Analysis

from bannedfuncdetector.bannedfunc import analyze_directory

results = analyze_directory(
    "/path/to/binaries",
    output_dir="output",
    decompiler_type="r2dec",
)

print(results)

Requirements

  • Python 3.13+ (tested on 3.13 y 3.14)
  • radare2 (required)
  • r2ghidra/r2dec (optional decompilers)
  • Ollama + decai plugin (optional for AI-assisted decompilation)
  • See pyproject.toml for Python dependencies

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support the Project

If you find BannedFuncDetector useful, consider supporting its development:

Buy Me A Coffee

License

This project is licensed under the GPL-3.0-or-later license - see the LICENSE file for details.

Attribution Required:


Made with dedication for the reverse engineering community

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

bannedfuncdetector-3.0.0.tar.gz (200.6 kB view details)

Uploaded Source

Built Distribution

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

bannedfuncdetector-3.0.0-py3-none-any.whl (111.8 kB view details)

Uploaded Python 3

File details

Details for the file bannedfuncdetector-3.0.0.tar.gz.

File metadata

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

File hashes

Hashes for bannedfuncdetector-3.0.0.tar.gz
Algorithm Hash digest
SHA256 e711addbf064c8abbaed908450a214befcff7e15c19751e9054bb52d7e0bafe3
MD5 a25ca82aca42b89d16caf4e4a4d64920
BLAKE2b-256 cdbb2de5f103047c76c83ca787d6d63becb9c6a490fd5d0fc46e3d5dc0fdc2b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for bannedfuncdetector-3.0.0.tar.gz:

Publisher: release.yml on seifreed/BannedFuncDetector

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

File details

Details for the file bannedfuncdetector-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bannedfuncdetector-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a497b3d9befa9cac0d9ee8f9917cf62299e34c7111efc11be9deab0d50b8e02
MD5 574572edad53fc308bbb44f7c5f07894
BLAKE2b-256 a862b052df700494d49218a48191ad9d3a178746ea3853a4a38b3a1494591ae7

See more details on using hashes here.

Provenance

The following attestation bundles were made for bannedfuncdetector-3.0.0-py3-none-any.whl:

Publisher: release.yml on seifreed/BannedFuncDetector

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