Before using loader script, make sure you have the following installed:
- Python 3.x installed on your PC
pipto install Python packages- ADB (Android Debug Bridge)
- Frida (
frida,frida-trace, etc.) - An Android device (preferably rooted)
frida-serverrunning on the device
-
Download and install Python from https://www.python.org/downloads/windows
-
Open PowerShell or CMD and run:
pip install frida-tools- Verify that Frida is installed:
frida --version-
Open Terminal.
-
Install Python and Pip using Homebrew:
brew install python- Install Frida:
pip3 install frida-tools- Verify:
frida --version-
Download
Platform Toolsfrom https://developer.android.com/studio/releases/platform-tools -
Extract the ZIP into a folder.
-
Add that folder to your system PATH.
-
Verify installation:
adb devices- Install
Platform Tools:
brew install android-platform-tools- Download
frida-serverfrom https://github.com/frida/frida/releases
Look for a file like:
frida-server-<version>-android-arm64.xz- Extract the file:
Uncompress the XZ into a folder.
unxz frida-server-*.xzor
xz -d frida-server-*.xz- Push
frida-serverto the Android device:
adb root # Might be required
adb push frida-server /data/local/tmp/It is recommended not to use the name frida-server and use a random name instead. i.e. android-pen-server.
- Init the shell (from the device's shell):
adb shell
su # Might be required if you are doing this on a rooted device. You might see `#` instead of `$`- Give it executable permissions:
cd /data/local/tmp
chmod +x frida-server
chmod 755 frida-server- Start
frida-server:
./frida-server &If you want to save the lines of code and automate the whole process above, follow the steps below:
-
Open PowerShell in the folder where
frida-serverandinstall_frida_server.ps1are located. -
Allow script execution (temporary):
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass- Run the script:
./install_frida_server.ps1- Open Terminal in the folder where
frida-serverandinstall_frida_server.share located.
./install_frida_server.shadb shell
su
ps | grep fridaThis shows something like:
u0_a123 1234 567 ... /data/local/tmp/frida-serverNow kill it (replace 1234 with the actual PID):
kill -9 1234Or if you want to kill all frida-server processes automatically use:
adb shell pkill frida-server-
Never leave
frida-serverrunning in production or on a real device without protection, as it opens a dangerous door. -
Be sure to kill the process when you are done.
-
If you get something like
Failed to enumerate processes: unable to access process with pid <number> due to system restrictions; try 'sudo sysctl kernel.yama.ptrace_scope=0', run Frida as root -
SELinux might still show as enforcing if the kernel is locked down — but this usually works on custom ROMs or rooted stock ROMs.
-
If you get
adbd cannot run as root in production buildsafter runningadb rootyou need to prefix each shell command withsu -c. For example:adb shell "su -c chmod 755 /data/local/tmp/frida-server"
-
Use
frida-ps -Uto list running processes on the device. It may help you to find the name of the target application. -
Use
frida-trace -U -n com.package.name -i nativeCheckto auto-generate hooks. -
Some apps might be able to detect the
frida-serverlocation. Renaming thefrida-serverbinary to a random name, or moving it to another location such as/devmay do the trick. -
Make sure the app is in the foreground before hooking.
-
Modify the script to hook other methods as needed.
For more information you can consult Frida's documentation