GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add a project overview and document running the CLI from PATH. · CKAndroidProject/vFrida@d14b861

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ABOUT.md
  • README.md
  • README.zh-CN.md
  • docs
    • vfrida-cli.html
    • vfrida-wechat.html
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ABOUT.md‎

Copy file name to clipboard
+67Lines changed: 67 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# 关于 vFrida
2+
3+
vFrida 是一个跑在 Android 上的应用分身沙箱,内置一套类 Frida 的脚本运行时。它把目标应用装进自己的进程空间里运行,再用一个命令行客户端把 JavaScript 送进宿主或某个分身,拿回日志和 RPC 结果。
4+
5+
- 宿主包名:`com.android.vfrida`
6+
- 引擎包名:`com.android.bb`
7+
- 命令行:`vfrida`、`vfrida-ps`(脚本在 `tools/`,加进 PATH 后可直接调用)
8+
- 运行架构:仅 **arm64-v8a**
9+
- 开源地址:<https://github.com/vFrida/vFrida>
10+
- 许可:Apache License 2.0
11+
12+
## 能做什么
13+
14+
- **应用分身**:同一份 APK 可以开多份,用 `userId` 区分,0 是第一份;分身不是系统里的普通安装,而是跑在宿主包内。
15+
- **虚拟系统服务**:包管理、活动栈、通知、账户、位置、权限等系统服务在沙箱内有一份虚拟实现,分身看到的是自己的数据目录、包列表和进程视图。
16+
- **IO 重定向**:文件路径按前缀树重定向到分身私有目录,`/sdcard` 与物理根有单独策略,隐藏 Root 始终开启。
17+
- **同 uid 伪装**:分身进程的 cmdline、进程计数、磁盘目录按宿主 uid 的口径对齐,避免被目标应用的同 uid 检查发现。
18+
- **类 Frida 脚本**:QuickJS 执行 JavaScript,提供 `Interceptor`、`Stalker`、`Java`、`Memory`、`Module`、`Process`、`console` 与 `rpc.exports`。
19+
- **命令行注入**:`-f` 拉起并注入、`-n` 按进程名挂接、`-p` 按 pid 挂接、`--list` 列出已注册进程、`--call` 调用 RPC。
20+
21+
## 进程模型
22+
23+
| 进程 | 作用 |
24+
| --- | --- |
25+
| `com.android.vfrida` | 宿主界面主进程,负责装包、启动分身,本身也是一个 agent |
26+
| `com.android.vfrida:black` | 虚拟系统进程,监听 TCP `127.0.0.1:2408`,承载 Binder 服务与分身拉起 |
27+
| `com.android.vfrida:pN` | 分身/桩进程,伪造 cmdline,脚本与日志经 Binder 往返 |
28+
29+
开发机只连 `:black` 的环回端口,不直接连分身。USB 模式下客户端会自己执行 `adb forward tcp:0 tcp:2408`。
30+
31+
## 模块
32+
33+
| 模块 | 说明 |
34+
| --- | --- |
35+
| `app` | 宿主 UI:应用列表、分身管理、设置、虚拟定位 |
36+
| `core` | 沙箱引擎 `com.android.bb`:Binder 虚拟服务、包管理、JNI 与 C++ 运行时(QuickJS、Frida Gum、Capstone、xdl) |
37+
| `black` | 替换进分身的 framework 类(`black.*`),承接文件、线程、WebView 等系统调用 |
38+
| `api` | 编译期使用的 Android framework 隐藏 API 桩 |
39+
| `reflection` | 隐藏 API 反射封装与注解 |
40+
| `compiler` | 注解处理器,为反射生成代理代码 |
41+
42+
## 构建
43+
44+
```bash
45+
./gradlew :app:assembleDebug # 产物 app/build/outputs/apk/debug/
46+
./gradlew :app:assembleRelease
47+
```
48+
49+
- compileSdk 35、minSdk 21、targetSdk 28
50+
- JDK 21、NDK 25.2.9519653
51+
- APK 只打包 `arm64-v8a`;其它 ABI 没有 JS 运行时,RPC 会返回 `js runtime is not in vfrida`
52+
53+
## 限制
54+
55+
- 只支持 arm64,非 arm64 构建不带脚本运行时。
56+
- 分身共享宿主 uid,依赖虚拟化而非独立安装;与系统级多开/工作资料不能混用。
57+
- 目标应用如果做深入的完整性校验,仍可能识别出沙箱环境。
58+
- 签名依赖本地 `app/vfrida-release.jks`(未入库)。
59+
60+
## 文档
61+
62+
- `README.md` / `README.zh-CN.md`:安装与命令行用法
63+
- `docs/vfrida-cli.html`:进程、通道、帧、拉起与挂接的细节
64+
- `docs/vapp-runtime.html`:分身运行时与虚拟系统服务
65+
- `docs/io-redirect.html`:文件路径重定向
66+
- `docs/same-uid.html`:同 uid 下的进程与目录伪装
67+
- `docs/service-hijack.html`、`docs/svc-hijack.html`:系统服务劫持
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+16-10Lines changed: 16 additions & 10 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# vFrida
44

5+
Source: https://github.com/vFrida/vFrida
6+
57
`tools/vfrida` is the command-line client. It sends a script into the vFrida host or into one cloned app and prints the logs back. The flags follow the Frida command line: spawn with `-f`, attach with `-n` or `-p`, load a file with `-l`.
68

79
vFrida itself is an Android app-cloning sandbox. The host package is `com.android.vfrida`. A cloned app runs inside that package, not as a normal install. Install the APK, open the clone from the vFrida UI, then use the vFrida CLI. Scripts run on **arm64** only, in QuickJS, with Frida Gum's Interceptor and Stalker.
@@ -12,26 +14,28 @@ The dev machine never connects to a clone directly. It only talks to `com.androi
1214

1315
## Spawn, attach, list
1416

15-
From the repo root, with one device plugged in:
17+
Put `tools/` on PATH once (or add it to your shell profile), then from the repo root with one device plugged in:
1618

1719
```bash
20+
export PATH="$PWD/tools:$PATH"
21+
1822
# Stop the clone on user 0, start it, inject, then let it continue
19-
python3 tools/vfrida -U -f com.example.app -l tools/test_js_api.js
23+
vfrida -U -f com.example.app -l tools/test_js_api.js
2024

2125
# Attach to a clone that is already running
22-
python3 tools/vfrida -U -n com.example.app -l tools/test_native_hook.js
26+
vfrida -U -n com.example.app -l tools/test_native_hook.js
2327

2428
# Attach to a pid, including the host process com.android.vfrida
25-
python3 tools/vfrida -U -p 12345 -l tools/test_js_api.js
29+
vfrida -U -p 12345 -l tools/test_js_api.js
2630

2731
# One line of script, no file
28-
python3 tools/vfrida -U -n com.example.app -e 'console.log("hi")'
32+
vfrida -U -n com.example.app -e 'console.log("hi")'
2933

3034
# Registered processes, JSON
31-
python3 tools/vfrida -U --list
35+
vfrida -U --list
3236

3337
# Same list, as a table
34-
python3 tools/vfrida-ps -U
38+
vfrida-ps -U
3539
```
3640

3741
`-f` is spawn. The client sends the script, then `UNLOCK`. The clone waits on the startup path until that frame arrives, so the script is in place before `Application.onCreate`. `-f` always uses user 0.
@@ -41,13 +45,13 @@ python3 tools/vfrida-ps -U
4145
More than one phone:
4246

4347
```bash
44-
python3 tools/vfrida -D <serial> -n com.example.app -l tools/test_js_api.js
48+
vfrida -D <serial> -n com.example.app -l tools/test_js_api.js
4549
```
4650

4751
If the port is already forwarded, skip adb:
4852

4953
```bash
50-
python3 tools/vfrida -H 127.0.0.1:2408 -n com.example.app -l tools/test_js_api.js
54+
vfrida -H 127.0.0.1:2408 -n com.example.app -l tools/test_js_api.js
5155
```
5256

5357
`-H`, `-U`, and `-D` pick the connection. Pass only one of them. Pass only one of `-f`, `-n`, and `-p`.
@@ -73,8 +77,10 @@ A script is plain JavaScript. These samples live in `tools/`:
7377
Call an export after the script loads. `--args` is a JSON array and lines up with the matching `--call`:
7478

7579
```bash
76-
python3 tools/vfrida -U -n com.example.app -l tools/test_rpc.js --call ping --args '["hi"]'
80+
vfrida -U -n com.example.app -l tools/test_rpc.js --call ping --args '["hi"]'
7781
```
7882

7983
That prints `pong hi`, then keeps waiting for logs.
8084

85+
86+
Project overview and module map: [ABOUT.md](ABOUT.md).
Collapse file

‎README.zh-CN.md‎

Copy file name to clipboardExpand all lines: README.zh-CN.md
+16-11Lines changed: 16 additions & 11 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[English](README.md)
22

3-
43
# vFrida
54

5+
开源地址:https://github.com/vFrida/vFrida
6+
67
`tools/vfrida` 是命令行客户端。它把一段脚本送进 vFrida 宿主,或送进某一个分身,再把日志打回来。参数对齐 Frida 命令行:`-f` 拉起,`-n` 或 `-p` 挂上,`-l` 加载脚本。
78

89
vFrida 本身是一个 Android 应用分身沙箱。宿主包名 `com.android.vfrida`。分身跑在这个包里,不是系统里单独装出来的应用。先装进沙箱,从 vFrida 界面打开分身,再用 vFrida 命令行。脚本只在 **arm64** 上跑,由 QuickJS 执行,带 Frida Gum 的 Interceptor 和 Stalker。
@@ -13,26 +14,28 @@ vFrida 本身是一个 Android 应用分身沙箱。宿主包名 `com.android.vf
1314

1415
## 拉起、挂接、列表
1516

16-
仓库根目录,只插着一台设备:
17+
先把 `tools/` 加进 PATH(也可写进 `~/.zshrc`),然后在仓库根目录、只插一台设备:
1718

1819
```bash
20+
export PATH="$PWD/tools:$PATH"
21+
1922
# 停掉 user 0 上的分身,再启动、注入,然后放行
20-
python3 tools/vfrida -U -f com.example.app -l tools/test_js_api.js
23+
vfrida -U -f com.example.app -l tools/test_js_api.js
2124

2225
# 挂到已经在跑的分身
23-
python3 tools/vfrida -U -n com.example.app -l tools/test_native_hook.js
26+
vfrida -U -n com.example.app -l tools/test_native_hook.js
2427

2528
# 按 pid 挂,宿主界面进程 com.android.vfrida 也可以
26-
python3 tools/vfrida -U -p 12345 -l tools/test_js_api.js
29+
vfrida -U -p 12345 -l tools/test_js_api.js
2730

2831
# 不写文件,直接塞一行
29-
python3 tools/vfrida -U -n com.example.app -e 'console.log("hi")'
32+
vfrida -U -n com.example.app -e 'console.log("hi")'
3033

3134
# 已经注册的进程,JSON
32-
python3 tools/vfrida -U --list
35+
vfrida -U --list
3336

3437
# 同一份列表,打成表
35-
python3 tools/vfrida-ps -U
38+
vfrida-ps -U
3639
```
3740

3841
`-f` 是拉起。客户端先把脚本送进去,再送 `UNLOCK`。分身在启动路径上等到这一帧,所以脚本会赶在 `Application.onCreate` 之前就位。`-f` 只用 user 0。
@@ -42,13 +45,13 @@ python3 tools/vfrida-ps -U
4245
多台手机:
4346

4447
```bash
45-
python3 tools/vfrida -D <serial> -n com.example.app -l tools/test_js_api.js
48+
vfrida -D <serial> -n com.example.app -l tools/test_js_api.js
4649
```
4750

4851
端口已经转好了,就不用 adb:
4952

5053
```bash
51-
python3 tools/vfrida -H 127.0.0.1:2408 -n com.example.app -l tools/test_js_api.js
54+
vfrida -H 127.0.0.1:2408 -n com.example.app -l tools/test_js_api.js
5255
```
5356

5457
`-H`、`-U`、`-D` 选连接,只写其中一个。`-f`、`-n`、`-p` 也只写其中一个。
@@ -72,8 +75,10 @@ python3 tools/vfrida -H 127.0.0.1:2408 -n com.example.app -l tools/test_js_api.j
7275
脚本加载之后可以调导出。`--args` 是 JSON 数组,和对应的 `--call` 对齐:
7376

7477
```bash
75-
python3 tools/vfrida -U -n com.example.app -l tools/test_rpc.js --call ping --args '["hi"]'
78+
vfrida -U -n com.example.app -l tools/test_rpc.js --call ping --args '["hi"]'
7679
```
7780

7881
这行会打出 `pong hi`,然后继续等日志。
7982

83+
84+
项目概览与模块说明见 [ABOUT.md](ABOUT.md)。
Collapse file

‎docs/vfrida-cli.html‎

Copy file name to clipboardExpand all lines: docs/vfrida-cli.html
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,12 @@ <h2 id="script">脚本落到哪</h2>
364364
</div>
365365

366366
<h2 id="cli">命令行</h2>
367-
<pre><code>python3 tools/vfrida -U -f com.example.app -l tools/test_js_api.js
368-
python3 tools/vfrida -U -n com.example.app -l tools/test_native_hook.js
369-
python3 tools/vfrida -D &lt;serial&gt; -p 1234 -e 'console.log(1)'
370-
python3 tools/vfrida -H 127.0.0.1:2408 -n com.android.vfrida --list
371-
python3 tools/vfrida-ps -U</code></pre>
367+
<p>先把 <code>tools</code> 加进 PATH:<code>export PATH="$PWD/tools:$PATH"</code>(或写进 <code>~/.zshrc</code>)。下面的命令都在仓库根目录执行。</p>
368+
<pre><code>vfrida -U -f com.example.app -l tools/test_js_api.js
369+
vfrida -U -n com.example.app -l tools/test_native_hook.js
370+
vfrida -D &lt;serial&gt; -p 1234 -e 'console.log(1)'
371+
vfrida -H 127.0.0.1:2408 -n com.android.vfrida --list
372+
vfrida-ps -U</code></pre>
372373
<p><code>-l</code> 可以重复,文件按顺序拼成一份源码。<code>-e</code> 追加在文件后面。<code>--call 方法名 --args '["a",1]'</code> 在源码发出之后调用,<code>--args</code> 必须是 JSON 数组,和 <code>--call</code> 按顺序配对。客户端开了 TCP keepalive。spawn 的连接超时是 45 秒,attach 是 15 秒。连上之后 <code>follow</code> 会一直打印 <code>LOG</code>,直到对端关掉或收到 <code>EXIT</code>。</p>
373374

374375
</main>
Collapse file

‎docs/vfrida-wechat.html‎

Copy file name to clipboardExpand all lines: docs/vfrida-wechat.html
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,12 @@ <h2>脚本落到哪</h2>
163163
<p><code>NativeCore.onSpindleScript</code> 把字节按 UTF-8 转成字符串。如果有人调用过 <code>setScriptHandler</code>,就在当前线程回调 <code>onScript</code>。没有 handler 时,只打一条日志。</p>
164164
<blockquote><p>脚本到达进程后,<code>NativeCore.onSpindleScript</code> 先交给已注册的 <code>ScriptHandler</code>,再调用 <code>spindleRunJs</code>。arm64 上由 QuickJS 执行,提供 <code>Interceptor</code>、<code>Stalker</code>、<code>Java</code>、<code>Memory</code>、<code>Process</code> 和 <code>console</code>。<code>console.log</code> 经 <code>onSpindleLog</code> 回到 <code>:black</code>,再写进开发机的 TCP。RPC 调用 <code>rpc.exports</code>。工程只编译 arm64,所以发布的 APK 带这个运行时;非 arm64 的构建会回 <code>{"ok":false,"e":"js runtime is not in vfrida"}</code>。</p></blockquote>
165165
<h2>命令行</h2>
166-
<pre>python3 tools/vfrida -U -f com.example.app -l tools/test_js_api.js
167-
python3 tools/vfrida -U -n com.example.app -l tools/test_native_hook.js
168-
python3 tools/vfrida -D &lt;serial&gt; -p 1234 -e 'console.log(1)'
169-
python3 tools/vfrida -H 127.0.0.1:2408 -n com.android.vfrida --list
170-
python3 tools/vfrida-ps -U</pre>
166+
<p>先把 <code>tools</code> 加进 PATH:<code>export PATH="$PWD/tools:$PATH"</code>(或写进 <code>~/.zshrc</code>)。下面的命令都在仓库根目录执行。</p>
167+
<pre>vfrida -U -f com.example.app -l tools/test_js_api.js
168+
vfrida -U -n com.example.app -l tools/test_native_hook.js
169+
vfrida -D &lt;serial&gt; -p 1234 -e 'console.log(1)'
170+
vfrida -H 127.0.0.1:2408 -n com.android.vfrida --list
171+
vfrida-ps -U</pre>
171172
<p><code>-l</code> 可以重复,文件按顺序拼成一份源码。<code>-e</code> 追加在文件后面。<code>--call 方法名 --args '["a",1]'</code> 在源码发出之后调用,<code>--args</code> 必须是 JSON 数组,和 <code>--call</code> 按顺序配对。客户端开了 TCP keepalive。spawn 的连接超时是 45 秒,attach 是 15 秒。连上之后 <code>follow</code> 会一直打印 <code>LOG</code>,直到对端关掉或收到 <code>EXIT</code>。</p>
172173
<p>依据 <code>core/src/main/cpp/hook/spindle_server.cpp</code>、<code>BSpindleService</code> 和 <code>tools/vfrida</code>。</p>
173174
</article>

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.