From b9fdfc5f4fbfc98192f1698d622503f6af302c14 Mon Sep 17 00:00:00 2001 From: tkgstrator Date: Wed, 8 Apr 2026 09:14:40 +0000 Subject: [PATCH] feat(tweak): add AppbootKeyExtract for Netflix appboot key extraction Introduces a new tweak project to extract Diffie-Hellman and session keys from the Netflix iOS app using Security.framework and function hooks. Updates documentation for improved iOS device connectivity via USB and iproxy, and clarifies setup instructions. Adjusts devcontainer port forwarding to expose only necessary ports. Relates to planned appboot DH key extraction workflow. --- .devcontainer/devcontainer.json | 6 +- .vscode/settings.json | 4 +- README.md | 75 +++------ docs/plans/appboot_privkey_extract.md | 70 ++++++++ .../AppbootKeyExtract/AppbootKeyExtract.plist | 13 ++ packages/tweak/AppbootKeyExtract/Makefile | 19 +++ .../Sources/AppbootKeyExtract/Tweak.x.swift | 1 + .../Sources/AppbootKeyExtractC/Tweak.m | 155 ++++++++++++++++++ packages/tweak/AppbootKeyExtract/control | 9 + 9 files changed, 292 insertions(+), 60 deletions(-) create mode 100644 docs/plans/appboot_privkey_extract.md create mode 100644 packages/tweak/AppbootKeyExtract/AppbootKeyExtract.plist create mode 100644 packages/tweak/AppbootKeyExtract/Makefile create mode 100644 packages/tweak/AppbootKeyExtract/Sources/AppbootKeyExtract/Tweak.x.swift create mode 100644 packages/tweak/AppbootKeyExtract/Sources/AppbootKeyExtractC/Tweak.m create mode 100644 packages/tweak/AppbootKeyExtract/control diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 856759b..43af153 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -44,11 +44,7 @@ "installGradle": false } }, - "forwardPorts": [8080, 9080], - "portsAttributes": { - "8080": { "label": "mitmweb", "protocol": "http" }, - "9080": { "label": "mitmproxy", "protocol": "http" } - }, + "forwardPorts": [9080], "otherPortsAttributes": { "onAutoForward": "ignore" }, diff --git a/.vscode/settings.json b/.vscode/settings.json index bd23ee8..162d807 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "gitdoc.ai.customInstructions": "Generate a commit message in Japanese following the Conventional Commits specification and `commitlint` rules. Use the format `(): ` and choose `` from `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `chore`, `refactor`, `revert`, `format`, `test`. Limit `` to 72 characters. If `` starts with an English word, it must be in lowercase.", + "gitdoc.ai.customInstructions": "Generate a commit message in English following the Conventional Commits specification and `commitlint` rules. Use the format `(): ` and choose `` from `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `chore`, `refactor`, `revert`, `format`, `test`. Limit `` to 72 characters. If `` starts with an English word, it must be in lowercase.", "gitdoc.ai.enabled": true, "gitdoc.ai.model": "gpt-4o", "gitdoc.autoPull": "onPush", @@ -11,7 +11,7 @@ ], "gitdoc.pushMode": "push", "gitdoc.timeZone": "Asia/Tokyo", - "gitlens.ai.generateCommitMessage.customInstructions": "Generate a commit message in Japanese following the Conventional Commits specification and `commitlint` rules. Use the format `(): ` and choose `` from `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `chore`, `refactor`, `revert`, `format`, `test`. Limit `` to 72 characters. If `` starts with an English word, it must be in lowercase.", + "gitlens.ai.generateCommitMessage.customInstructions": "Generate a commit message in English following the Conventional Commits specification and `commitlint` rules. Use the format `(): ` and choose `` from `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `chore`, `refactor`, `revert`, `format`, `test`. Limit `` to 72 characters. If `` starts with an English word, it must be in lowercase.", "remote.localPortHost": "allInterfaces", "python.terminal.activateEnvironment": false, "files.exclude": { diff --git a/README.md b/README.md index e83375e..7ec1f83 100644 --- a/README.md +++ b/README.md @@ -71,20 +71,26 @@ DevContainer で構築済み。`Rebuild Container` で全ツールが揃う。 ## macOS ホスト設定 -DevContainer はDocker Desktop の Linux VM 内で動作するため、LAN 上のデバイス (iOS/Android) と直接通信できない。以下の設定で macOS を踏み台にして SSH / Frida を中継する。 +DevContainer は Docker Desktop の Linux VM 内で動作するため、iOS デバイスと直接通信できない。USB 接続の iproxy を経由することで、WiFi の IP 変更やネットワーク不安定の影響を受けずに接続できる。 -### 1. リモートログインを有効化 - -**システム設定 → 一般 → 共有 → リモートログイン** をオンにする。 - -### 2. SSH 公開鍵を登録 - -コンテナ内の鍵を macOS の authorized_keys に追加する: +### 1. iproxy のインストール (macOS) ```bash -cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys +brew install libimobiledevice ``` +### 2. iproxy の起動 (macOS) + +iPhone を USB で接続した状態で: + +```bash +iproxy 2222 22 & +iproxy 27042 27042 & +``` + +- `2222 → 22`: SSH 接続用 +- `27042 → 27042`: Frida 接続用 + ### 3. VS Code ポートフォワーディング設定 `.vscode/settings.json` に以下を追加して、mitmproxy のポートを LAN に公開する: @@ -93,44 +99,9 @@ cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys "remote.localPortHost": "allInterfaces" ``` -### 4. SSH config を設定 +### 4. SSH config (コンテナ内) -`~/.ssh/config` に以下を追加して、macOS を踏み台にした ProxyJump を設定する。 - -**エイリアスあり** (macOS ホストを再利用する場合): - -```sshconfig -Host docker-host - HostName host.docker.internal - User - -Host iPhone - HostName <デバイスの LAN IP> - User root - ProxyJump docker-host - LocalForward 27042 127.0.0.1:27042 -``` - -**エイリアスなし** (シンプルに一つで完結): - -```sshconfig -Host iPhone - HostName <デバイスの LAN IP> - User root - ProxyJump @host.docker.internal - LocalForward 27042 127.0.0.1:27042 -``` - -**iproxy (USB 経由)** — macOS ユーザー名やデバイス IP が不要: - -macOS 側で iproxy を起動しておく: - -```bash -iproxy 2222 22 & -iproxy 27042 27042 & -``` - -SSH config: +`~/.ssh/config`: ```sshconfig Host iPhone @@ -139,15 +110,13 @@ Host iPhone Port 2222 ``` -Frida は `frida -H 127.0.0.1` ではなく `frida -H host.docker.internal` で接続する。 - ### 接続経路 | 用途 | 方向 | 経路 | |------|------|------| -| **SSH** | コンテナ → デバイス | `ssh iPhone` (ProxyJump で macOS を経由) | -| **Frida** | コンテナ → デバイス | `ssh -fN iPhone` でトンネル確立後、`frida -H 127.0.0.1` で接続 | -| **mitmproxy** | デバイス → コンテナ | デバイスのプロキシを macOS の LAN IP:9080 に設定 | +| **SSH** | コンテナ → デバイス | `ssh iPhone` → `host.docker.internal:2222` → iproxy (USB) → デバイス:22 | +| **Frida** | コンテナ → デバイス | `frida -H host.docker.internal` → iproxy (USB) → デバイス:27042 | +| **mitmproxy** | デバイス → コンテナ | デバイスの WiFi プロキシを macOS の LAN IP:9080 に設定 | ## 使い方 @@ -161,10 +130,10 @@ uv run python tools/run.py packages/frida/