Mobile Security Tools part 1: scrcpy
Tags: mobile, android, androiddev, cybersecurity
Published: 2023-10-12 10:48:45

### Mobile Security Tools-series:
#### Part 1: scrcpy
#### Part 2: [Frida](https://dev.to/whatminjacodes/mobile-security-tools-part-2-frida-3mb3)

_____

### What is scrcpy?

SCRCPY (Screen Copy) is a free and open source application that allows users to mirror their Android device’s screen on their computer. 

It is available for Windows, macOS, and Linux and doesn't need a rooted or jailbroken phone.

It allows to control the device with the keyboard and the mouse of the computer.

Some of the features:
- mirror screen on computer
- copy-paste in both directions
- record screen
- use Android with mouse and keyboard
- audio forwarding

### Tutorial
Let's install and use scrcpy next. Note that you don't need a rooted device to follow this tutorial. 

#### Prerequisites
This tutorial will not go through how to to connect your phone to be used for developing. Check the tutorial from [Android Developer website](https://developer.android.com/codelabs/basic-android-kotlin-compose-connect-device) if you haven't done that before.

**My setup:**
I'm using a rooted Pixel 6a
Android 13
Ubuntu 22.04.3 LTS
Android [Platform Tools](https://developer.android.com/tools/releases/platform-tools) downloaded

If you are new to [adb](https://developer.android.com/tools/adb), I recommend you to first read what it is.

Check other needed prerequisites from the scrcpy [GitHub](https://github.com/Genymobile/scrcpy).

#### Install scrcpy
This differs depending on your setup, so if you have something else than Debian or Ubuntu, then check the installation instructions from scrcpy [GitHub](https://github.com/Genymobile/scrcpy).

On Debian and Ubuntu, scrcpy can be installed by running:
```
sudo apt install scrcpy
```

#### Choose a connected device
You can check all the connected devices by going to platform-tools folder and by calling:

```
./adb devices
```

That command lists the connected devices and shows their id:

```
List of devices attached
331[REDACTED]804	device
```

Remember to put your phone on file transfer mode.

If there is only one device connected, scrcpy will default to that. However, if there are multiple devices, you must specify the one to use by it's id:

```
scrcpy -s 331[REDACTED]804
```

#### Start scrcpy
You start scrcpy by simply calling `scrcpy` on terminal. 

The tool opens a new window which shows the screen of your phone.

![A screenshot displaying phone screen on laptop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikcgv905oynplyy7dyaw.png)

#### Record a video

Let's test one of the features to make sure everything is working as intended.

You can record a video of the screen of your phone by running:

```
scrcpy --record filename.mp4
```

The saved video can be found from the folder you are currently in.

### That's it!
I hope this blog post helped you to understand what scrcpy is and how it can be used! 

You can also follow my Instagram [@whatminjahacks](https://www.instagram.com/whatminjahacks/) if you are interested to see more about my days as a Cyber Security consultant and learn more about cyber security with me!