REA:利用编码代理进行软件逆向工程与逻辑还原
REA Reverse – Engineer Anything
Reverse engineering, with your coding agent
逆向工程,借助你的编码代理
Find out how
了解如何
software works.
软件的工作原理。
REA gives your agent the tools to inspect a program and explain what it does.
REA 为你的代理提供检查程序并解释其功能的工具。
See how REA works ↓ Setup guide Showcases →
查看 REA 的工作原理 ↓ 设置指南 展示案例 →
Already know RE? Skip to analysis guides →
已了解 RE?直接跳转到分析指南 →
Set up REA
设置 REA
Copy this into your coding agent:
将其复制到你的编码代理中:
Your coding agent Copy
你的编码代理 复制
›Install REA and connect it to this coding agent using npx rea-agents@latest setup. Show me the setup plan for approval, then verify the installation.
› 使用 npx rea-agents@latest setup 安装 REA 并将其连接到此编码代理。向我展示设置计划以供审批,然后验证安装。
Or run this in your terminal:
或在终端中运行此命令:
npx rea-agents@latest setup Copy
npx rea-agents@latest setup 复制
Approve the setup plan, then restart your agent.
批准设置计划,然后重启你的代理。
What is reverse engineering?
什么是逆向工程?
Finding out how software works by examining the program itself.
通过检查程序本身来了解软件的工作原理。
The goal: understand a feature well enough to explain it, change it or rebuild it.
目标:充分理解某个功能,以便能够解释它、修改它或重建它。
One question: why does Calculator give 220 for 200 + 10%?
一个问题:为什么计算器在计算 200 + 10% 时给出 220?
Before REA · You investigate it yourself
使用 REA 之前 · 你自己进行调查
01 Decode branches 02 Trace calls 03 Recover the rule
01 解码分支 02 跟踪调用 03 恢复规则
Original x64 · selected instructions
原始 x64 · 选中的指令
0x180124945: MOV EAX, dword ptr [R13 + 0x18]
0x180124949: CMP EAX, 0x5c
0x18012494c: JZ 0x180124aba
0x180124952: CMP EAX, 0x5b
0x180124955: JZ 0x180124aba
0x18012495b: MOV EDX, 0x64
0x180124960: LEA RCX, [RSP + 0x160]
0x180124968: CALL 0x180122650
0x18012496e: LEA RDX, [R13 + 0x160]
0x180124975: LEA RCX, [RSP + 0x78]
0x18012497a: CALL 0x180109720
0x18012497f: MOV RSI, RAX
0x180124982: MOV qword ptr [RSP + 0x28], RAX
0x180124987: LEA RDX, [RSP + 0x160]
0x18012498f: MOV RCX, RAX
0x180124992: CALL 0x180123190
; … value-copy instructions omitted …
0x180124a14: MOV RDX, RDI
0x180124a17: LEA RCX, [RSP + 0xf8]
0x180124a1f: CALL 0x180109720
0x180124a24: LEA R8, [RSP + 0x30]
0x180124a29: MOV RDX, RAX
0x180124a2c: LEA RCX, [RSP + 0xb8]
0x180124a34: CALL 0x180123c10You decode the instructions, follow the calls and reconstruct the calculation.
你解码指令,跟踪调用并重构计算过程。
With REA · You ask your agent
使用 REA · 你询问你的代理
One prompt.
只需一个提示词。
Ask your agent in plain English.
用自然英语向你的代理提问。
Example prompt · Calculator Copy
示例提示词 · 计算器副本
›Use REA to inspect Windows Calculator. Why does 200 + 10% give 220?
›使用 REA 检查 Windows 计算器。为什么 200 + 10% 的结果是 220?
Example answer · based on the findings
示例回答 · 基于调查结果
After +, the % button takes a percentage of the first number.
在输入 + 后,% 按钮会计算第一个数字的百分比。
10% of 200 = 20↓200 + 20 = 220
200 的 10% = 20 ↓ 200 + 20 = 220
REA supplies
REA 提供
The handler’s instructions, decompiled code and calls.
处理程序的指令、反编译的代码及调用关系。
Your agent explains
你的智能体解释
Which branch applies, what it calculates and how to rebuild it.
适用哪个分支、它计算什么以及如何重建它。
Selected assembly from the installed Calculator DLL. The thoughts and reply illustrate the findings. Continue with the Calculator example ↓
从已安装的计算器 DLL 中选中的汇编代码。思考过程和回复阐明了调查结果。继续查看计算器示例 ↓
Let's try two examples. Change a game's speed, then return to Calculator and rebuild its % button.
让我们尝试两个例子。更改游戏的速度,然后回到计算器并重建其 % 按钮。
Example 01 · Chrome’s dinosaur game
示例 01 · Chrome 恐龙游戏
Why does the dinosaur get faster?
为什么恐龙会变快?
Goal
目标
Rebuild the game with adjustable speed.
重建具有可调速度的游戏。
Why reverse engineer it?
为什么要逆向工程它?
To reproduce its acceleration, we need the rule in the running game: how fast it starts, how much it increases and when it stops.
为了重现其加速效果,我们需要运行游戏中的规则:初始速度是多少、增加幅度是多少以及何时停止加速。
Play the reconstruction
体验重建后的游戏
6 → 10 → 13
Play Jump ↑ Restart
玩 跳跃 ↑ 重新开始
Speed 6.0 Use the recovered acceleration rule
速度 6.0 使用恢复的加速规则
Original rule: start at 6, then increase toward 13.
原始规则:起始速度为 6,随后逐渐增加至 13。
Move the slider to set your own speed. Space or Jump clears a cactus.
拖动滑块以设置你自己的速度。按空格键或点击“跳跃”可清除仙人掌。
REA returned
REA 返回结果
The script actually running in the page. The agent reads its update function and speed settings, then uses that rule in a new game.
页面上实际运行的脚本。智能体读取其更新函数和速度设置,然后在新的游戏中应用该规则。
Example prompt · Dinosaur game Copy
示例提示词 · 恐龙游戏副本
›Use REA to inspect this dinosaur game. Why does it get faster? Show the speed rule, then build a small version with an adjustable speed.
›使用 REA 检查这个恐龙游戏。为什么它会加速?展示速度规则,然后构建一个带有可调节速度的简化版本。
Inspected target: wayou’s Chromium-derived browser edition.
已检查的目标:wayou 的基于 Chromium 的浏览器版本。
REA · loaded index.js · selected lines
REA · 已加载 index.js · 已选中行
if (this.currentSpeed < this.config.MAX_SPEED) {
this.currentSpeed += this.config.ACCELERATION;
}Start at 6. Add 0.001 each update without a collision, while speed is below 13.
从 6 开始。在没有发生碰撞的情况下,每次更新增加 0.001,直到速度低于 13。
Open the speed lab →
打开速度实验室 →
What each part does
各部分的作用
- 01 · REARead the running game’s scriptReturn its actual code and settings to the agent.
- 02 · Your agentRebuild the rule, add a controlUse the recovered acceleration in a small game with a speed slider.
- 03 · YouChange the speed and playTry the original acceleration, then choose your own pace.
- 01 · REA读取正在运行的游戏的脚本将实际的代码和设置返回给代理。
- 02 · 你的代理重建规则,添加控制功能在带有速度滑块的小型游戏中使用恢复后的加速度。
- 03 · 你更改速度并进行试玩尝试原始的加速度,然后选择你自己的节奏。
See the script, checks and how to try the analysis
查看脚本、检查项以及如何尝试分析
REA inspected the HTTP browser edition through a local debugging connection and returned the loaded index.js, including its source and digest.
REA 通过本地调试连接检查了 HTTP 浏览器版本,并返回了已加载的 index.js,包括其源代码和摘要。
Selected settings from the inspected script
从已检查的脚本中选定的设置
ACCELERATION: 0.001,
MAX_SPEED: 13,
SPEED: 6We called the original game’s update function in a controlled browser check, with obstacles and automatic scheduling disabled. After 4,000 updates, speed was 10.0; after 10,000, it was 13.0, rounded to one decimal.
我们在受控的浏览器检查中调用了原始游戏的更新函数,禁用了障碍物和自动调度。经过 4,000 次更新后,速度为 10.0;经过 10,000 次更新后,速度为 13.0(保留一位小数)。
The new mini-game keeps that speed rule. Its drawing, jumping and collision code are a small teaching implementation. Open the lab to see the new code and run the same speed check.
新的迷你游戏保留了该速度规则。其绘图、跳跃和碰撞代码是一个小型的教学实现。打开实验室以查看新代码并运行相同的速度检查。
To inspect the target yourself, follow the browser connection steps using the dinosaur page. Give your agent that page URL and your local debugging endpoint, then copy the prompt above.
要自行检查目标,请使用恐龙页面按照浏览器连接步骤操作。将那个页面的 URL 和你的本地调试端点提供给你的代理,然后复制上面的提示词。
Inspected speed code · Chromium Authors · BSD license
已检查的速度代码 · Chromium 作者 · BSD 许可证
Example 02 · Windows Calculator
示例 02 · Windows 计算器
Rebuild Calculator’s % button.
重建计算器的 % 按钮。
We saw why 200 + 10% gives 220. Now let’s recover the rules for both + and ×, and try them.
我们看到了为什么 200 + 10% 等于 220。现在让我们恢复 + 和 × 的规则,并尝试一下。
Goal
目标
Build a small calculator that handles both + and × correctly.
构建一个能正确处理 + 和 × 的小型计算器。
Why reverse engineer it?
为什么要逆向工程它?
The same button uses different rules after + and ×. We inspect the installed app to find which number the percentage is applied to.
同一个按钮在 + 和 × 之后使用不同的规则。我们检查安装的应用程序,以确定百分比是应用于哪个数字。
Try the calculation
尝试计算
200 + 10% 200 × 10%
200 + 20
% = Reset
% = 重置
10% of 200 = 20. Then 200 + 20 = 220.
200 的 10% = 20。然后 200 + 20 = 220。
Interactive illustration of the inspected percentage rule.
已检查百分比规则的交互式插图。
REA returned
REA 返回
One branch divides by 100. The other also multiplies by the first number. The agent uses both to recreate the % button.
一个分支除以 100。另一个分支则将第一个数乘以该值。智能体利用这两者来重建 % 按钮。
For this example, previous = 200 and current = 10.
在此示例中,previous = 200,current = 10。
Example prompt · Rebuild the % button Copy
示例提示 · 重建 % 按钮 复制
›Use REA to inspect Windows Calculator’s % button. Recover the rules after + and ×, then build a small calculator that uses both.
›使用 REA 检查 Windows 计算器中的 % 按钮。恢复 + 和 × 之后的规则,然后构建一个同时使用这两种运算的小型计算器。
Readable summary of the % handler
可读的 % 处理程序摘要
if (operation == multiply || operation == divide) {
percent = current / 100;
} else {
percent = current * previous / 100;
}With +
使用 + 时
Take 10% of the first number.10% of 200 = 20 → 200 + 20 = 220
取第一个数的 10%。200 的 10% = 20 → 200 + 20 = 220
With ×
使用 × 时
Turn 10% into 0.1.200 × 0.1 = 20
将 10% 转换为 0.1。200 × 0.1 = 20
From the installed app to a working % button
从已安装的应用到可用的 % 按钮
- 01 · REA reads calc.exeIt launches the Calculator appThe code opens ms-calculator:. The agent then selects the installed app’s library.
- 02 · REA reads the libraryReturn the % handler’s codeThe function checks the operator and uses the constant 100.
- 03 · Your agent interprets itExplain and reproduce the rulesCrosscheck the branch with Microsoft’s source, then try + and × above.
- 01 · REA 读取 calc.exe它启动了计算器应用代码打开了 ms-calculator:。随后智能体选择了已安装应用的库。
- 02 · REA 读取库返回 % 处理程序的代码该函数检查运算符并使用常量 100。
- 03 · 你的智能体对其进行解释解释并复现规则与微软源代码交叉核对分支,然后尝试上述的 + 和 ×。
See the real code and how the answer was checked
查看实际代码以及答案的检查过程
REA · selected original instructions
REA · 选定的原始指令
0x180124945: MOV EAX, dword ptr [R13 + 0x18]
0x180124949: CMP EAX, 0x5c
0x18012494c: JZ 0x180124aba
0x180124952: CMP EAX, 0x5b
0x180124955: JZ 0x180124aba
0x18012495b: MOV EDX, 0x64Operator IDs · Microsoft’s source
运算符 ID · 微软源代码
#define IDC_MUL 92 // 0x5c
#define IDC_DIV 91 // 0x5b
#define IDC_PERCENT 118 // 0x76
0x64 = 100Inspected with REA 4.1.0: Windows Calculator 11.2508.4.0, x64. The readable summary uses names from Microsoft’s public source to explain the recovered branch.
使用 REA 4.1.0 进行检查:Windows 计算器 11.2508.4.0,x64。可读摘要使用了微软公开源代码中的名称来解释恢复出的分支。
Percentage implementation · Microsoft’s test cases · Native setup guide
百分比实现 · 微软测试用例 · 原生设置指南
Your first investigation
你的首次调查
Try REA on a small app.
在小应用上试用 REA。
Download our Notes example, trace its CSV export, and check one changed input.
下载我们的 Notes 示例,追踪其 CSV 导出,并检查一个已更改的输入。
Try the guided example
尝试引导式示例
Want to go deeper?
想深入了解吗?
Tell your agent what you want to understand or build. With REA, you can work together on anything from cloning this website to reconstructing a game from its executable.
告诉你的代理你想理解或构建什么。借助 REA,你可以协作完成从克隆本网站到从其可执行文件重建游戏等各种任务。
Example prompt · Website Copy
示例提示 · 网站复制 Copy
›Use REA to inspect https://rea.tools/. Clone this website for me.
›使用 REA 检查 https://rea.tools/。为我克隆这个网站。
Yes, this one.
是的,就是这个。
Example prompt · Game reconstruction Copy
示例提示 · 游戏重建 Copy
›Use REA to reconstruct this game from its executable. Recover the gameplay logic in C and test it against the original.
›使用 REA 从其可执行文件重建这个游戏。恢复 C 语言中的游戏玩法逻辑,并在原始程序上进行测试。
See the DX-Ball case study →
查看 DX-Ball 案例研究 →
For setup and analysis steps, choose your target:
对于设置和分析步骤,请选择你的目标:
Native binaries
原生二进制文件
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力