Analyzing position independent code

From meltedinhex/analyst-ai-pack · View interactive version

Analyzing position independent code is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Analyzes position-independent code and shellcode by identifying GetPC/PEB-walk techniques, API-hash resolution loops, and relocation-free addressing so the payload can be disassembled at the right base. Activates for requests to analyze position-independent code, identify PIC techniques, or understa

How to use this skill

Skill file

Analyzing Position-Independent Code

When to Use

need to understand its technique before disassembly.

Do not use this to execute the code — analyze it statically (and emulate separately if needed).

Treat the blob as malicious.

Prerequisites

Safety & Handling

Workflow

Step 1: Identify PIC techniques

python scripts/analyst.py analyze shellcode.bin

Detects GetPC stubs (call $+5/fnstenv), PEB access (fs:[30]/gs:[60]), API-hash loops

(lodsb + ror), and stack-string construction.

Step 2: Determine architecture and base behavior

Confirm 32- vs 64-bit PEB access and how the code computes its own base for relative addressing.

Step 3: Map API resolution

Note the hashing algorithm and that resolved APIs are obtained by walking the PEB→LDR→export tables

(pair with the API-hash resolver skill).

Step 4: Disassemble at the right base

Load the blob at the inferred base/entry in a disassembler/emulator and proceed.

Validation

Pitfalls

References

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.