
Un insieme di script che facilitano il lavoro con frida
Un set di script che facilitano l'uso di Frida, progettati per aiutare a trovare la funzione corretta da hookare e poi modificarla.
Per entrambi gli script, presumo che tu abbia un dispositivo connesso via USB o un emulatore in esecuzione sulla stessa macchina.
Installa frida sulla tua macchina e assicurati di avere il server frida in esecuzione sul tuo dispositivo Android/emulatore.
Potresti avere un file apk e voler sapere quali attività verranno eseguite e in quale sequenza. In questo caso puoi usare activity_tracer.js:
frida -U -f com.pkg.xxx.yyy -l activity_tracer.js --no-pause
Nel caso in cui tu voglia elencare tutti i metodi di una classe e sapere cosa restituisce un metodo, puoi usare 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
Nota che una volta fornito un nome di classe e un numero allo script hooketh.py, elencherà tutti i metodi della classe e li numererà. Successivamente, puoi fornire un numero elencato per ottenere cosa restituisce quel metodo. Inizio sempre con 3 perché è il metodo di inizializzazione.