55 Commits

Author SHA1 Message Date
a3ad70d302 refactor: Simplify Docker setup and modernize project structure
Some checks are pending
Build Ghidra Plugin / build (push) Waiting to run
- Switch from Java to Python scripts (avoids OSGi bundle issues)
- Update pyproject.toml with proper src layout and ruff config
- Add binaries/ and ghidra-src/ to gitignore
- Clean up Module.manifest
2026-01-26 13:50:36 -07:00
Teal Bauer
662e202482 feat: add line filtering to decompile for context management
Add start_line, end_line, and max_lines parameters to decompile
functions, allowing AI models to retrieve only specific portions
of decompiled code for better context management.

Parameters:
- start_line: Start at this line number (1-indexed)
- end_line: End at this line number (inclusive)
- max_lines: Maximum lines to return (overrides end_line)

Response includes filter metadata with total_lines when filtering
is applied, helping models understand what portion they're viewing.

Examples:
- Get first 20 lines: max_lines=20
- Get lines 10-30: start_line=10, end_line=30
- Get 15 lines from line 25: start_line=25, max_lines=15
2025-11-14 17:49:19 +01:00
Teal Bauer
60124d2315 fix: clear sufficient space when changing data types
When applying a larger struct to an address, clear enough space
for the new data type rather than just the old data's length.
This prevents 'Conflicting data exists' errors when the new
type is larger than the existing data.

Fixes issue where ConfigParametersStruct couldn't be applied
due to conflicting smaller data items in the address range.
2025-11-14 13:20:49 +01:00
Teal Bauer
afc09f1cd9 docs: update README and bump version to v2.1
Some checks failed
Build Ghidra Plugin / build (push) Has been cancelled
Comprehensive documentation overhaul reflecting all enhancements since fork:
- Documented new namespaced tool organization (instances_*, functions_*, data_*, structs_*, etc.)
- Added complete struct management API documentation
- Updated example usage with realistic reverse engineering workflows
- Added uvx installation method (recommended: local install for version sync)
- Updated all repository URLs to starsong-consulting
- Bumped plugin and bridge versions to v2.1.0, API version to 2010
2025-11-14 12:58:55 +01:00
Teal Bauer
30d9bb17da feat: add struct data type management API
Add endpoints and MCP tools to create, read, update, and delete struct
data types in Ghidra's data type manager. Enables programmatic definition
of complex data structures for reverse engineering workflows.

Includes pagination, category filtering, and field-level operations
(add, update by name or offset).
2025-11-14 12:10:34 +01:00
Teal Bauer
3222cf9866 feat: upgrade to Ghidra 11.4.2 with improved transaction handling
Some checks failed
Build Ghidra Plugin / build (push) Has been cancelled
- Update all Ghidra JAR dependencies to 11.4.2
- Improve TransactionHelper to properly handle endTransaction return value
- Add GHIDRA_HOME environment variable support for flexible builds
- Update version references in extension.properties and MANIFEST.MF

The transaction fix now checks the return value from endTransaction() and
properly reports transaction failures, providing better error handling for
Ghidra 11.3.2+ compatibility.

Refs #7
2025-11-11 13:01:47 +01:00
Teal Bauer
bc1e137878 chore: prepare v2.0.0 release
- Update version to v2.0.0 in ApiConstants.java and bridge_mcp_hydra.py
- Create CHANGELOG v2.0.0 section with release date
- Fix Ghidra 11.3.2+ compatibility in TransactionHelper (endTransaction signature)
- Clarify instances_list vs instances_discover usage in documentation
- Remove commented-out code in pom.xml

Fixes #7
Closes #5
2025-11-11 12:54:03 +01:00
Teal Bauer
4379bea14f Release v2.0.0-beta.5: Critical fixes for stable release
- Fixed memory_write() endpoint to use correct ProgramEndpoints path
- Standardized all error responses to structured format with error codes
- Enhanced instances_discover() to return both new and existing instances
- Updated API version to 2005 for compatibility tracking
- Verified all bridge-to-plugin endpoint mappings are correct
- Confirmed route registration order follows proper specificity

Ready for v2.0.0 stable release after final testing.
2025-06-18 00:51:00 +02:00
Teal Bauer
977791432f fix: add addr filter to data list 2025-05-22 15:36:43 +02:00
Teal Bauer
52312f9ed3 chore: bump versions
Some checks failed
Build Ghidra Plugin / build (push) Has been cancelled
2025-05-22 14:51:56 +02:00
Teal Bauer
384f8b272f fix: update callgraph endpoint to accept both name and address parameters
- Modified ProgramEndpoints.java to support the name and address parameters
- Updated bridge MCP tool analysis_get_callgraph to use both parameters
- Updated tests to verify functionality with both parameters
- Added the change to CHANGELOG.md
2025-05-22 14:35:59 +02:00
Teal Bauer
8aded2e6c3 fix: Add another address check for creating functions 2025-05-22 14:25:09 +02:00
Teal Bauer
58f22316bd chore: Bump version identifiers 2025-05-22 09:12:10 +02:00
Teal Bauer
f377a34442 fix: Fix handling of variable operations in URL paths
Some checks failed
Build Ghidra Plugin / build (push) Has been cancelled
This commit fixes an issue where variable operations with paths like
/functions/by-name/FunctionName/variables/varName were not being properly
processed. The handleFunctionResource method now checks for paths that
start with 'variables/' and extracts the variable name for processing.

Added implementation to handle renaming of decompiler-generated variables.
2025-05-22 08:14:57 +02:00
Teal Bauer
c4d170cdca fix: make decompiler variables renameable 2025-05-21 18:04:30 +02:00
Teal Bauer
f71f4aa43b feat: Add strings endpoint to list string data in the binary
The new endpoint provides:
- GET /strings endpoint with pagination and filtering
- Python bridge support via list_strings() function
- Searching of string data types across memory blocks
- Filtering options for string content
2025-05-21 17:15:53 +02:00
Teal Bauer
25f353a4f3 fix: Attempt to disassemble memory before creating functions 2025-05-21 13:13:15 +02:00
Teal Bauer
fedd2d0a55 feat: Update version to 2.0.0-beta.1 and add API version check
- Update Java plugin version to v2.0.0-beta.1
- Add version identifier to bridge script
- Add API version check in bridge to verify plugin compatibility
- Bridge script will now check for API version 2 compatibility
2025-04-14 21:28:50 +02:00
Teal Bauer
6c28553c58 fix: Implement create_data and delete_data functionality
- Add handleCreateData method to Java plugin to support creating new data
- Add data type mapping to support common types like byte, word, dword, string
- Implement delete_data functionality with graceful handling of missing data
- Add proper error handling when conflicts are detected
- Add comprehensive tests for both create_data and delete_data functionality
2025-04-14 21:23:45 +02:00
Teal Bauer
28870e9b54 feat: Improve data manipulation API
- Add comprehensive data manipulation capabilities
- Implement separate pathways for rename-only, type-only, and combined operations
- Fix HTTP request body consumption issue in DataEndpoints
- Standardize on 'type' parameter name instead of 'dataType'
- Add thorough test coverage with dedicated test_data_update.py script
- Update API documentation to version 2 with full endpoint descriptions
- Update CHANGELOG with detailed information about data manipulation features
2025-04-14 19:24:14 +02:00
Teal Bauer
5797fb38e7 feat: Add data renaming and type setting capabilities
- Add support for setting data types and renaming data items
- Fix Java API implementation for data operation endpoints
- Create rename_data and set_data_type tools for clearer separation of concerns
- Add comprehensive test scripts for data operations
- Successfully test changing data types and naming
2025-04-14 12:07:44 +02:00
Teal Bauer
9b19011b7d finalize HATEOAS updates 2025-04-14 11:25:22 +02:00
Teal Bauer
9443101298 fix: Update XrefsEndpoints to use Ghidra API correctly
- Replace getDefinedAddresses with proper Listing methods
- Use getInstructions and getDefinedData instead
- Check both instructions and data for a valid starting address
- Improve fallback strategy for current address retrieval
2025-04-14 09:46:45 +02:00
Teal Bauer
0eaa19a6e8 fix: Resolve compatibility issues with Ghidra API
- Add helper method to handle ReferenceIterator conversion
- Support both Reference[] and ReferenceIterator types
- Replace LocationService with reflection-based approach
- Use listing's defined addresses as fallback
2025-04-14 09:27:49 +02:00
Teal Bauer
2b1fe6c4e1 fix: Update XrefsEndpoints.java for Ghidra 11 API compatibility
- Fix reference handling using ReferenceIterator
- Use proper Ghidra 11 services for current address retrieval
- Implement location tracking via LocationService and SelectionService
2025-04-14 08:54:18 +02:00
Teal Bauer
5dc59ced59 fix: Resolve compilation errors in XrefsEndpoints for Ghidra 11+
- Update reference handling to use arrays instead of iterators
- Simplify getCurrentAddress implementation for Ghidra 11+
2025-04-14 01:41:39 +02:00
Teal Bauer
96788f35fc feat: Implement proper cross-references (xrefs) functionality
- Java plugin now uses Ghidra ReferenceManager to find real cross-references
- Added detailed information about xrefs, including related functions and instructions
- Bridge script now provides simplified and human-readable text for xrefs
- Support bi-directional search for references to/from addresses
- Added filtering by reference type
- Properly implement getCurrentAddress using Ghidra service APIs
2025-04-14 01:37:41 +02:00
Teal Bauer
6c865c456e perf: Optimize variables endpoint with efficient pagination
- Implemented efficient pagination for variables endpoints to avoid timeout
- Added globalOnly parameter to allow fetching just global variables
- Limited decompilation to only process functions needed for current page
- Improved estimation of total count for better pagination links
- Reduced decompilation timeout to improve performance
2025-04-14 00:49:46 +02:00
Teal Bauer
3df129f3fd fix: Implement real instruction disassembly and fix xrefs and memory endpoints
- Fixed disassembly endpoint to show real instructions instead of placeholders
- Improved memory endpoint to handle address errors gracefully
- Fixed address arithmetic error in xrefs endpoint
- Added proper error handling and fallbacks in all endpoints
2025-04-14 00:16:49 +02:00
Teal Bauer
3311e88565 WIP fix endpoints 2025-04-14 00:08:10 +02:00
Teal Bauer
4bc22674ec feat: Implement HATEOAS-compliant API endpoints
- Add ProgramEndpoints for proper HATEOAS URL structure
- Fix response structure to include required HATEOAS links
- Ensure proper result formats for segments, decompiled functions, and variables
- Reorganize endpoints to use nested resource pattern (/programs/current/functions/{address})
- Fix all tests to ensure HATEOAS compliance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-04-13 20:29:11 +02:00
Teal Bauer
9879e71e88 WIP big refactor 2025-04-10 14:42:53 +02:00
Teal Bauer
57584581bc WIP update APIs 2025-04-09 23:36:05 +02:00
Teal Bauer
ba7781643f chore: Completed conversion of bridge/plugin protocol to pure JSON 2025-04-09 14:35:58 +02:00
Teal Bauer
4fe3c16d25 feat: Add decompiler configuration options
Add toggleCCode, toggleSyntaxTree and setSimplificationStyle controls to
the Java plugin. These allow controlling decompiler output format between
C code (default) and raw decompiler output with syntax trees.

Example usage:
decompile_function_by_address(port=8192, address='0x1000', cCode=True)
decompile_function_by_address(port=8192, address='0x1000', syntaxTree=True)
2025-04-08 21:35:37 +02:00
Teal Bauer
bd56f5b6cc fix: failure response for decompile_function with address 2025-04-08 10:50:18 +02:00
Teal Bauer
8f3fa16ad8 Explicitly require ProgramManager 2025-04-08 09:44:11 +02:00
Teal Bauer
9a9d0e933f Fix: Standardize API responses and fix test failures
Some checks failed
Build Ghidra Plugin / build (push) Has been cancelled
Refactored Java plugin to use helper methods for consistent JSON success/error responses. Fixed NullPointerException in listVariables. Updated Python tests (HTTP and MCP) to use helper assertions validating the standard response structure.
2025-04-07 22:25:02 +02:00
Teal Bauer
a5c600b07f fix: Resolve MCP bridge test failures
Standardizes communication between the Python bridge and Java plugin,
resolves test logic errors, and improves error handling to ensure
MCP bridge tests pass reliably.

Key changes:
- Standardized HTTP methods: Use GET for read operations and POST for all modification operations across the bridge and plugin.
- Fixed JSON parsing in Java plugin using Gson and added missing imports.
- Corrected error handling in Java plugin's `get_function` to return `success: false` when a function is not found.
- Updated Python bridge's `safe_get` to correctly propagate nested failure responses from the plugin.
- Fixed test client logic (`test_mcp_client.py`) to correctly extract function name/address from `list_functions` results.
- Added logging to `test_mcp_client.py` for easier debugging of mutating operations.
2025-04-07 14:31:46 +02:00
Teal Bauer
14eae14f63 Switch all results over to JSON 2025-04-04 18:10:45 +02:00
Teal Bauer
cbe5dcc1f3 Switch to JSON as bridge/plugin comm protocol 2025-04-04 16:05:42 +02:00
Teal Bauer
04d088591b WIP: Switch to JSON as data exchange format 2025-04-03 18:52:47 +02:00
Teal Bauer
1b07f9430b Update docstrings 2025-04-02 19:38:04 +02:00
Teal Bauer
d4611377c8 Merge branch 'variable-mangling' 2025-04-02 18:54:36 +02:00
Teal Bauer
399c76b29a Expand functionality
Find variables, rename and retype them
Additionally merge changes from https://github.com/LaurieWired/GhidraMCP/pull/16 and https://github.com/LaurieWired/GhidraMCP/pull/18
2025-04-02 18:53:48 +02:00
Teal Bauer
1bfdf74554 Add version info to build output
- If tagged, use the tag version
- Otherwise use dev-SNAPSHOT plus commit id and timestamp
2025-04-02 18:52:55 +02:00
Teal Bauer
be08f0f2ea Allow renaming and retyping variables 2025-04-02 18:52:02 +02:00
Teal Starsong
883fde7344 Update version to 11.3.1 and fix complete package to include bridge script 2025-03-31 18:15:41 +02:00
Teal Bauer
a615813e2d Fix project info endpoints with simpler JSON generation
Simplify JSON response generation for better reliability. Both root and info
endpoints now use direct string building instead of the JSON library.
2025-03-30 03:10:48 +02:00
Teal Bauer
5cf8f5fb16 Update plugin description to better reflect its purpose 2025-03-30 01:27:56 +01:00