> For the complete documentation index, see [llms.txt](https://pcastagnaro.gitbook.io/pentest-bug-bounty-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pcastagnaro.gitbook.io/pentest-bug-bounty-resources/pentest-bounty-resources/mobile/android/dast-1/rooted-devices/frida-server-in-the-emulator-or-device.md).

# Run frida-server in the emulator or device

{% hint style="info" %}
If you want just a steps summary, go to [Summary](https://app.gitbook.com/@pcastagnaro/s/pentest-cheat-sheet/~/drafts/-MWWFmuailRJ8k0QqbFa/pentest-book/mobile/android/dast-1/frida-server-in-the-emulator-or-device#summary)
{% endhint %}

## Upload frida-server

First, let's test to make sure that we have working connectivity over ADB (Android Debug Bridge).

{% hint style="info" %}
This lab is also covered off in the [Environment Setup video walkthrough](https://summit-labs.frida.ninja/setting-up/before-you-start-prerequisites#video-walkthrough-environment-setup).
{% endhint %}

1\. Open a command line and type `adb devices`

![List of devices connected to PC](/files/-MWWGAiywWxHk4ADFSvD)

2\. In order for frida to work, you need it's companion `frida-server`, to be running on the device. You can download it from the frida [releases page on Github](https://github.com/frida/frida/releases).

{% hint style="warning" %}
Make sure you get the one corresponding with your device architecture. It could be "android-x86", "android-arm", etc. To see how to get the architecture, please refer to <https://stackoverflow.com/questions/6630386/how-to-find-arm-processor-version-on-android-device>
{% endhint %}

{% hint style="warning" %}
Make sure you have exactly the same frida version on device and on the PC. If not, you will get many errors.
{% endhint %}

3\. Push it to `/data/local/tmp` with `adb push frida-server-XX.Y.ZZ-android-ARCH /data/local/tmp`

![](/files/-MWWHTsMJ4z0GfMj-NK5)

4\. Obtain root with `adb root`, then connect to your device with `adb shell`. Navigate to the `/data/local/tmp` directory with `cd /data/local/tmp` .&#x20;

5\. At this point it's preferred to rename `frida-server-XX.Y.ZZ-android-ARCH`to something a little less annoying to type: `mv frida-server-XX.Y.ZZ-android-ARCH frida-server`

6\. Make the server executable with `chmod 777 frida-server`

## Run frida-server persistently using nohup

7\. Start the server with `nohup ./frida-server &`

{% hint style="warning" %}
The reason we are using `nohup` is to keep the process running even if we close our ADB terminal. You can absolutely just run `./frida-server` but then you must be mindful not to close the window.
{% endhint %}

## Summary

Download frida from [releases page on Github](https://github.com/frida/frida/releases) and then:

```
adb push frida-server-XX.Y.ZZ-android-ARCH /data/local/tmp
adb root
adb shell
cd /data/local/tmp
mv frida-server-XX.Y.ZZ-android-ARCH frida-server
chmod 777 frida-server
nohup ./frida-server &
```
