
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から始めます。なぜなら、それが初期化メソッドだからです。