This article aims to be a comprehensive guide to start with the Frida Tool. In this article, we will cover topics such as Introduction to Frida, how to install Frida to work with your Android device, and some basic commands you can use when using Frida. So Let’s Get Started.
Introduction
Frida is a free dynamic code instrumental toolkit. This is mainly used by the Pentesters, developers, or the person who loves reverse engineering. Frida lets you inject your own Javascript snippets into the native apps on Android, iOS, Windows, macOS, GNU/Linux, and QNX. Many developers have already created some scripts that you can use anytime.
Installation
The Installation process of the Frida tool is very easy. Below are some of the requirements that you should have before installing the Frida tool:
- Windows, macOS, or GNU/Linux Operating system
- Python – latest 3.x is highly recommended
- adb should be installed
- USB debugging should be enabled on the android device
We will use the below pip command to install the Frida tool on our Windows, macOS, or GNU/Linux Operating systems.
$ pip install frida-tools
Once the installation is complete you can run the below command to verify if Frida is properly installed:
The below command will show you the list of all the running processes in an android device with the process name with their respective PIDs.
$ frida-ps
You can use the below command to see the installed Frida version run the below command:
$ frida --version
Note down the installed Frida version. This version will help while installing the Frida server on android devices. Now we will set up the Frida server on the Android Device.
Setting up Frida on the Android Device
Before starting the installation, you need a rooted android device or the rooted android emulator. It is also possible to use Frida on non-rooted devices, but that needs more time and effort. As this is an introduction, we will focus on the simplest method which is a rooted android device. We also need the ADB tool. There are many ways to install ADB in your Operating System.
First, we need to download the latest frida-server for your rooted android device. You can download the latest version of frida-server from the official release page. You need to download the frida-server file whose name looks something like “frida-server-14.2.17-android-arm64.xz”. Note that you need to download frida-sever according to your specific android architecture.
Once the download is completed, uncompress the frida-server file and rename it to “frida-server”. You can use tools like “7z” to uncompress the file.
Note: USB debugging should be enabled on the android device.
Use the below command to verify if the device is connected to the Desktop.
$ adb devices
List of devices attached
device_ip_address:5555 device
Now, use the below ADB command to copy the frida-server file into the android phone’s tmp directory.
$ adb push frida-server /data/local/tmp/
Use the below command to change the permission of the frida-server file, so that we can execute it.
$ adb shell "chmod 755 /data/local/tmp/frida-server"
Use the below command to run the Frida server on the Android Device.
$ adb shell "/data/local/tmp/frida-server &"
Whenever you need to work with the Frida tool, just run the above command to run the Frida Server on the Android Device. Also, ensure that you have connected your Android device using USB or Wi-Fi with the Dekstop using USB debugging mode.
Now Frida tool is ready to use. From your desktop terminal, type the below command to ensure that everything is working fine.
$ frida-ps -U
If everything works fine, the above command will show you the process name and their respective PIDs. Now we can say that the Frida tool is ready to use.
Basic Frida Command
Here I am mentioning some of the basic Frida commands that you can use while working with the Frida Tool.
To get list all the attached devices:
$ frida-ls-devices
To get list of all the running processes:
$ frida-ps -U
To get list of all the installed applications on the device:
$ frida-ps -Uai
To get list of all the running applications on the device:
$ frida-ps -Ua
Load an external script into the application
- -U: Connect to a USB device
- -f: spawn FILE
- -l: Load Script
frida -U -f com.example.applciaiton -l disableroot.js
Load an external script from codeshare
frida --codeshare dzonery/fridantiroot -f com.example.applicaiton -U
Conclusion
So, this guide is about how to install and work on Frida. The installation process is very easy and works like a charm. If you need any help on how to work on Frida, let us know in the comments below. Below are the advantages because of which we are using Frida.
- Freely available and open source
- Supports multi-platforms, like Windows, Linux, and macOS
- Inject our own JavaScript
- Free Scripts available on the internet with different features