Grep

From allthingsida/idasql-skills · View interactive version

Grep is an AI agent skill from the GitHub repository allthingsida/idasql-skills. Search named IDA entities by pattern. Use when asked to find functions, labels, types, or members by name, or to seed xref/decompiler workflows from a name lookup.

How to use this skill

Skill file

Links: for a GUI-connected target on IDA 9.4+ builds, make named functions, addresses, strings or types clickable. For a known fully headless target (including a background CLI server you launched), do not query deep_links or emit ida:// links; use plain names and addresses, without remarking on links or their omission. For GUI targets: [name](uri) from the deep_links table, outside code blocks (skill deep-links).

grep is IDASQL's entity-search surface. Use it to discover named functions, labels, segments, structs, enums, and members before pivoting into xrefs, decompiler, or type work.


Trigger Intents

Use this skill when user asks to:

Route to:


Do This First (Quick Start)

-- 1) Start with a structured search while you learn the result shape
SELECT name, kind, addr
FROM grep
WHERE pattern = 'main'
ORDER BY kind, name
LIMIT 20;
-- 2) Narrow immediately when the result set is noisy
SELECT name, ordinal, full_name
FROM grep
WHERE pattern = 'EH%' AND kind = 'struct'
ORDER BY name;
-- 3) Page with ordinary SQL
SELECT name, kind, addr
FROM grep
WHERE pattern = 'sub_%'
ORDER BY kind, name
LIMIT 10 OFFSET 10;

Interpretation guidance:


Result Shape

grep exposes named IDA entities as rows:

Common kind values:


Pattern Rules

Examples:

-- Contains-match
SELECT name, kind
FROM grep
WHERE pattern = 'main'
LIMIT 20;
-- Prefix wildcard
SELECT name, kind, addr
FROM grep
WHERE pattern = 'sub_%'
ORDER BY name
LIMIT 20;
-- Shell-style star is accepted too
SELECT name, kind
FROM grep
WHERE pattern = 'Zw*'
LIMIT 20;

Common Workflows

Find candidate functions by name

SELECT name, addr
FROM grep
WHERE pattern = 'main%' AND kind = 'function'
ORDER BY name;

Resolve imported APIs

SELECT module, name, addr
FROM imports
WHERE name LIKE 'CreateFile%'
ORDER BY module, name;

Find types by convention

SELECT name, kind, ordinal, full_name
FROM grep
WHERE pattern = 'EH%' AND kind IN ('struct', 'enum')
ORDER BY kind, name;

Find members under a parent type

SELECT name, parent_name, ordinal
FROM grep
WHERE pattern = 'flag%' AND kind = 'member'
ORDER BY parent_name, name
LIMIT 30;

Join into richer function metadata

SELECT g.name, f.size, f.prototype
FROM grep g
JOIN funcs f ON f.addr = g.addr
WHERE g.pattern = 'sub_%' AND g.kind = 'function'
ORDER BY f.size DESC
LIMIT 20;

Pivot from discovery into xrefs

SELECT caller_name, printf('0x%X', caller_addr) AS from_addr
FROM callers
WHERE func_addr = (
    SELECT addr
    FROM imports
    WHERE name = 'CreateFileW'
    ORDER BY name
    LIMIT 1
);

Compare With Other Search Surfaces


Failure and Recovery

add kind = ..., tighten the prefix, or switch from plain text to a more specific wildcard pattern.

broaden the pattern, try a contains search, or pivot to imports if the target may only exist as an imported API.

grep is the wrong surface; pivot to strings, decompiler tables, or other domain tables.

use byte_search instead of grep.


See Also

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.