Radare2와 Frida가 함께 더 나은 것입니다

Frida를 배송하고 Frida 스크립트 대신 R2 명령을 사용하여 로컬 또는 원격 프로세스를 도구로 제공하는 Radare2 용 자체 포함 플러그인.
Radare Project는 역 엔지니어링을위한 완벽한 도구 체인을 제공하며 적극적으로 유지 관리되며 잘 유지 된 기능을 제공하고 다른 프로그래밍 언어 및 도구로 기능을 확장하고 있습니다.
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 테스트를 위해 Frida의 PID0에 부착하는 것은 로컬에서 실행되는 특별 세션이므로 r2 frida://0 사용하십시오. 이제 다음을 실행할 수 있습니다 :? 명령 목록을 사용할 수 있도록 명령.
$ 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 - run)라는 첫 번째 프로세스에 첨부됩니다.
$ 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 앱에서 이러한 작업을 사용하십시오. spawn launch 또는 attach 로 대체 될 수 있으며 프로세스 이름은 번들 리드 또는 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 -L | grep frida 플러그인이로드되었는지 확인하려면 R2_DEBUG=1 환경 변수를 사용하여 그 이유를 찾기 위해 디버깅 메시지를 가져 오십시오.
R2FRIDA를 컴파일하는 데 문제가있는 경우 r2env 사용하거나 GitHub 릴리스 페이지에서 릴리스 빌드를 가져올 수 있습니다. Major.MINOR 버전 만 일치해야한다는 점을 명심하십시오. R2-5.7.6은 5.7.0에서 5.7.8 사이의 모든 버전에서 컴파일 된 플러그인을로드 할 수 있습니다.
+---------+
| 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의 저자)가 Nowsecure에 의해 개발되었습니다.
나는 Frida를 작성하고 유지하는 Ole André에게 감사의 말을 전하고, 버그를 사전에 고치고이 노동 조합을 작동시키는 데 필요한 모든 것에 대한 기술적 세부 사항에 대해 논의 할 수 있도록 친절하게 감사합니다. 명성