Hacker Public Radio

HPR3515: ADB and scrcpy


Listen Later

Android Debugging
Android Debug Bridge (adb) homepage
Install ADB Tools
There are multiple guides online as to how to install, but I found dnf install android-tools.x86_64 adb-enhanced.noarch the easiest. Similar commands are available for the other distros. Use your package manager to search for adb.
https://www.xda-developers.com/install-adb-windows-macos-linux/
Enable Developer options
Go to Settings. Usually via the pulldown menu from the top twice, and click the cog icon. Search for 'Build Number', it's usually in Click on 'About Phone' Click on 'Build Number' seven times.
Go back and then search for 'Developer options' it's usually in the System section
You'll need to turn on two features 'Android Debugging' and 'ADB over network'
While we are at it, go back and then search for 'IP Address' it's usually in the About phone section. You should see a IPv4 address eg: 192.168.1.100. Make note of the IP address as we'll use it later.
Using ADB
To get help use the command adb help
global options: Tell you how to connect to the phone
general commands: Shows your devices, and gives help
networking: Allows you to connect over the network but also to port forward and reverse traffic
file transfer: The only reliable way to get files to and from your device.
internal debugging: Shows how to control the server
USB
Plug your phone using a usb cable. There will be a notification and a popup to allow the connection.
Run adb shell and all going well you should see your phone. Commands like ls, cd, and find work well. For example find /storage/self/primary/.
Network
Unfortunately if you unplug your phone you no longer have a connection to it, but you can enable network access via tcp. Leave your phone connected to USB and then tell it to use a TCP/IP connection with the command adb tcpip 5555.
Then connect to the phone using the phones IP address and port 5555, adb connect 192.168.1.100:5555. It should reply with a connected to message
$ adb connect 192.168.1.100:5555
connected to 192.168.1.100:5555
Now commands like adb shell should allow you to access the phone even if it's not physically connected via usb.
Multiple devices
Got multiple devices then you can connect them all in the same way as shown above. The only issue is you need to tell adb which one you want to address.
The first thing you need to do is list the devices
$ adb devices -l
List of devices attached
192.168.1.100:5555 device product:XXXX model:XXXX device:XXXX transport_id:9
192.168.1.101:5555 device product:YYYY:ZZZZ device:ZZZZ transport_id:14
The important bit is the transport_id at the end. You can then use the adb command as normal but specifying the -t option
-t: allocate a pty if on a tty (-tt: force pty allocation)
So for example adb -t 14 shell would connect to phone YYYY
So that's it for remote control from the shell, but what if you want to see and interact with the screen itself ?
Remote screen sharing with scrcpy
From Wikipedia
scrcpy is a free and open-source s
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

290 Listeners

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec by Jerry Bell and Andrew Kalat

Defensive Security Podcast - Malware, Hacking, Cyber Security & Infosec

372 Listeners

LINUX Unplugged by Jupiter Broadcasting

LINUX Unplugged

268 Listeners

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast) by Johannes B. Ullrich

SANS Internet Stormcenter Daily Cyber Security Podcast (Stormcast)

651 Listeners

Curious Cases by BBC Radio 4

Curious Cases

821 Listeners

The Strong Towns Podcast by Strong Towns

The Strong Towns Podcast

423 Listeners

Late Night Linux by The Late Night Linux Family

Late Night Linux

164 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,059 Listeners

Cybersecurity Today by Jim Love

Cybersecurity Today

179 Listeners

CISO Series Podcast by David Spark, Mike Johnson, and Andy Ellis

CISO Series Podcast

189 Listeners

TechCrunch Daily Crunch by TechCrunch

TechCrunch Daily Crunch

42 Listeners

Strict Scrutiny by Crooked Media

Strict Scrutiny

5,800 Listeners

2.5 Admins by The Late Night Linux Family

2.5 Admins

98 Listeners

Cyber Security Headlines by CISO Series

Cyber Security Headlines

139 Listeners

What the Hack? by DeleteMe

What the Hack?

228 Listeners