Skip to main content

AI-powered Ghidra query interface for reverse engineering agents

Project description

ghidra-ai-bridge

AI-powered Ghidra query interface for reverse engineering agents.

ghidra-ai-bridge provides a CLI and Python API that lets AI agents (or humans) query Ghidra project data — decompiled code, structs, enums, vtables, cross-references, strings, and more — without running Ghidra interactively.

Features

  • Query decompiled code by address or function name
  • Cross-reference lookup — callers and callees
  • Struct/enum/vtable inspection from Ghidra exports
  • String search with reference tracking
  • Address map integration for reversed source code
  • Source type extraction — struct sizes, enum values from VALIDATE_SIZE / VALIDATE_OFFSET macros
  • Remaining stub tracking — find unreversed functions
  • Crash debugging — find which function contains a given address
  • Configurable — works with any Ghidra project via YAML config
  • Headless export — PyGhidra-based bulk export scripts

Installation

pip install ghidra-ai-bridge

For headless Ghidra export support:

pip install ghidra-ai-bridge[headless]

Quick Start

# Interactive setup
ghidra-bridge init

# Export data from Ghidra project (requires pyghidra)
ghidra-bridge export all

# Build address map from reversed source
ghidra-bridge build-map

# Query
ghidra-bridge decompile 0x401000
ghidra-bridge search CPed
ghidra-bridge xrefs-to 0x5fb010
ghidra-bridge struct CEntity
ghidra-bridge info

Configuration

Create a ghidra-bridge.yaml in your project root:

ghidra:
  install_dir: ~/Downloads/ghidra_12.0.1_PUBLIC
  project_dir: ~/Documents/Ghidra
  project_name: my-project
  program_name: target.exe

paths:
  export_dir: .ghidra-exports
  address_map: .ghidra-exports/address_map.json

source:                                   # optional
  root: ./source
  hook_patterns:
    - 'RH_ScopedInstall\s*\(\s*(\w+)\s*,\s*(0x[0-9A-Fa-f]+)'
  stub_patterns:
    - 'plugin::Call\w*<[^>]*(0x[0-9A-Fa-f]+)[^>]*>'

binary:                                   # optional
  code_range_min: 0x00401000
  code_range_max: 0x00900000

Config priority: CLI args > environment variables > YAML file > defaults.

Environment variables: GHIDRA_INSTALL_DIR, GHIDRA_PROJECT_DIR, GHIDRA_PROJECT_NAME, GHIDRA_PROGRAM_NAME, GHIDRA_EXPORT_DIR.

Commands

Command Description
init Interactive setup wizard
export <type> Run Ghidra export (all, structs, decompiled, vtables, globals, strings, source-types)
build-map Build address map from source
decompile <addr|name> Show decompiled code
search <pattern> Search function names
xrefs-to <addr|name> Show callers
xrefs-from <addr|name> Show callees
struct <name> Show Ghidra struct definition
enum <name> Show Ghidra enum values
vtable <class> Show virtual function table
global <addr|name> Show global variable info
strings <pattern> Search strings
containing <addr> Find function containing address
decompile-class <class> Decompile all class methods
unimplemented [pattern] List unimplemented functions
remaining [class] Show remaining stubs
source-struct <name> Query struct from source
source-enum <name> Query enum from source
dump-asm <addr> <output> Dump assembly (requires pyghidra)
info Show export statistics
list List all functions

License

MIT

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

ghidra_ai_bridge-0.1.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

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

ghidra_ai_bridge-0.1.0-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file ghidra_ai_bridge-0.1.0.tar.gz.

File metadata

  • Download URL: ghidra_ai_bridge-0.1.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for ghidra_ai_bridge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8a70403922eb308f5ccc3716d3353f47326321453ad614201e36c1d6852f3db
MD5 728c607db294976dbf20b8c55a15fe52
BLAKE2b-256 525e19347728c68df49fe7f319bd1e82d2858f9975c1ecd834e14e8083138080

See more details on using hashes here.

File details

Details for the file ghidra_ai_bridge-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ghidra_ai_bridge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74e0329e2f8675f639cfdd057d4e63a6706a3b5458b1f038193c32403edf114c
MD5 de5f3af832c61e67d7c64f88af80429a
BLAKE2b-256 62c3e6ad562a4daa8f7214d9bea0e901c24494a7ed02a670e5b2b244d876c943

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