Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
p4nda0s avatar

Rev Struct

  • 1.4k installs
  • 1.8k repo stars
  • Updated May 6, 2026
  • p4nda0s/reverse-skills

rev-struct is an agent skill that reconstructs C data structures by analyzing memory access patterns in IDA decompilation or MCP queries.

About

The rev-struct skill reconstructs data structure definitions by analyzing memory access patterns across functions and call chains in reverse engineering workflows. It prefers IDA Pro MCP when connected so agents query decompilation and cross-references directly without exported files. When MCP is unavailable, it consumes IDA-NO-MCP exports with decompile C files and prompts users to install the INP.py plugin and export via Ctrl-Shift-E. Analysis correlates field offsets, pointer arithmetic, and repeated member accesses to infer struct layouts, array strides, and nested types. Output documents recovered typedefs with evidence from accessing functions and warns when coverage is incomplete. Use during malware or binary analysis when structure layouts are unknown but access patterns are observable in IDA.

  • Recovers structs from memory access patterns across functions and call chains.
  • Prefers IDA Pro MCP direct queries when the server is connected.
  • Falls back to IDA-NO-MCP decompile exports with setup instructions.
  • Correlates offsets and pointer arithmetic into inferred layouts.
  • Documents evidence and incomplete coverage warnings in output.

Rev Struct by the numbers

  • 1,351 all-time installs (skills.sh)
  • +64 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #339 of 2,203 Security skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

rev-struct capabilities & compatibility

Capabilities
ida mcp or export pre check · memory access pattern correlation · struct and array stride inference · evidence backed typedef output · incomplete coverage warnings
Use cases
security audit · debugging
From the docs

What rev-struct says it does

Reconstruct data structures by analyzing memory access patterns across functions
SKILL.md
Option A — IDA Pro MCP (preferred if connected)
SKILL.md
npx skills add https://github.com/p4nda0s/reverse-skills --skill rev-struct

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.4k
repo stars1.8k
Security audit3 / 3 scanners passed
Last updatedMay 6, 2026
Repositoryp4nda0s/reverse-skills

What fields and layout does this unknown struct have based on how the binary accesses memory?

Recover C data structures from IDA decompilation or MCP memory access pattern analysis.

Who is it for?

Reverse engineers recovering data layouts from IDA decompilation or MCP-connected binaries.

Skip if: Skip for source-available projects where headers already define the structures.

When should I use this skill?

User analyzes unknown structs in IDA with rev-struct or IDA-NO-MCP exported decompile files.

What you get

Inferred struct definitions with offset evidence from decompiled functions and noted coverage gaps.

  • Reconstructed C struct definitions
  • Field offset and type mapping report

Files

SKILL.mdMarkdownGitHub ↗

rev-struct - Structure Recovery

Recover data structure definitions by analyzing memory access patterns in functions and their call chains.

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:

No IDA access method detected. Choose one of the following:

Option A — IDA Pro MCP (recommended):
  Connect the IDA Pro MCP server so Claude can query IDA directly.

Option B — IDA-NO-MCP export:
  1. Download plugin: https://github.com/P4nda0s/IDA-NO-MCP
  2. Copy INP.py to IDA plugins directory
  3. Press Ctrl-Shift-E in IDA to export
  4. Open the exported directory with Claude Code

---

Export Directory Structure

./
├── decompile/              # Decompiled C code directory
│   ├── 0x401000.c          # One file per function, named by hex address
│   ├── 0x401234.c
│   └── ...
├── decompile_failed.txt    # Failed decompilation list
├── decompile_skipped.txt   # Skipped functions list
├── strings.txt             # String table (address, length, type, content)
├── imports.txt             # Import table (address:function_name)
├── exports.txt             # Export table (address:function_name)
└── memory/                 # Memory hexdump (1MB chunks)

Function File Format (decompile/*.c)

Each .c file contains function metadata comments and decompiled code:

/*
 * func-name: sub_401000
 * func-address: 0x401000
 * callers: 0x402000, 0x403000    // List of functions that call this function
 * callees: 0x404000, 0x405000    // List of functions called by this function
 */

int __fastcall sub_401000(int a1, int a2)
{
    // Decompiled code...
}

---

Structure Recovery Steps

Step 1: Read Target Function

1. Based on the user-provided address, read decompile/<address>.c 2. Parse function metadata, extract callers and callees lists 3. Identify pointer parameters in the function (potential structure pointers)

Step 2: Collect Memory Access Patterns

Search for the following patterns in the target function:

Direct offset access:

*(a1 + 0x10)           // offset 0x10
*(_DWORD *)(a1 + 8)    // offset 0x8, DWORD type
*(_QWORD *)(a1 + 0x20) // offset 0x20, QWORD type
*(_BYTE *)(a1 + 4)     // offset 0x4, BYTE type

Array access:

*(a1 + 8 * i)          // array, element size 8 bytes
a1[i]                  // array access

Nested structures:

*(*a1 + 0x10)          // first field of struct pointed by a1 is a pointer

Record format:

offset=0x00, size=8, access=read/write, type=QWORD
offset=0x08, size=4, access=read, type=DWORD
...

Step 3: Traverse Callers for Analysis

Read each caller function and analyze:

1. Parameter passing: What is passed when calling?

   sub_401000(v1);        // v1 might be a struct pointer
   sub_401000(&v2);       // v2 is a struct
   sub_401000(malloc(64)); // struct size is ~64 bytes

2. Operations before/after the call:

   v1 = malloc(0x40);     // allocate 0x40 bytes
   *v1 = 0;               // offset 0x00 initialization
   *(v1 + 8) = callback;  // offset 0x08 is a function pointer
   sub_401000(v1);

3. Collect more offset accesses

Step 4: Traverse Callees for Analysis

Read each callee function and analyze:

1. How parameters are used:

   // In callee
   int callee(void *a1) {
       return *(a1 + 0x18);  // accesses offset 0x18
   }

2. Passed to other functions:

   another_func(a1 + 0x20);  // offset 0x20 might be a nested struct

Step 5: Aggregate and Infer

1. Merge all offset information, sort by offset 2. Calculate struct size: max(offset) + last_field_size 3. Infer field types:

  • Called as function pointer → function pointer
  • Passed to strlen/printf → string pointer
  • Compared with constants → enum/flags
  • Increment/decrement operations → counter/index

4. Identify common patterns:

  • Offset 0 is a function pointer table → vtable (C++ object)
  • next/prev pointers → linked list node
  • refcount field → reference counted object

---

Output Format

/*
 * Structure Recovery Analysis
 * Source function: <func_address>
 * Analysis scope: <number of callers/callees analyzed>
 * 
 * Functions using this struct:
 *   - 0x401000 (initialization)
 *   - 0x401100 (field access)
 *   - 0x401200 (destruction)
 */

// Estimated size: 0x48 bytes
// Confidence: High / Medium / Low

struct suggested_name {
    /* 0x00 */ void *vtable;           // vtable pointer, called: (*(*this))()
    /* 0x08 */ int refcount;           // reference count, has ++/-- operations
    /* 0x0C */ int flags;              // flags, AND with 0x1, 0x2
    /* 0x10 */ char *name;             // string, passed to strlen/printf
    /* 0x18 */ void *data;             // data pointer
    /* 0x20 */ size_t size;            // size field
    /* 0x28 */ struct node *next;      // linked list next pointer
    /* 0x30 */ struct node *prev;      // linked list prev pointer
    /* 0x38 */ callback_fn handler;    // callback function
    /* 0x40 */ void *user_data;        // user data
};

// Field access examples:
// 0x401000: *(this + 0x08) += 1;     // refcount++
// 0x401100: printf("%s", *(this + 0x10));  // print name

Related skills

How it compares

Use rev-struct over manual IDA struct editing when you need systematic recovery of unknown layouts from memory access patterns across multiple functions.

FAQ

Does rev-struct require IDA Pro MCP?

MCP is preferred when connected, but IDA-NO-MCP exported decompile files are supported as a fallback.

How are struct fields inferred?

From memory access patterns, pointer arithmetic, and repeated offsets across functions and call chains.

What if no IDA access is available?

The skill prompts the user to connect IDA Pro MCP or export data with the IDA-NO-MCP plugin.

Is Rev Struct safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Securityappsec

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.