R2Frida -Radare2和Frida更好

taibeihacker

Moderator
AVvXsEjwfwWAHxwLDyAJ5UmBQrUiXHa4Ck6WodMc3Ms7I0kF8qTP0PB00kSp46HCoIqajG7q9eqVcXQ-sYr24dBpDoRvn373C8Rn1C7aqGOAEm0UJBENuI7BZ0XxMPrlNxdaV3bZcjgXK158k_x8cYR_YyvcAkaidYD5Tmnc1wpy6F2Z8q12_39h2L9Re3GoVmM=w400-h233

这是一个用于Radare2的独立插件,允许使用Frida仪器进行远程进程。
Radare项目为反向工程带来了完整的工具链,提供了良好的功能,并将其功能扩展到其他编程语言和工具。
弗里达(Frida)是一种动态的仪器工具包,可以通过注入自己的JavaScript来易于检查和操纵运行过程,并且还可以选择地与您的脚本进行通信。

Features​

Run unmodified Frida scripts (Use the : command) Execute snippets in C, Javascript or TypeScript in any process Can attach, spawn or launch in local or remote systems List sections, symbols, exports, protocols, classes, methods Search for values in memory inside the agent or from the host Replace method implementations or create hooks with short commands Load libraries and frameworks in the target process Support Dalvik, Java, ObjC, Swift and C interfaces Manipulate file descriptors and environment variables Send signals to the process, continue, breakpoints The r2frida io plugin is also a filesystemfsanddebugbackend Automate r2 and frida using r2pipe Read/Write process memory Call functions, syscalls and raw code snippets Connect to frida-server via usb or tcp/ip Enumerate apps and processes Trace registers, arguments of functions Tested on x64, arm32 and arm64 for Linux, Windows, macOS, iOS and Android Doesn't require frida to be installed in the host (no need for frida-tools) Extend the r2frida commands with plugins that run in the agent Change page permissions, patch code and data Resolve symbols by name or address and import them as flags into r2 Run r2 commands in the host从代理使用R2 API并在远程目标过程中运行R2命令。使用R_FS API使用:DB API访问远程文件系统的本机断点。

Installation​

安装R2FRIDA的推荐方法是通过R2PM:
$ R2PM -CI R2FRIDA二进制构建不需要编译的二进制构建将在R2PM和R2ENV很快得到支持。同时,请随时从版本页面下载最后的构建。

Compilation​

Dependencies​

radare2 pkg-config(Windows上不需要)卷发或WGET MAKE,GCC NPM,nodejs,nodejs(将很快删除)在GNU/debian中,您将需要安装以下包装:
$ sudo apt install -y make gcc libzip-dev nodejs npm curl pkg-config git

Instructions​

$ git克隆3https://github.com/nowsecure/r2frida.git.git
$ CD R2FRIDA
$制作
$ make user-install

Windows​

Install meson and Visual Studio Unzip the latest radare2 release zip in the r2frida root directory Rename it to radare2 (instead of radare2-x.y.z) To make the VS compiler available in PATH (preconfigure.bat) Run configure.bat and then make.bat Copy the b\r2frida.dll into r2 -H R2_USER_PLUGINS

Usage​

进行测试,使用R2 FRIDA: //0,作为弗里达(Frida)的PID0附加到frida中的PID0是一个特殊的会话,该会话在本地运行。现在您可以运行:吗?命令获取可用的命令列表。
$ r2'frida: //?'
R2 FRIDA: //[action]/[link]/[device]/[target]
*操作=列表|应用|附件|产卵|发射
*链接=本地| USB |远程HOST:PORT
*设备=''| HOST:PORT |设备ID
* target=pid | AppName | process-name |程序中的程序|斜肌
Local:
* frida: //? #显示此帮助
* FRIDA: //#列出本地流程
* FRIDA: //0#附加到Frida-Helper(无需产卵)
* FRIDA: ///USR/local/bin/rax2#abspath至Spawn
* frida: //rax2#与上面相同,考虑到局部/bin处于路径中
* frida: //spawn/$(程序)#在当前系统中产生一个新过程
* FRIDA: //附加/(目标)#附加到当前主机中的目标PID
USB:
* frida: //list/usb //#在第一个USB设备中列表流程
* frida: //apps/usb //#在第一个USB设备中列出应用程序
* frida: //attach/usb //12345#附加以在第一个USB设备中提供PID
* frida: //spawn/usb //appname#在第一个解决的USB设备中产生应用程序
* frida: //启动/usb //应用程序#Spawn+在第一个USB设备中恢复应用程序
远程:
* FRIDA: //附加/远程/10.0.0.0.3:9999/558#附加到PID 558上的TCP远程Frida-Server
Environment3360(使用``%'命令在运行时更改环境)
r2frida_safe_io=0 | 1#解决方案Android/thumb上的frida bug
r2frida_debug=0 | 1#用于调试参数解析行为
r2frida_compiler_disable=0 | 1#禁用新的Frida打字稿编译器(`:foo.ts`)
R2FRIDA_AGENT_SCRIPT=[file] # path to file of the r2frida agent

Examples​

$ r2 frida://0 # same as frida -p 0, connects to a local session You can attach, spawn or launch to any program by name or pid, The following line will attach to the first process named rax2 (run rax2 - in another terminal to test this line)
$ r2 frida: //rax2#附加到名为`rax2`的第一个过程
$ r2 frida: //1234#使用二进制的绝对路径附加到给定的PID,将产生该过程:
$ R2 FRIDA: ///bin/ls
[0x00000000] :DC#继续执行目标程序还可以与参数一起使用:
$ R2 FRIDA: //'/bin/ls -al'用于USB调试iOS/Android应用程序使用这些操作。请注意,可以用启动或附件替换生成,并且过程名称可以是捆绑包或pid。
$ R2 FRIDA: //SPAWN/USB/#枚举设备
$ R2 FRIDA: //Spawn/usb //#在第一个iOS设备中枚举应用程序
$ r2 frida://spawn/usb//Weather # Run the weather app

Commands​

These are the most frequent commands, so you must learn them and suffix it with ?获得子命令的帮助。
:i#获取目标信息(PID,名称,家庭,拱门,位,)
.i*#将目标过程详细信息导入本地R2
: #显示所有可用命令
:DM#列表地图。使用':DM | head'并寻找程序基础地址
:IE#列出当前二进制的出口(SEEK)
:DT径向#跟踪“径向”功能
:dt-*#删除所有跟踪

Plugins​

R2FRIDA插件在代理侧运行,并在r2frida.pluginregister API中注册。
有关更多示例插件脚本,请参见插件/目录。
[0x000000000]猫示例
r2frida.pluginregister('test',function(name){
如果(name==='test'){
返回函数(args){
console.log('R2frida插件的hello args',args);
返回“事情发生”;
}
}
});
[0x000000000] :命令,但在代理商内运行。
:A.JS#运行脚本,该脚本注册一个插件
:#列表插件
:测试#按名称卸载插件
: A.JS#Eternalize脚本(在分离后保持运行)

Termux​

如果您愿意通过Termux在Android上安装和使用R2Frida,则由于某些符号分辨率而有一些库依赖性的警告。进行这项工作的方法是扩展LD_LIBRARY_PATH环境以指向termux libdir之前的系统目录。
$ ld_library_path=/system/lib64: $ ld_library_path r2 frida: //.

Troubleshooting​

确保您使用的是现代版本的R2(最好是上次发行版或git)。
运行R2 -L | grep frida验证插件是否已加载,如果没有打印,则使用r2_debug=1环境变量,以获取一些调试消息以找出原因。
如果您遇到编译R2Frida的问题,则可以使用R2ENV或从GitHub版本页面中获取版本构建,请记住,只有专业版本才能匹配。

Design​

+------------ +
| radare2 | Radare2工具,其余的
+------------+
:
+---------------+
| io_frida | R2Frida IO插件
+---------------+
:
+------------+
|弗里达| Frida主机API和逻辑与目标相互作用
+------------+
:
+--------+
|应用|弗里达(Frida)用JavaScript仪器仪器的目标过程
+ -------+

Credits​

此插件是由煎饼又名Sergi Alvarez(radare2的作者)开发的。
我要感谢OleAndré的撰写和维护弗里达(Frida),并非常友善地主动修复错误,并讨论使该工会工作所需的任何事情的技术细节。荣誉
 
返回
上方