Pyinstaller Unpackerのロゴ

Pyinstaller Unpacker

コミュニティ
ptn1411
pyinstaller-unpacker

PyInstallerの抽出と逆コンパイルを完全自動化するパイプラインです。onefile/onedirバンドルから.pycを抽出し、ヘッダーを修正したうえで、pycdc/uncompyle6/decompile3のフォールバック方式により一括で逆コンパイルします。

Add to TypingMind

概要

公開者ptn1411
リポジトリskill
スキル名pyinstaller-unpacker
スター
275
フォーク
133
同梱ファイル
3
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 3個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    ptn1411がGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Pyinstaller Unpacker」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/ptn1411/skill/tree/main/pyinstaller-unpacker
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ptn1411/skill.git /tmp/skill
mkdir -p .claude/skills
cp -r /tmp/skill/pyinstaller-unpacker .claude/skills/pyinstaller-unpacker
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPyinstaller Unpackerを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にPyinstaller Unpackerを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Pyinstaller Unpackerは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

PyInstaller Unpacker & Decompiler

Extract and decompile Python source from PyInstaller-bundled executables (.exe/.elf).

Language rule: All skill instructions use English. Final summary presented to the user must be in Vietnamese.


0. Authorization & Routing

Operates under MASTER_POLICY.md §1-§2.

Sibling skillWhen
binary-identifierUpstream — confirms target is PyInstaller
nuitka-decryptorIf misidentified — Nuitka ≠ PyInstaller
writerpro-pentestDownstream — keygen from recovered source
javascript-deobfuscatorIf embedded Electron+PyInstaller hybrid

How PyInstaller Works

source.py → PyInstaller → CArchive → native bootloader + embedded .pyc/.pyz
                              ↓
              MEI magic marker at end of file: b'MEI\x0c\x0b\x0a\x0b\x0e'
              TOC (Table of Contents) lists all embedded files
              PYZ archive contains all imported modules as .pyc

Two modes:

  • Onefile: Single .exe with temp extraction at runtime. Everything in CArchive.
  • Onedir: Directory with main .exe + _internal/ folder containing .pyc/.pyd/.dll.

Key challenge: PyInstaller strips .pyc headers (first 16 bytes: magic + flags + timestamp + size). Must restore before decompilation.


Step 1 — Recon: Confirm PyInstaller

Look for these markers:

  • MEI magic at end of file (8 bytes)
  • Strings: _MEIPASS, _MEI, pyi_rth_, pyiboot
  • Section names or overlay data past PE end
bash
python scripts/unpack_pyinstaller.py --detect-only target.exe
powershell
python scripts\unpack_pyinstaller.py --detect-only target.exe

Step 2 — Extract .pyc Files

bash
python scripts/unpack_pyinstaller.py target.exe --out unpacked/
powershell
python scripts\unpack_pyinstaller.py target.exe --out unpacked\

What it does:

  1. Detect PyInstaller variant (onefile/onedir) and Python version
  2. If pyinstxtractor-ng available → use it (best compatibility)
  3. Fallback → manual CArchive parsing (built-in, no deps)
  4. Fix .pyc headers with correct magic number for detected Python version
  5. Extract PYZ archive (all imported modules)
  6. Write manifest.json listing all extracted files

Step 3 — Decompile .pyc to .py

bash
python scripts/decompile_pyc.py --pyc-dir unpacked/ --out decompiled/
powershell
python scripts\decompile_pyc.py --pyc-dir unpacked\ --out decompiled\

Fallback chain (version-aware):

Python versionPrimarySecondaryLast resort
3.9+pycdcdecompile3dis (bytecode)
3.6–3.8uncompyle6pycdcdis
3.5 and belowuncompyle6—dis

Step 4 — Verify & Analyze

bash
head -50 decompiled/main.py
grep -rn "api_key\|secret\|password\|token\|license" decompiled/

Workflow

1. DETECT    → unpack_pyinstaller.py --detect-only → confirm PyInstaller + version
2. EXTRACT   → unpack_pyinstaller.py → .pyc files + PYZ modules
3. DECOMPILE → decompile_pyc.py → .py source files
4. ANALYZE   → grep for secrets, license logic, endpoints
5. REPORT    → Present findings IN VIETNAMESE

Final Report to User (always in Vietnamese)

📦 Giải nén PyInstaller hoàn tất:

  🔍 Loại          : PyInstaller <onefile|onedir>
  🐍 Python        : <VERSION>
  📁 Files trích xuất: <COUNT> files
  📝 Decompile      : <SUCCESS>/<TOTAL> files thành công

  🔑 Phát hiện đáng chú ý:
    - <secrets, license logic, endpoints>

  💾 Output: decompiled/

  ▶ Bước tiếp theo:
    grep -rn "api_key\|secret" decompiled/

Anti-Patterns

❌ Don't✅ Do
Assume all Python exes are PyInstallerRun binary-identifier first — could be Nuitka, cx_Freeze, py2exe
Skip .pyc header fixPyInstaller strips headers — decompilers fail without them
Use only one decompilerVersion-aware fallback chain catches more files
Ignore PYZ archiveIt contains all imported modules — often more interesting than main script
Decompile without knowing Python versionMagic bytes differ per version — wrong header = wrong output

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Pyinstaller Unpacker」では何ができますか?

PyInstallerの抽出と逆コンパイルを完全自動化するパイプラインです。onefile/onedirバンドルから.pycを抽出し、ヘッダーを修正したうえで、pycdc/uncompyle6/decompile3のフォールバック方式により一括で逆コンパイルします。

TypingMindでPyinstaller Unpackerを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Pyinstaller Unpackerはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPyinstaller Unpackerをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/ptn1411/skill/tree/main/pyinstaller-unpackerを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Pyinstaller Unpackerを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Pyinstaller Unpackerで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPyinstaller Unpackerを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Pyinstaller Unpacker」は無料ですか?

ptn1411がGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇