
frida 작업을 쉽게 해주는 스크립트 모음
Frida 작업을 더 쉽게 해주는 스크립트 모음으로, 후킹할 올바른 함수를 찾은 후 수정하는 데 맞춰져 있습니다.
두 스크립트 모두 USB로 연결된 기기가 있거나 동일한 머신에서 에뮬레이터가 실행 중이라고 가정합니다.
머신에 frida를 설치하고 Android 기기/에뮬레이터에서 frida 서버가 실행 중인지 확인하세요.
apk 파일이 있고 어떤 액티비티가 어떤 순서로 실행되는지 알고 싶을 수 있습니다. 이 경우 activity_tracer.js를 사용할 수 있습니다:
frida -U -f com.pkg.xxx.yyy -l activity_tracer.js --no-pause
클래스의 모든 메서드를 나열하고 각 메서드가 무엇을 반환하는지 알고 싶다면 hooketh.py를 사용할 수 있습니다:
python hooketh.py -h
usage: hooketh.py [-h] [-n NUMBER] [-c CLASS_NAME] [-t RETURN_TRUE]
[-p PACKAGE_NAME]
optional arguments:
-h, --help show this help message and exit
-n NUMBER, --number NUMBER
index number of the method to overload
-c CLASS_NAME, --class_name CLASS_NAME
FQDM name of the target class
-t RETURN_TRUE, --return_true RETURN_TRUE
make method return true(type 1 or true)
-p PACKAGE_NAME, --package_name PACKAGE_NAME
FQDM of the app (ex: com.app.name, you can find it in
the manifest file)
# If you do not provide a method number the script will use "3" as a method number because that is the "init" method
python3 hooketh.py -c java.lang.String -p com.name1.name2.demo
# Make method 10 in the MainActivity return true
python3 hooketh.py -c com.name1.name2.demo.MainActivity -p com.name1.name2.demo -n 10 -t true
참고: hooketh.py 스크립트에 클래스 이름과 번호를 제공하면 클래스의 모든 메서드를 나열하고 번호를 매깁니다. 그런 다음 나열된 번호를 제공하여 해당 메서드가 반환하는 값을 알 수 있습니다. 저는 항상 3번부터 시작하는데, 이는 초기화 메서드이기 때문입니다.