P1: Code/data repair (define function|code|data, undefine)#209
Closed
mahaloz wants to merge 1 commit into
Closed
Conversation
Important for obfuscated binaries and incorrect auto-analysis.
- New `decompiler define function|code|data` and `decompiler undefine`.
- Interface define_function/define_code/define_data/undefine (base raises
NotImplementedError) with per-backend implementations:
- IDA: ida_funcs.add_func/del_func, idc.create_insn, ida_bytes
create_data/del_items.
- Ghidra: FlatProgramAPI.createFunction/disassemble/createData +
FunctionManager.removeFunction + clearListing (transactional).
- Binary Ninja: create_user_function/remove_user_function/
define_user_data_var (best-effort).
- angr: unsupported (CFG-based; no define/undefine primitives).
- undefine removes a function if one starts at the address, then clears
the requested span.
- Client proxies + tests: undefine->define round-trip on a real function
(define reporting success proves undefine removed it) and define data.
IDA + Ghidra full pass; angr asserts the unsupported (exit 2) path.
- SKILL.md / docs updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5
Member
Author
|
Integrated into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Auto-analysis misses functions and mislabels code/data — routine on obfuscated or hand-written binaries. This adds the repair primitives IDALib exposes.
New capabilities
decompiler define function|code|data <addr>anddecompiler undefine <addr>.define_function/define_code/define_data/undefine(base raisesNotImplementedError) with per-backend implementations:add_funccreate_insncreate_data/SetTypedel_func+del_itemscreateFunctiondisassemblecreateDataremoveFunction+clearListingcreate_user_functiondefine_user_data_varremove_user_functionundefineremoves a function if one starts at the address, then clears the requested span.Example
Tests
test_undefine_and_define_function(round-trip:define functionreporting success is the strong signal thatundefinetruly removed the function —add_func/createFunctiononly succeed when none is there) andtest_define_data.2) path.Note:
list_functionsuses the light-artifact path, which lags IDA'sdel_funcby a query (whileget_funcis immediately consistent), so the test verifies via the define-success signal rather than the transient list state.Sixth PR in the IDALib-parity series. Based on
feat/cli-search(#208).🤖 Generated with Claude Code
https://claude.ai/code/session_01HfZHdprXg38re1XyKxzGg5