SlideShare a Scribd company logo
Interacting with your app
through command line
Roman Mazur
Software Engineer @ Stanfy
@roman_mazur
#androidshell
#androidshell @roman_mazur#androidshell @roman_mazur
Real time updates

vs

polling with “adb devices”
How is the magic done?
#androidshell @roman_mazur#androidshell @roman_mazur
Stetho dumpapp
Another magic
#androidshell @roman_mazur#androidshell @roman_mazur
Use Chrome Dev Tools for
you app just like for a web
browser
#androidshell @roman_mazur
Connecting to a device
ADB
#androidshell @roman_mazur
adbd
shell
Local socket

@stetho_my.pckg_devtools_remote
tcp:<port>
ADB Services
Device 1
dumpapp
ADB
Server

:5037
Dev machine
Connecting to a device
1. Select device
2. Select service

“localabstract:name”
adbd
Device 2
3. Delegate
#androidshell @roman_mazur
dumpapp
ADB
Server

:5037
Dev machine
ADB Server
1. Select device
2. Select service

“localabstract:name”
$ lsof -i :5037
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 458 roman 14u IPv4 0x6811aab866733861 0t0 TCP localhost:54221->localhost:5037 (ESTABLISHED)
studio 11523 roman 31u IPv4 0x6811aab87e409539 0t0 TCP localhost:55391->localhost:5037 (ESTABLISHED)
studio 11523 roman 32u IPv4 0x6811aab87e3c2861 0t0 TCP localhost:53970->localhost:5037 (ESTABLISHED)
studio 11523 roman 33u IPv4 0x6811aab8668d3539 0t0 TCP localhost:53972->localhost:5037 (ESTABLISHED)
studio 11523 roman 35u IPv4 0x6811aab865be8861 0t0 TCP localhost:59588->localhost:5037 (ESTABLISHED)
studio 11523 roman 425u IPv4 0x6811aab866848861 0t0 TCP localhost:49906->localhost:5037 (ESTABLISHED)
adb 11743 roman 4u IPv4 0x6811aab865bd6a51 0t0 TCP localhost:5037->localhost:54221 (ESTABLISHED)
adb 11743 roman 6u IPv4 0x6811aab8667de861 0t0 TCP localhost:5037->localhost:49906 (ESTABLISHED)
adb 11743 roman 7u IPv4 0x6811aab866765c41 0t0 TCP localhost:5037 (LISTEN)
adb 11743 roman 10u IPv4 0x6811aab866788e31 0t0 TCP localhost:5037->localhost:53970 (ESTABLISHED)
adb 11743 roman 12u IPv4 0x6811aab85e985a51 0t0 TCP localhost:5037->localhost:53972 (ESTABLISHED)
adb 11743 roman 13u IPv4 0x6811aab8668cb861 0t0 TCP localhost:5037->localhost:55391 (ESTABLISHED)
adb 11743 roman 14u IPv4 0x6811aab87e3f6861 0t0 TCP localhost:5037->localhost:59588 (ESTABLISHED)
Google Chrome, Android
Studio, adb client, Stetho
dumpapp talk to it
#androidshell @roman_mazur
adbd
shell
Local socket

@stetho_my.pckg_devtools_remote
tcp:<port>
ADB Services
Device 1
ADB Deamon
$ adb shell ps | grep adb
shell 25878 1 26068 360 ffffffff 00000000 S /sbin/adbd
Runs as a shell user on a
device exposing different
services
$ adb shell cat /proc/net/unix | grep remote
00000000: 00000002 00000000 00010000 0001 01 309885 @stetho_com.stanfy.cmdline_devtools_remote
00000000: 00000002 00000000 00010000 0001 01 81886 @chrome_devtools_remote
#androidshell @roman_mazur
Other use case
Stream your screen like Vysor:
MediaProjection + VirtualDisplay API + adb connection
#androidshell @roman_mazur#androidshell @roman_mazur
adb shell
#androidshell @roman_mazur
adbd
shell
Local socket

@stetho_my.pckg_devtools_remote
tcp:<port>
ADB Services
Device 1
adb
ADB
Server

:5037
Dev machine
Connecting to a device
adbd
Device 2
#androidshell @roman_mazur
adb shell
Start your activity
am start -n <package>/<activity>
Simulate key strokes
input keyevent <code: 4 - back, 3 - home>
#androidshell @roman_mazur#androidshell @roman_mazur
dumpsys activity
#androidshell @roman_mazur
dumpsys activity
Your entry point
dumpsys activity -h
Might be very useful
dumpsys activity top
dumpsys activity package <package>

service <package>/<service-name> 

provider <package>/<provider-name>
#androidshell @roman_mazur
References and further reading
ADB sources
https://github.com/android/platform_system_core/tree/master/adb
Stetho tool
https://github.com/facebook/stetho
“Embedded Android” book
http://shop.oreilly.com/product/0636920021094.do
#androidshell @roman_mazur
Thank you!
Questions?Questions? #androidshell
@roman_mazur
+RomanMazur
www.stanfy.com

More Related Content

Similar to Interacting with your app through the command line

Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
Positive Hack Days
 
Webinar slides: How to Secure MongoDB with ClusterControl
Webinar slides: How to Secure MongoDB with ClusterControlWebinar slides: How to Secure MongoDB with ClusterControl
Webinar slides: How to Secure MongoDB with ClusterControl
Severalnines
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
Bachkoutou Toutou
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
Hell19
 
Pentesting111111 Cheat Sheet_OSCP_2023.pdf
Pentesting111111 Cheat Sheet_OSCP_2023.pdfPentesting111111 Cheat Sheet_OSCP_2023.pdf
Pentesting111111 Cheat Sheet_OSCP_2023.pdf
faker1842002
 
Mobile Enterprise Applications
Mobile Enterprise ApplicationsMobile Enterprise Applications
Mobile Enterprise Applications
Jason Conger
 

Similar to Interacting with your app through the command line (20)

Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 
Android - ADB
Android - ADBAndroid - ADB
Android - ADB
 
Android tools for testers
Android tools for testersAndroid tools for testers
Android tools for testers
 
9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training9 creating cent_os 7_mages_for_dpdk_training
9 creating cent_os 7_mages_for_dpdk_training
 
Webinar slides: How to Secure MongoDB with ClusterControl
Webinar slides: How to Secure MongoDB with ClusterControlWebinar slides: How to Secure MongoDB with ClusterControl
Webinar slides: How to Secure MongoDB with ClusterControl
 
Php Inside - confoo 2011 - Derick Rethans
Php Inside -  confoo 2011 - Derick RethansPhp Inside -  confoo 2011 - Derick Rethans
Php Inside - confoo 2011 - Derick Rethans
 
Presentation iv implementasi 802x eap tls peap mscha pv2
Presentation iv implementasi  802x eap tls peap mscha pv2Presentation iv implementasi  802x eap tls peap mscha pv2
Presentation iv implementasi 802x eap tls peap mscha pv2
 
Android Bluetooth Introduction
Android Bluetooth IntroductionAndroid Bluetooth Introduction
Android Bluetooth Introduction
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
R bernardino hand_in_assignment_week_1
R bernardino hand_in_assignment_week_1R bernardino hand_in_assignment_week_1
R bernardino hand_in_assignment_week_1
 
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, BerlinAbgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
Abgeschottete Realität - Testen im Emulator, Mobile Testing Days 2014, Berlin
 
Free radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmapleFree radius billing server with practical vpn exmaple
Free radius billing server with practical vpn exmaple
 
Hacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote AccessHacker Halted 2014 - Post-Exploitation After Having Remote Access
Hacker Halted 2014 - Post-Exploitation After Having Remote Access
 
Pentesting111111 Cheat Sheet_OSCP_2023.pdf
Pentesting111111 Cheat Sheet_OSCP_2023.pdfPentesting111111 Cheat Sheet_OSCP_2023.pdf
Pentesting111111 Cheat Sheet_OSCP_2023.pdf
 
Betabeers Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platformBetabeers   Android as a Digital Signage platform
Betabeers Android as a Digital Signage platform
 
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Mobile Enterprise Applications
Mobile Enterprise ApplicationsMobile Enterprise Applications
Mobile Enterprise Applications
 
Vulnerabilities in multiplayer games (2001-2012)
Vulnerabilities in multiplayer games (2001-2012)Vulnerabilities in multiplayer games (2001-2012)
Vulnerabilities in multiplayer games (2001-2012)
 
Troubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support EngineerTroubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support Engineer
 

Recently uploaded

Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 

Interacting with your app through the command line