yaron4u/pi-android-re
GitHub: yaron4u/pi-android-re
为 Pi 编码智能体提供 Android 逆向工程能力的技能插件,涵盖静态反编译分析和动态 Frida 插桩两套完整工作流。
Stars: 7 | Forks: 0
# pi-android-re
用于 [Pi 编程智能体](https://pi.dev) 的 Android 逆向工程技能。静态分析(反编译、API 提取、调用流追踪)和动态分析(Frida hooking、SSL pinning 绕过、Root 检测绕过、反插桩规避)。
## 前置条件
- 已安装 [Pi 编程智能体](https://pi.dev)(`npm install -g @mariozechner/pi-coding-agent`)
- 在 `~/.pi/agent/settings.json` 中配置了 [Context7 MCP](https://github.com/upstash/context7)(推荐用于 API 签名验证)
## 安装
```
git clone https://github.com/yaron4u/pi-android-re.git
cd pi-android-re
bash install.sh
```
安装程序会将技能、提示词和 AGENTS.md 复制到 `~/.pi/agent/`,并在 `~/.local/bin/` 中创建 `apk-*` CLI 包装脚本。
## 使用说明
### 模式选择
启动 Pi 并输入:
| 命令 | 模式 |
| -------- | ------------------------------------------------------------ |
| `/static` | 静态分析 -- 反编译 APK、提取 API、追踪调用流 |
| `/dynamic` | 动态分析 -- Frida hooking、运行时绕过、插桩 |
Pi 也会根据你的消息自动检测模式。比如输入“反编译这个 APK”会加载静态模式。输入“写一个 Frida hook”会加载动态模式。
### 静态分析
5 阶段工作流:**依赖项 -> 反编译 -> 分析结构 -> 追踪调用流 -> 提取 API**。
```
apk-check-deps # verify environment
apk-install-dep java # install missing deps
apk-decompile app.apk # decompile with jadx (default)
apk-decompile --engine both --deobf app.apk # both engines + deobfuscation
apk-find-apis output/sources/ --retrofit # extract Retrofit endpoints
```
### 动态分析 (Frida)
涵盖:
- Root 检测绕过(RootBeer、自定义检查、System.exit)
- SSL pinning 绕过(SSLContext、OkHttp、Conscrypt、TrustKit)
- Anti-Frida 规避(strstr、/proc/self/maps、端口扫描)
- 生物识别绕过(BiometricPrompt、FingerprintManager)
- 加密监控(Cipher、SecretKey)
- Native 插桩(Interceptor、特征扫描、CModule)
## 文件结构
```
pi-android-re/
AGENTS.md # Global persona + mode selector
install.sh # One-command installer
prompts/
static.md # /static prompt template
dynamic.md # /dynamic prompt template
skills/
android-static-analysis/
SKILL.md # 5-phase decompilation workflow
scripts/
check-deps.sh # Verify Java, jadx, vineflower, dex2jar
install-dep.sh # Auto-install missing dependencies
decompile.sh # Decompile APK/XAPK/JAR/AAR
find-api-calls.sh # Extract API endpoints from sources
references/
setup-guide.md # Dependency installation guide
jadx-usage.md # jadx CLI reference
fernflower-usage.md # Fernflower/Vineflower reference
api-extraction-patterns.md # Grep patterns for API discovery
call-flow-analysis.md # Call flow tracing techniques
android-dynamic-analysis/
SKILL.md # Frida coding standards + examples
```
## 静态分析依赖项
必需:**Java JDK 17+**、**jadx**
可选(推荐):**Vineflower/Fernflower**、**dex2jar**、**apktool**、**adb**
安装后运行 `apk-check-deps` 查看缺失的依赖。使用 `apk-install-dep ` 进行安装。
## 致谢
- 静态分析脚本改编自 [SimoneAvogadro/android-reverse-engineering-skill](https://github.com/SimoneAvogadro/android-reverse-engineering-skill)(Apache 2.0)
- 动态分析标准基于生产环境的 Frida 工作流
## 许可证
Apache 2.0
标签:AI编程助手, Android逆向工程, API提取, APK反编译, Frida Hook, jadx, JS文件枚举, Pi编程代理, Retrofit, SSL Pinning Bypass, T1027, T1059, T1574, T1622, 云安全监控, 代码混淆, 反调试对抗, 安全技能插件, 应用安全, 目录枚举, 移动安全, 绕过Root检测, 网络安全, 自动化逆向, 调用流追踪, 隐私保护, 静态分析