DEV Community

whatminjacodes [she/they]
whatminjacodes [she/they]

Posted on

Mobile Security Tools part 1: scrcpy

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 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 downloaded

If you are new to adb, I recommend you to first read what it is.

Check other needed prerequisites from the scrcpy GitHub.

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.

On Debian and Ubuntu, scrcpy can be installed by running:

sudo apt install scrcpy
Enter fullscreen mode Exit fullscreen mode

Choose a connected device

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

./adb devices
Enter fullscreen mode Exit fullscreen mode

That command lists the connected devices and shows their id:

List of devices attached
331[REDACTED]804    device
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

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
Enter fullscreen mode Exit fullscreen mode

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 if you are interested to see more about my days as a Cyber Security consultant and learn more about cyber security with me!

Top comments (0)