executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
re-pythonPython 打包/混淆样本分析:PyInstaller/PyArmor/Nuitka/Cython 解包、pyc 版本识别与反编译。 触发词:Python打包、PyInstaller、PyArmor、pyc、python exe、Python 样本、打包样本。
Independent GitHub snapshot · Automated classification · Original documentation governs
参考 [[re-analyze/platform-tips]]——解包/反编译为静态步骤,免沙箱;动态取明文([[re-sandbox]])按最高原则进沙箱。
apt install python3 / dnf install python3 / pacman -S pythonbrew install python(系统自带)choco install pythonpython3 --versionpip install pyinstxtractor-ng 或 GitHub 脚本 python pyinstxtractor.pypyinstxtractor-ng <目标.exe> 运行无报错(无独立 --help 命令)git clone https://github.com/Svenskithesource/PyArmor-Unpacker,按 README 按 PyArmor 版本选三方法之一git clone https://github.com/zrax/pycdc && cd pycdc && cmake . && make./pycdc --helpfile --version按顺序执行,每步产物存档(路径 + sha256,见 [[re-triage]])。
识别打包器:
file sample.exe
strings sample.exe | grep -iE 'PyInstaller|_MEIPASS|pyi-|PyArmor|pyarmor' | head
PyInstaller 版本串、_MEI 临时目录名、pyi- 前缀引导器pyarmor runtime 字符串file 显示普通可执行,无 Python runtime 打包特征)PyInstaller 解包:
pyinstxtractor-ng sample.exe;GitHub 脚本用户:python pyinstxtractor.py sample.exepython pyinstxtractor.py sample.exe
# 输出 sample.exe_extracted/ 目录,含 PYZ-00.pyz(依赖归档)与主脚本 .pyc
PYZ-00.pyz_extracted/;模块清单可用 archive_viewer.py 查看PyArmor 解包(步骤 1 检测到 PyArmor 时):
pyc 版本识别:
python3 -c "import struct,sys; print(struct.unpack('<H', open('main.pyc','rb').read(2))[0])"
0d33=3.6、0d42=3.7、0d55=3.8、0d61=3.9、0d6f=3.10、0da7=3.11、0dcb=3.12python3 -c "import importlib.util; print(hex(int.from_bytes(importlib.util.MAGIC_NUMBER[:2],'little')))")dis/marshal 兜底反编译与清理:
pycdc main.pyc > main_decompiled.py # 或匹配版本 python 的 dis 模块
dis 字节码级分析关键函数,或转 [[re-binary-core]] 深度还原marshal.loads 验证 code 对象,或交给 pycdc