Radare2和Frida更好

Radare2的自包式插件,该插件将Frida运送,并允许使用R2命令(但不限于)Frida脚本来启动本地或远程进程。
Radare项目为逆向工程提供了完整的工具链,它是积极维护的,并且提供了良好的功能,并使用其他编程语言和工具扩展了功能。
弗里达(Frida)是一种动态的仪器工具包,可以通过注入自己的JavaScript来易于检查和操纵运行过程,并且还可以选择地与您的脚本进行通信。
:.命令):db API的本机断点r_fs API访问远程文件系统。 安装R2FRIDA的推荐方法是通过R2PM:
$ r2pm -ci r2frida不需要编译的二进制构建将在r2pm和r2env很快得到支持。同时,请随时从版本页面下载最后的构建。
在GNU/Debian中,您需要安装以下软件包:
$ sudo apt install -y make gcc libzip-dev nodejs npm curl pkg-config git $ git clone https://github.com/nowsecure/r2frida.git
$ cd r2frida
$ make
$ make user-install
radare2 (而不是radare2-xyz)preconfigure.bat )中可用configure.bat ,然后make.bat 要进行测试,请使用r2 frida://0 ,作为弗里达(Frida)的PID0附加是在本地运行的特殊会话。现在您可以运行:?命令获取可用的命令列表。
$ r2 'frida://?'
r2 frida://[action]/[link]/[device]/[target]
* action = list | apps | attach | spawn | launch
* link = local | usb | remote host:port
* device = '' | host:port | device-id
* target = pid | appname | process-name | program-in-path | abspath
Local:
* frida://? # show this help
* frida:// # list local processes
* frida://0 # attach to frida-helper (no spawn needed)
* frida:///usr/local/bin/rax2 # abspath to spawn
* frida://rax2 # same as above, considering local/bin is in PATH
* frida://spawn/$(program) # spawn a new process in the current system
* frida://attach/(target) # attach to target PID in current host
USB:
* frida://list/usb// # list processes in the first usb device
* frida://apps/usb// # list apps in the first usb device
* frida://attach/usb//12345 # attach to given pid in the first usb device
* frida://spawn/usb//appname # spawn an app in the first resolved usb device
* frida://launch/usb//appname # spawn+resume an app in the first usb device
Remote:
* frida://attach/remote/10.0.0.3:9999/558 # attach to pid 558 on tcp remote frida-server
Environment: (Use the `%` command to change the environment at runtime)
R2FRIDA_SAFE_IO=0|1 # Workaround a Frida bug on Android/thumb
R2FRIDA_DEBUG=0|1 # Used to debug argument parsing behaviour
R2FRIDA_COMPILER_DISABLE=0|1 # Disable the new frida typescript compiler (`:. foo.ts`)
R2FRIDA_AGENT_SCRIPT=[file] # path to file of the r2frida agent
$ r2 frida://0 # same as frida -p 0, connects to a local session您可以按名称或PID连接,产生或启动到任何程序,以下行将连接到名为rax2的第一个过程(Run rax2 -在另一个终端中以测试此行)
$ r2 frida://rax2 # attach to the first process named `rax2`
$ r2 frida://1234 # attach to the given pid使用二进制的绝对路径将产生该过程:
$ r2 frida:///bin/ls
[0x00000000] > :dc # continue the execution of the target program还可以处理论证:
$ r2 frida:// " /bin/ls -al "对于USB调试iOS/Android应用程序,请使用这些操作。请注意,可以用launch或attach替换spawn ,并且过程名称可以是捆绑包或pid。
$ r2 frida://spawn/usb/ # enumerate devices
$ r2 frida://spawn/usb// # enumerate apps in the first iOS device
$ r2 frida://spawn/usb//Weather # Run the weather app这些是最常见的命令,因此您必须学习并使用它们后缀?获得子命令的帮助。
:i # get information of the target (pid, name, home, arch, bits, ..)
.:i* # import the target process details into local r2
:? # show all the available commands
:dm # list maps. Use ':dm|head' and seek to the program base address
:iE # list the exports of the current binary (seek)
:dt fread # trace the 'fread' function
:dt-* # delete all traces
R2FRIDA插件在代理侧运行,并在r2frida.pluginRegister API中注册。
有关更多示例插件脚本,请参见plugins/目录。
[ 0x00000000 ] > cat example . js
r2frida . pluginRegister ( 'test' , function ( name ) {
if ( name === 'test' ) {
return function ( args ) {
console . log ( 'Hello Args From r2frida plugin' , args ) ;
return 'Things Happen' ;
}
}
} ) ;
[ 0x00000000 ] > : . example . js # load the plugin script这:.命令像R2一样工作.命令,但在代理商内运行。
:. a.js # run script which registers a plugin
:. # list plugins
:.-test # unload a plugin by name
:.. a.js # eternalize script (keeps running after detach) 如果您愿意通过Termux在Android上安装和使用R2Frida,则由于某些符号分辨率,有一些需要库依赖的警告。进行这项工作的方法是扩展LD_LIBRARY_PATH环境以指向termux libdir之前的系统目录。
$ LD_LIBRARY_PATH=/system/lib64:$LD_LIBRARY_PATH r2 frida://...
确保您使用的是现代版本的R2(最好是上次版本或Git)。
运行r2 -L | grep frida验证插件是否已加载,如果没有打印,则使用R2_DEBUG=1环境变量,以获取一些调试消息以找出原因。
如果您遇到编译R2Frida的问题,则可以使用r2env或从GitHub版本页面中获取版本构建,请记住,只有专业版本才能匹配。
+---------+
| radare2 | The radare2 tool, on top of the rest
+---------+
:
+----------+
| io_frida | r2frida io plugin
+----------+
:
+---------+
| frida | Frida host APIs and logic to interact with target
+---------+
:
+-------+
| app | Target process instrumented by Frida with Javascript
+-------+
该插件是由Pancake aka Sergi Alvarez(radare2的作者)开发的。
我要感谢OleAndré的撰写和维护弗里达(Frida),并非常友善地主动修复错误,并讨论使该工会工作所需的任何事情的技术细节。荣誉