From ghidrasql
Queries strings, bytes, data items, memory blocks, and relocations in Ghidra databases via SQL. Useful for binary analysis and reverse engineering.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ghidrasql:dataThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when the user asks to:
Use this skill when the user asks to:
Route to:
xrefs when string or data references matter (use string_refs view)analysis for higher-level suspiciousness or summarizationannotations if the next step is naming or typing the datadebugger for byte patches via UPDATE memory_bytes| Surface | Predicate | Pushdown? | Notes |
|---|---|---|---|
strings | any | Indexed | Cheap |
data_items | any | Indexed | Cheap (sub-second for tens of thousands of rows) |
memory_bytes | range | No (post-filter scan) | Always tightly bound |
memory_blocks, segments | any | Indexed | Cheap, small cardinality |
relocations | any | Indexed | Cheap |
Composition views: memory_layout, memory_hexdump, memory_byte_detail, memory_byte_items, typed_data_items, relocation_map, string_hotspots, string_refs.
Lightest useful surface — strings:
SELECT printf('0x%X', address) AS addr, length, type, encoding, content
FROM strings
WHERE content LIKE '%password%'
ORDER BY address
LIMIT 50;
type and encoding come from Ghidra. Run SELECT DISTINCT type, encoding FROM strings; to enumerate what's present on this binary.
Typed globals (only data items that have a Ghidra-recognised type):
SELECT printf('0x%X', address) AS addr, name, data_type, size
FROM data_items
WHERE data_type IS NOT NULL AND data_type != ''
ORDER BY address
LIMIT 50;
Discover the actual data_type values on this binary (don't hard-code — the set varies by binary, processor, and Ghidra version):
SELECT DISTINCT data_type
FROM data_items
WHERE data_type IS NOT NULL AND data_type != ''
LIMIT 50;
Typical results include Ghidra primitives (byte, word, dword, undefined1/2/4/8, pointer, string, unicode, TerminatedCString, TerminatedUnicode). Format-specific structures (PE, ELF, Mach-O, etc.) appear when Ghidra recognises the container — names depend on the binary in front of you. Don't hard-code — enumerate live.
Hexdump for a specific address:
SELECT *
FROM memory_hexdump
WHERE address = 0x403000;
Memory blocks (per-segment metadata; perm flags as is_read, is_write, is_exec):
SELECT printf('0x%X', start_ea) AS start,
printf('0x%X', end_ea) AS end,
name, block_class, size,
is_read, is_write, is_exec
FROM memory_blocks
ORDER BY start_ea;
Relocations (note: table is named relocations, not relocation_items):
SELECT printf('0x%X', address) AS at,
printf('0x%X', target_addr) AS target,
reloc_type, width, symbol_name
FROM relocations
ORDER BY address;
Create a typed data item:
INSERT INTO data_items (address, data_type)
VALUES (0x403000, 'dword');
Functions that reference a string — use the string_refs view, which pre-attributes the function context:
SELECT printf('0x%X', func_addr) AS func, func_name, string_value
FROM string_refs
WHERE string_value LIKE '%error%'
ORDER BY func_addr
LIMIT 50;
For "which strings are referenced most", use string_hotspots.
imports is EmptySome PE binaries (packed, stripped, or unusually crafted) parse with imports empty but their IAT entries surface as data_items named PTR_<API>_<address>.
SELECT printf('0x%X', address) AS addr, name
FROM data_items
WHERE name LIKE 'PTR_%'
ORDER BY name
LIMIT 50;
If this fallback returns rows, route the agent to think of those as imports for fan-in / call-target analysis.
memory_bytes queries tightly bounded — it's a post-filter scan over the whole address space.strings, data_items, memory_hexdump, memory_blocks, relocations over raw byte scans.string_refs (read it as a data query, then route to xrefs if you need callers).npx claudepluginhub 0xeb/ghidrasql-skills --plugin ghidrasqlAnalyzes binaries using IDA Pro's Domain API: program structure, functions, disassembly, cross-references, and strings. Provides Pythonic API usage, database opening, and configuration options for headless analysis.
Performs initial binary triage surveying memory layout, strings, imports/exports, and functions to understand behavior and flag suspicious activity like unusual sections or malicious APIs.