rev-symbol

Restore function symbols by analyzing code patterns, strings, constants, and cross-references

By p4nda0s · 1,625 installs

npx skills add p4nda0s/reverse-skills --skill rev-symbol

Source repository · Upstream listing

rev symbol Symbol Recovery Analyze function code characteristics to recover/identify function symbols and names. Pre check Determine which IDA access method is available: Option A — IDA Pro MCP (preferred if connected): Check if the IDA Pro MCP server is connected (look for an active ida pro or equivalent MCP connection). If connected, you can query IDA directly via MCP tools — no exported files needed. Proceed with the analysis using MCP. Option B — IDA NO MCP exported data: If MCP is not connected, check if IDA NO MCP exported data exists in the current directory: 1. Check if decompile/ directory exists 2. Check if there are .c files inside If neither MCP nor exported data is available, prompt the user: Export Directory Structure Function File Format (decompile/ .c) Each .c file contains function metadata comments and decompiled code: Symbol Recovery Steps Step 1: Analyze Internal Characteristics Carefully examine the target function for: String constants : Strings used in the function may reveal its purpose Numeric constants / Magic Numbers : MD5: 0x67452301 , 0xEFCDAB89 , 0x98BADCFE , 0x10325476 CRC32: 0xEDB88320 Base64 charset: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ AES S Box: 0x63, 0x7C, 0x77, 0x7B... Zlib: 0x78 , 0x9C (compression header) other constants/magic numbers... Code structure : Loop patterns, bitwise operations, specific algorithm flows If you can identify a known algorithm through constants/structure, tell the user directly. Step 2: Analyze Cross References Analyze Callees (called functions): Read functions in the callees list For each callee, check if its address exists in imports.txt Recognize call patterns even when symbols are missing: Paired function patterns (identify by matching call pairs): c // socket(AF INET, SOCK STREAM, 0) fixed constants sub XXX(2, 1, 0); // socket: domain=2, type=1, protocol=0 // connect/bind(sockfd, addr, addrlen) sub XXX(fd, &var, 16); // addr struct, len=16 for IPv4 // memcpy/memmove(dst, src, size) sub XXX(dst, src, n); // 3 params: dst, src, count // memset(ptr, value, size) sub XXX(ptr, 0, 0x100); // 3 params: ptr, byte value, count // read/write(fd, buf, count) ret = sub XXX(fd, buf, n); // returns bytes read/written // strcmp/strncmp(s1, s2) or (s1, s2, n) if (sub XXX(s1, s2) == 0) // returns 0 on equal c // file/socket operations: 1 on error if ((fd = sub XXX(...)) == 1) goto error; // allocation: NULL on failure if (!(ptr = sub XXX(size))) goto error; // success/error: 0 = success if (sub XXX(...) != 0) goto error; // strlen: returns size t len = sub XXX(str); sub YYY(dst, src, len); // len used in memcpy Symbol Recovery Analysis: <function address Function Characteristics Strings: <list discovered strings Constants: <list key constants Called imports: <list Cross Reference Analysis Callers: <callers and their symbols Callees: <callees and their symbols Inference Result Suggested symbol name : <suggested name Confidence : High / Medium / Low Reasoning : <explain why this name is suggested Similar Open Source Implementation <if similar open source code is found, provide link