Analyzing compiled python malware

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

Analyzing compiled python malware is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Analyzes Python-based malware packaged as PyInstaller/py2exe executables by detecting the packer, locating the embedded archive, and identifying bundled .pyc modules for extraction and decompilation. Activates for requests to analyze compiled Python malware, unpack a PyInstaller binary, or extract p

How to use this skill

Skill file

Analyzing Compiled Python Malware

When to Use

need to identify the packer and locate the embedded Python modules.

Do not use this to run the executable — it identifies and locates the embedded archive

statically. Decompile extracted .pyc in an isolated environment.

Prerequisites

Safety & Handling

Workflow

Step 1: Detect the packer

python scripts/analyst.py detect sample.exe

Looks for PyInstaller markers (pyi-, PYZ-00.pyz, the MEI CArchive cookie MEI\014\013\012\013\016),

py2exe (PYTHONSCRIPT, zipfile.zip), and embedded python3x.dll references.

Step 2: Locate the embedded archive

Find the CArchive cookie near the end of the file and report the offset and the embedded Python

version string (python3.x).

Step 3: Extract and decompile

Use a PyInstaller extractor to dump the archive, then decompile .pyc (matching the detected

Python version) for source recovery.

Step 4: Analyze the source

Review the recovered Python for C2, persistence, and capability; map to ATT&CK.

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.