Skip to content

Latest commit

 

History

History
149 lines (130 loc) · 4 KB

android-cheat-sheet.md

File metadata and controls

149 lines (130 loc) · 4 KB

Android development cheat sheet

PC software for managing Android device

Odin

Odin for Linux

  1. install heimdall
    ubuntu_version=$(lsb_release -rs | cut -d. -f1)
    if [ "$ubuntu_version" -ge 22 ]; then 
        sudo apt install heimdall-flash heimdall-flash-frontend
        heimdall print-pit
    fi
  2. download release of JOdin3 and run JOdin3CASUAL
    soft; mkdir odin3; cd odin3
    wget https://github.com/GameTheory-/jodin3/releases/download/v1.0/Jodin3.zip
    unzip Jodin3.zip
    ls -la Jodin3/JOdin3CASUAL

Android Debug Bridge creates a connection (bridge) between the device and computer. should be activated:

  1. developer mode
  2. USB debug

adb install via Debian APT

sudo apt -y install adb
adb version
adb devices

copy files

adb push test.apk /sdcard
adb pull /sdcard/demo.mp4 e:\

restart device in recovery mode

adb reboot
adb reboot recovery

list of all applications/packages

adb shell pm list packages -f
adb shell pm list packages -f | awk -F '.apk=' '{printf "%-50s | %s\n", $2, $1}'
# adb shell; 
# pm list packages -f

permission by package

PACKAGE_NAME=com.google.android.youtube
adb shell dumpsys package $PACKAGE_NAME | grep -i permission | grep -i granted=true

list of all permissions

adb shell pm list permissions

list of all features

adb shell pm list features
# print one file from OS
adb shell cat /proc/cpuinfo

# https://source.android.com/docs/core/architecture/bootloader/locking_unlocking
adb shell getprop | grep oem
adb shell getprop sys.oem_unlock_allowed
adb shell setprop sys.oem_unlock_allowed 1
# dmesg -wH

list of all settings

adb shell service list
adb shell settings list --user current secure 
adb shell settings get secure location_providers_allowed
adb shell settings get secure enabled_accessibility_services

send keyboard event

adb shell input keyevent KEYCODE_HOME

# KEYCODE_A: A
# KEYCODE_B: B
# KEYCODE_ENTER: Enter
# KEYCODE_SPACE: Space
# KEYCODE_BACK: Back button
# KEYCODE_HOME: Home button

works only in "bootloader" or "fastboot" or "download" mode. boot your Android device into the bootloader mode

fastboot install via Debian APT

sudo apt -y install fastboot
fastboot version

check connected phone

sudo apt install adb 

adb devices

lsusb
# Bus 001 Device 013: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy A5 (MTP)

fix issue with root:root usb access

ls -l /dev/bus/usb/001/013
# crw-rw-r--+ 1 root plugdev 189, 10 Mai 21 13:50 /dev/bus/usb/001/011

# if group is root, not a plugdev
sudo vim /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0660", GROUP="plugdev", SYMLINK+="android%n"

sudo service udev status

decompilation, opening Android apk

download latest release

GIT_ACCOUNT=skylot
GIT_PROJECT=jadx
version=`wget -v https://github.com/${GIT_ACCOUNT}/${GIT_PROJECT}/releases/latest/download/$GIT_RELEASE_ARTIFACT 2>&1 | grep following | awk '{print $2}' | awk -F '/' '{print $8}'`
GIT_RELEASE_ARTIFACT=jadx-${version:1}.zip
wget -v https://github.com/${GIT_ACCOUNT}/${GIT_PROJECT}/releases/latest/download/$GIT_RELEASE_ARTIFACT

start gui

./bin/jadx-gui