Emulating shellcode with unicorn

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

Emulating shellcode with unicorn is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Emulates position-independent shellcode in a controlled CPU emulator (Unicorn) to trace executed instructions, memory writes, and decoded second stages without running it on a real host. Activates for requests to emulate shellcode, trace a decoder stub, or recover a stage unpacked at runtime by shel

How to use this skill

Skill file

Emulating Shellcode With Unicorn

When to Use

behavior via emulation rather than native execution.

Do not use native execution for this — emulation contains the code. Unsupported API calls must

be stubbed; emulation is not a full Windows environment.

Prerequisites

reports that emulation is unavailable and still does static prep).

Safety & Handling

password-protected.

Workflow

Step 1: Prepare and validate the blob

python scripts/analyst.py prep shellcode.bin --arch x64

Reports size, detected architecture hints, and whether Unicorn is available.

Step 2: Emulate with an instruction/memory trace

python scripts/analyst.py emulate shellcode.bin --arch x64 --max-insns 200000

Maps the code into emulator memory, sets up a minimal stack, hooks instruction and memory-write

events, and stops on a self-modified region or instruction budget.

Step 3: Dump decoded stages

If the shellcode writes a new executable region, dump that buffer for follow-on analysis.

Step 4: Document

Record the entry behavior, decoded stage offset, and any observed (stubbed) API references.

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.