Hacking/Android Hacking
Android@Frida# Frida With Nox
hi0802
2018. 8. 6. 14:13
http://comsecuodj.tistory.com/21?category=199091 포스팅 이후로 1년 7개월 만에 Frida에 대한 글을 써봅니다. 저 글을 쓸 당시 Frida Major 버전이 9였는데, 이제 12까지 업데이트 됐네요.
버전이 업데이트 되면서 설치 방법부터 조금씩 바뀐것 같습니다. 예전에는 pip install frida 로 설치가 가능했던 것 같은데 실제로 해당 명령어로 설치해봤더니 설치는 되나 frida-ps 라던지 그 이외의 툴들이 설치 되지 않는 것을 확인했습니다. 앞으론 아래 명령어처럼 설치해야겠습니다.
또 당시만 해도 Nox 앱 플레이어에 프리다 서버를 실행시켜봤지만 실행되지 않았는데 올해 초 저랑 똑같은 질문을 한 사람이 있었나 봅니다. 이런 답변이 있었네요. (ARM 기반의 Frida 서버가 아닌 x86서버로 해도 frida-ps -U 명령어는 됐지만 후킹이 잘 안됐던걸로 기억합니다. 내가 잘못한건가..?)
결론적으로 이제는 잘 됩니다. 테스트 폰이 없어졌는데 이제 굳이 안사도 되겠네요. 크크
후킹 포인트는 2곳이며 소스코드는 아래 처럼 작성했습니다. 이상 ㄲ ㅡ ㅌ.
import frida, sys pacage_name = "com.djoh.memory"; def on_message(message, data): if message['type'] == 'send': print("[*] {0}".format(message['payload'])) else: print(message) jscode = """ Java.perform(function () { console.log('[+] Hooking Start!'); console.log(""); var MainActivity = Java.use('com.djoh.memory.MainActivity'); MainActivity.isDebuggable.overload('android.content.Context').implementation = function (str) { console.log("***********isDebuggable***********"); console.log("[+] Method Hooking Start!"); return false; console.log("[+] Method Hooking Finish!"); console.log("**************************"); console.log(""); }; MainActivity.showMsg.overload('java.lang.String').implementation = function (str) { console.log("***********showMsg***********"); console.log("[+] Method Hooking Start!"); console.log("[-] " + str); console.log("[+] Method Hooking Finish!"); console.log("****************************"); console.log(""); }; }); """ process = frida.get_usb_device().attach("com.djoh.memory") script = process.create_script(jscode) script.on('message', on_message) print('[+] Frida Attached!') script.load() sys.stdin.read() |