Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Android Debug Bridge

This is a good article. Click here for more information.
From Wikipedia, the free encyclopedia
Tool for debugging Android-based devices
Not to be confused withAdvanced Debugger.

Android Debug Bridge
Starting the adb server inGNOME Terminal, which thenenumerates the devices. After that, ashell is opened on the device being debugged to run theuname command.
Original authorGoogle
Stable release
34.0.1 (March 2023)
Repositoryandroid.googlesource.com
Written inC++
Operating systemWindows, Linux, macOS
Included withAndroid SDK
TypeSoftware development tool
LicenseApache License 2.0
Websitedeveloper.android.com/studio/command-line/adb

TheAndroid Debug Bridge (commonly abbreviated asadb) is aprogramming tool used for thedebugging ofAndroid-based devices. Thedaemon on the Android device connects with the server on the host PC overUSB orTCP, which connects to the client that is used by the end-user over TCP. Made available asopen-source software under theApache License byGoogle since 2007, its features include a shell and the possibility to make backups. The adb software is available forWindows,Linux andmacOS. It has been misused bybotnets and othermalware, for which mitigations were developed such asRSA authentication and devicewhitelisting.

Features

[edit]
Android Device Monitor

Features of adb include copying files from the host computer,[1] installing apps, viewing logcat output, getting aUnix shell,[2] and rebooting intoQualcomm EDL mode.[3] For example, Androidapplications can be saved by the commandbackup to a file.[4] It also includes support for theJava Debug Wire Protocol.[5]

Somegraphical interfaces have been made available. The graphical Android Device Monitor inAndroid Studio can be used for retrieving information from an Android device.[6]

Android's method to install APK files on a device has been used as a way to sideload unofficial apps ontoWindows Subsystem for Android[7] and Chrome OS's Android virtual machine.[8]

Shizuku allows an Android phone to connect to its own ADB when connected to a wireless network. The application is available for free on the Google Play Store.[9]

Development history

[edit]

TheAndroid Software Development Kit (SDK) was first released in 2007.[10] Since 2017, Google made it possible to download adb separately from the Android SDK.[11]

In 2015, Microsoft released an Android emulator that can connect to the adb client.[12] In 2016 forAndroid Studio 2.0 a 5x performance improvement was made for installing apps and pushing files through adb.[13] For easier usage ofAndroid Things, a wrapper was made in 2017 around manual adb commands.[14] For Android 11 in 2020, Google added adb incremental installations.[15] In 2020, Wi-Fi adb was integrated into Android Studio for macOS.[16] In 2021 forAndroid 12, theadb backup command was limited so that backing up user data from apps is opt-in using a per-app manifesto configuration[17] after being deprecated in Android 10 along withadb restore.[18]Fuchsia will be backwards-compatible with adb. It will be replaced with fx and ffx.[19]

Setup

[edit]
  • For enabling USB debugging on the Android device, it needs to be enabled in the "developer settings" window
    For enabling USB debugging on the Android device, it needs to be enabled in the "developer settings" window
  • After the device is connected to the host computer, the user needs to verify the RSA key fingerprint of the host computer
    After the device is connected to the host computer, the user needs to verify the RSA key fingerprint of the host computer

Host computer

[edit]

For Windows, the Android SDK contains the adb.exe binary that can be extracted and installed.[20] How-To Geek recommends adding the folder containing the binaries to thePATH environment variable.[21]

OnUbuntu, adb can be installed with theandroid-tools-adb package.[22] ForDebian, it has been recommended to also install theandroid-sdk-platform-tools-common package next to theadb package, which installs theudev rules which makes it possible to run the tool withoutroot permissions.[23] For macOS and other Linux distributions, the platform tools can be downloaded and the PATH variable can be modified inbashrc.[24]

Android device

[edit]

InAndroid 4.2.2 or later (API level 17), a dialog is shown with an RSAfingerprint that the user needs to accept. This protects against computers exploiting the debugging mechanism without consent of the device user.[25] Starting in Android 4.2, the developer settings are hidden by default. Pressing seven times on the build number in the about menu makes them visible to the user. After that, the USB debugging option can be enabled.[26] Some Android vendors have different procedures to enable it. For example, Huawei requires entering a pincode before adb can be enabled.

If thetouchscreen of an Android device is broken, it can be possible to connect a mouse to the device usingUSB On-The-Go and enable USB debugging.[27][28]

Architecture

[edit]

The adb protocol can be transported over USB or overWi-Fi throughTCP. It uses aclient-server architecture. There are two different protocols in use. The first is between the client and the server and the second is between the server and the daemon. The adb daemon is implemented inC and located in the Android user space. The daemon is facilitated by the Android USB framework,UsbDeviceManager andUsbDebuggingManager.[5]

Client ↔ server protocol

[edit]

The communication mode between the client and server is a TCP socket. The server listens on a port, to which the client has to send a request. The request contains a 4-byte initial field in ASCII and a payload. The payload starts with the word host, to indicate it should be sent to the server. The server can then reply with OKAY or FAIL to indicate the status, combined with an optional payload and length.[5]

Server ↔ daemon protocol

[edit]

The messages sent from the server consist of a 24-byte long header, with the following fields:[5]

  • Command
  • First argument
  • Second argument
  • Length of the payload, 0 or higher
  • CRC-32 of the data payload
  • Magic value, calculated through command XOR0xFFFFFFFF

Security

[edit]

Up toAndroid 2.2, Android was vulnerable to theRageAgainstTheCageexploit. The adbdaemon did not check for the return value of thesetuidsystem call whendropping privileges. The exploitforks processes until it fails due to the exhaustion ofprocess identifiers. When the daemon crashes and restarts, it cannot start a new process with dropped privileges and keeps running as root. Then adb provided a root shell.[29] In 2017, a security vulnerability was disclosed that exploited ADB to take over the onboardmodem. The attack required adb to be already enabled and authorized, although some workarounds were available.[30]

Various families of malware such as ADB.Miner, Ares, IPStorm, Fbot and Trinity have scanned the internet for public availability of the adb interface and installed malware on those devices.[31] adb can also be used to removemalware, by booting intosafe mode and running theadb uninstall command.[32]

See also

[edit]

References

[edit]
  1. ^Darcey, Lauren (2012).Android wireless application development. Shane Conder (3rd ed.). Upper Saddle River, NJ: Addison-Wesley.ISBN 978-0-321-81383-1.OCLC 749852462.
  2. ^"Things You Can Do with Android's adb Command".For Dummies.Archived from the original on 2018-05-15. Retrieved2021-09-09.
  3. ^EASTTOM, CHUCK (2021).An In-Depth Guide to Mobile Device Forensics. [S.l.]: CRC PRESS. p. 72.ISBN 978-0-367-63300-4.OCLC 1250310301.
  4. ^Jack Wallen (2015-03-06)."How to create a full backup of your Android device without root".Archived from the original on 2016-01-24. Retrieved2016-01-29.
  5. ^abcdRegupathy, Rajaram (2014).Unboxing Android USB: a hands-on approach with real World examples. Berkeley, CA.ISBN 978-1-4302-6209-1.OCLC 880673864.{{cite book}}: CS1 maint: location missing publisher (link)
  6. ^Morgillo, Ivan; Viola, Stefano (2016).Learning embedded Android N programming: create the perfectly customized system by unleashing the power of Android OS on your embedded device. Birmingham, UK. p. 89.ISBN 9781785283284.OCLC 1020708322.Archived from the original on 2021-09-26. Retrieved2021-09-26.{{cite book}}: CS1 maint: location missing publisher (link)
  7. ^"How to sideload Android apps on Windows 11". 23 January 2022.
  8. ^"How to sideload apps to a Chromebook". 5 March 2023.
  9. ^"User manual | Shizuku".shizuku.rikka.app. Retrieved2024-07-19.
  10. ^"Google releases Android SDK".Macworld.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  11. ^"Google makes ADB, fastboot, and other platform tools available without full SDK or Android Studio download".Android Police. 2017-01-05.Archived from the original on 2021-04-10. Retrieved2021-09-09.
  12. ^Vasile, Cosmin."Microsoft Releases Android Emulator and It's Supposed to Be Faster than Google's".Softpedia.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  13. ^"Android Studio 2.0 - Beta".Android Developers Blog.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  14. ^"Android Things Developer Preview 6".Android Developers Blog.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  15. ^"Turning it up to 11: Android 11 for developers".Android Developers Blog.Archived from the original on 2021-09-17. Retrieved2021-09-10.
  16. ^"Announcing Android Studio Arctic Fox (2020.3.1) & Android Gradle plugin 7.0".Android Developers Blog.Archived from the original on 2021-09-12. Retrieved2021-09-10.
  17. ^"Behavior changes: Apps targeting Android 12 | Android 12 Beta".Android Developers.Archived from the original on 2021-09-28. Retrieved2021-09-28.
  18. ^"Google Considers Removing Android ADB Backup and Restore".
  19. ^Bradshaw, Kyle (2022-08-26)."Google wants to make Fuchsia devices manageable with Android's ADB tool".9to5Google. Retrieved2022-08-29.
  20. ^Harwani, B. M. (2013).PhoneGap build: developing cross platform mobile applications in the cloud. Boca Raton. p. 38.ISBN 978-1-4665-8975-9.OCLC 862745697.{{cite book}}: CS1 maint: location missing publisher (link)
  21. ^Hoffman, Chris; Fedewa, Joe (4 September 2021)."How to Install and Use ADB, the Android Debug Bridge Utility".How-To Geek.Archived from the original on 2021-09-18. Retrieved2021-09-09.
  22. ^Smyth, Neil (2020). "7".Android Studio 4. 0 Development Essentials - Java Edition: Developing Android Apps Using Android Studio 4. 0, Java and Android Jetpack. Cary.ISBN 978-1-951442-21-7.OCLC 1190906409.{{cite book}}: CS1 maint: location missing publisher (link)
  23. ^"Debian -- Details of package adb in bullseye".packages.debian.org.Archived from the original on 2021-09-08. Retrieved2021-09-08.
  24. ^"How to Install Android Debug Bridge (ADB) and Fastboot".Lifewire.Archived from the original on 2022-01-30. Retrieved2022-01-18.
  25. ^"Run apps on a hardware device".Android Developers.Archived from the original on 2021-09-08. Retrieved2021-09-08.
  26. ^Wallen, Jack."How to enable Developer options in Android 4.2".TechRepublic.Archived from the original on 2021-09-09. Retrieved2021-09-09.
  27. ^Ogubuike, Udochi (2019-08-09)."How to enable USB debugging mode on Android".The Punch.Archived from the original on 2019-09-17. Retrieved2021-09-09.
  28. ^Aranzulla, Salvatore."Come attivare debug USB".Salvatore Aranzulla (in Italian).Archived from the original on 2021-09-09. Retrieved2021-09-09.
  29. ^Drake, Joshua J. (2014).Android hacker's handbook. Zach Lanier, Collin Mulliner, Pau Oliva, Stephen A. Ridley, Georg Wicherski. Indianapolis, IN: Wiley. p. 75.ISBN 978-1-118-60861-6.OCLC 875820167.
  30. ^Mendelsohn, Tom (2017-01-09)."Google plugs severe Android vulnerability that exposed devices to spying".Ars Technica.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  31. ^Cimpanu, Catalin."Android devices ensnared in DDoS botnet".ZDNet.Archived from the original on 2021-09-10. Retrieved2021-09-10.
  32. ^Schuman, Evan."This Vultur app takes malicious to the next level".Computerworld.Archived from the original on 2021-09-10. Retrieved2021-09-10.

External links

[edit]
Software
development
Development tools
Official
Other
Integrated development
environments
(IDE)
Languages,databases
Augmented reality andvirtual reality
Events,communities
Releases
Derivatives
Devices
Pixel
Nexus
Play edition
Custom
distributions
Booting and
recovery
APIs
AlternativeUIs
Rooting
Lists
Related topics
Retrieved from "https://en.wikipedia.org/w/index.php?title=Android_Debug_Bridge&oldid=1315595115"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp