Using Scrcpy to Mirror Android Screens

I recently learned about scrcpy, and it makes Android mirroring so much easier.

Scrcpy - Introduction

In the past, I've used various Chrome plugins or odd apps to try and control my Android device from my computer.

There was always the option for an emulator like BlueStacks, but that wasn't quite what I wanted.

When searching for another way recently, I ran across scrcpy, and it was exactly what I had been looking for.

I've wanted something like this for Android testing/automation, or just using my phone without having to pick it up.

Installation

First, you can find everything that you will need at the GitHub repository.

I also recommend looking at the FAQ. I've personally run into the issue where the mouse was clicking in the wrong location, and the fix was right there.

First, I needed to install the android-platform-tools on my system.

doyler@mbp:~/tools$ brew cask install android-platform-tools
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
cargo-c                   devdash                   kind                      mysql-client@5.7          rav1e
cartridge-cli             gimme-aws-creds           liblouis                  node@12                   sentencepiece
cups                      helm@2                    monolith                  postgresql@11             trader
==> Updated Formulae

... <snip> ...

==> Linking Binary 'mke2fs' to '/usr/local/bin/mke2fs'.
 android-platform-tools was successfully installed!

I verified this installation by running the adb devices command.

doyler@mbp:~/tools$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
70xxxxxxxxxxxx	unauthorized

doyler@mbp:~/tools$ adb devices
List of devices attached
70xxxxxxxxxxxx	device

Next, I connected to an adb shell, to confirm that everything was working as expected.

doyler@mbp:~/tools$ adb shell
taimen:/ $ id
uid=2000(shell) gid=2000(shell) groups=2000(shell),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc),3011(uhid) context=u:r:shell:s0

With the Android tools installed, I also used Homebrew to install scrcpy. Note that this requires nothing, not even root, on the target device.

doyler@mbp:~/tools$ brew install scrcpy

Usage

With everything installed, I just had to run the application and it handled everything for me.

doyler@mbp:~/tools$ scrcpy
2019-11-25 11:10:04.682 scrcpy[47767:37867866] INFO: scrcpy 1.11 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.11/share/scrcpy/scrcpy-server: 1 file pushed. 0.9 MB/s (25454 bytes in 0.027s)
2019-11-25 11:11:06.170 scrcpy[47767:37867866] INFO: Initial texture: 1440x2880
2019-11-25 11:13:52.693 scrcpy[47767:37867866] INFO: New texture: 2880x1440
2019-11-25 11:13:53.211 scrcpy[47767:37867866] INFO: New texture: 1440x2880
2019-11-25 11:15:06.444 scrcpy[47767:37867866] WARN: Device disconnected

As you can see, I was able to control my device with my keyboard and mouse, and no additional software!

Scrcpy - Android control

Scrcpy - Conclusion

This was a simpler tool to install, but I love that about it.

I won't be able to easily automate some things, as it would still require scripting or screen scraping. That said, this is exactly what I was looking for in the realm of connection and control.

If you have any suggestions for more Android automation, or mobile games that I should try, then definitely let me know!

doyler on Githubdoyler on Twitter
doyler
Ray Doyle is an avid pentester/security enthusiast/beer connoisseur who has worked in IT for almost 16 years now. From building machines and the software on them, to breaking into them and tearing it all down; he's done it all. To show for it, he has obtained an OSCE, OSCP, eCPPT, GXPN, eWPT, eWPTX, SLAE, eMAPT, Security+, ICAgile CP, ITIL v3 Foundation, and even a sabermetrics certification!

He currently serves as a Senior Staff Adversarial Engineer for Avalara, and his previous position was a Principal Penetration Testing Consultant for Secureworks.

When he's not figuring out what cert to get next or side project to work on, he enjoys playing video games, traveling, and watching sports.

As an Amazon Associate I earn from qualifying purchases.

Common passed on this blog, I made it to a jam.

1 Comment

Filed under Security Not Included

One Response to Using Scrcpy to Mirror Android Screens

  1. Pingback: Using Scrcpy to Mirror Android Screens | doyler.net – The Garden Society Newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.

This site uses Akismet to reduce spam. Learn how your comment data is processed.