/bnsql:analysisfrom bnsql
BNSQL analysis workflows: triage, security audit, crypto/network detection, multi-table queries.
Ships in bnsql. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
High-level recipes for cross-domain analysis. Each recipe composes multiple
bnsql skills (disassembly, xrefs, data, decompiler).
-- 1. Orientation
SELECT * FROM binary;
SELECT * FROM entries;
SELECT * FROM capabilities;
-- 2. Imports hint at capability surface
SELECT module, COUNT(*) AS apis
FROM imports
GROUP BY module
ORDER BY apis DESC;
-- 3. Long strings often reveal purpose
SELECT content, hex(addr) AS addr
FROM strings
WHERE length > 16
ORDER BY length DESC
LIMIT 20;
-- 4. Most-called functions are usually utilities/dispatchers
WITH caller_counts AS (
SELECT to_addr, COUNT(*) AS n
FROM xrefs WHERE is_code = 1
GROUP BY to_addr
)
SELECT f.name, hex(f.addr) AS addr, c.n AS callers
FROM funcs f
JOIN caller_counts c ON c.to_addr = f.addr
ORDER BY c.n DESC
LIMIT 10;
-- Dangerous string functions
SELECT module, name FROM imports
WHERE name IN ('strcpy', 'strcat', 'sprintf', 'gets', 'scanf');
-- Find call sites in the binary
SELECT DISTINCT c.func_name AS caller_name, hex(c.func_addr) AS addr
FROM callees c
WHERE c.callee_name IN ('strcpy', 'strcat', 'sprintf', 'gets');
-- Crypto-related imports
SELECT module, name FROM imports
WHERE name LIKE '%Crypt%' OR name LIKE '%Hash%'
OR name LIKE '%AES%' OR name LIKE '%RSA%'
OR name LIKE '%MD5%' OR name LIKE '%SHA%';
-- Constants in code (common AES S-box bytes via byte_search)
SELECT search_first('63 7C 77 7B F2 6B 6F C5'); -- AES S-box prefix
-- Crypto-named functions
SELECT name, hex(addr) AS addr
FROM funcs
WHERE name LIKE '%crypt%' OR name LIKE '%aes%' OR name LIKE '%sha%';
-- Network-related imports
SELECT module, name FROM imports
WHERE name LIKE '%socket%' OR name LIKE '%connect%'
OR name LIKE '%recv%' OR name LIKE '%send%'
OR name LIKE '%bind%' OR name LIKE '%listen%';
-- URL / domain strings
SELECT content, hex(addr) AS addr
FROM strings
WHERE content LIKE 'http://%' OR content LIKE 'https://%'
OR content LIKE '%.com%' OR content LIKE '%.net%';
-- Functions containing network call sites
SELECT DISTINCT c.func_name AS caller_name, hex(c.func_addr) AS addr
FROM callees c
WHERE c.callee_name IN ('socket', 'connect', 'send', 'recv');
-- 1. Survey
SELECT * FROM funcs WHERE addr = 0x401000;
-- 2. Who calls it?
SELECT * FROM callers WHERE func_addr = 0x401000;
-- 3. What does it call?
SELECT DISTINCT callee_name
FROM hlil_calls
WHERE func_addr = 0x401000;
-- 4. Local variables
SELECT name, type, storage
FROM hlil_vars
WHERE func_addr = 0x401000;
-- 5. Decompiled body
SELECT decompile(0x401000);
WITH inbound AS (
SELECT to_addr AS addr, COUNT(*) AS in_count
FROM xrefs WHERE is_code = 1
GROUP BY to_addr
),
outbound AS (
SELECT from_func AS addr, COUNT(*) AS out_count
FROM xrefs WHERE is_code = 1 AND from_func IS NOT NULL
GROUP BY from_func
)
SELECT f.name, hex(f.addr) AS addr,
i.in_count, o.out_count,
(i.in_count * o.out_count) AS connectivity
FROM funcs f
JOIN inbound i ON i.addr = f.addr
JOIN outbound o ON o.addr = f.addr
ORDER BY connectivity DESC
LIMIT 10;
SELECT hex(addr) AS addr, original_byte, patched_byte, status
FROM patches
ORDER BY addr;
When you don't yet know which table an entity lives in, query the unified entities
view or the paginated entities_search() UDF. Both span functions, symbols, segments,
imports, strings, and types.
entities view columns:
| Column | Type | Description |
|---|---|---|
name | TEXT | Entity name |
kind | TEXT | function, symbol, segment, import, string, or type |
addr | INT | Address; NULL for type rows |
parent_name | TEXT | Owning module for imports (else empty) |
qualified_name | TEXT | Fully-qualified name (e.g. module!name) |
source | TEXT | Origin surface, e.g. analysis.functions |
-- Ad-hoc: every entity mentioning "config", any kind
SELECT kind, name, hex(addr) AS addr, source
FROM entities
WHERE name LIKE '%config%'
ORDER BY kind, name;
entities_search(pattern[, limit][, offset]) does the case-insensitive substring match
(over name/parent_name/qualified_name) natively and paginates — prefer it on large
databases. Arities 1/2/3; default limit 50, max 500; default offset 0. It returns a
JSON array of objects shaped like the entities view rows.
-- First 25 matches for "decrypt", projected to rows
SELECT json_extract(value, '$.kind') AS kind,
json_extract(value, '$.name') AS name,
json_extract(value, '$.source') AS source
FROM json_each(entities_search('decrypt', 25));
connect for session bootstrapxrefs for the underlying call graphdata for byte_search patternsdecompiler for HLIL-level investigationannotations for marking findings with comments / renamesWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
11 skills in this plugin
/annotationsEdit Binary Ninja databases: comments, renames, types, patches. Mutations require SELECT save() to persist (explicit-save model, v0.0.9+)./connectConnect to Binary Ninja databases and bootstrap sessions. Use when starting analysis, routing to other skills, or setting up CLI/HTTP/MCP connections./dataQuery Binary Ninja strings, bytes, and binary patterns. Use the byte_search table for fast byte-pattern search./decompilerDecompile Binary Ninja functions via HLIL: pseudocode text, local variables, call sites. Always filter by func_addr./disassemblyQuery Binary Ninja disassembly: functions, segments, instructions, blocks. Use for code-level analysis and instruction inspection./functionsComplete bnsql SQL function reference catalog.npx claudepluginhub 0xeb/bnsql-skills --plugin bnsql