Lect_2 - Deekshith19/Android_Security GitHub Wiki
Android Debug Bridge (adb)
It is a versatile command-line tool that lets you communicate with a device.The adb command facilitates a variety of device actions, such as installing and debugging apps. adb provides access to a Unix shell that you can use to run a variety of commands on a device.
- Client: Sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an
adb
command. - Daemon (adbd): Runs commands on a device. The daemon runs as a background process on each device. The daemon on the Android device connects with the server on the host PC over USB or TCP, which connects to the client that is used by the end-user over TCP.
- Server: Manages communication between the client and the daemon. The server runs as a background process on your development machine. The default port number on which the
adb
server runs is 5037.
adb is included in the Android SDK Platform Tools package, which is installed at ${ANDROID_HOME}/platform-tools/
After the PATH environment variable is set appropriately, we verify the program execution by typing adb in the terminal
Android Virtual Device (AVD) is started by typing the following command-
emulator -list-avds
emulator -avd Pixel_3a_API_34 -gpu off
Basic ADB Commands
adb devices
adb-s emulator-5554 shell
Basic commands-
pm (Package Manager) is an utility program for retrieving various kinds of information related to theapplication packages that are currently installed on the device.
pm list packages
pm list packages | grep youtube
pm list packages has various options to configure the output.-3 option is used to filter and display only show third party packages.-s option is used to filter and display only system packages
pm list packages -3
To check the Process ID (PID) of the currently running applications, we use the ps-A command.
ps -A | grep youtube
pm path is used to get the path of the installed APK file.
pm path com.google.android.youtube
then Exit
adb pull /product/app/YouTube/YouTube.apk
dir
echo "This is some file" > somefile.txt
adb push somefile.txt /sdcard/
somefile
got txt.