Adb se obično nalazi u:
#Windows
C:\Users\<username>\AppData\Local\Android\sdk\platform-tools\adb.exe
#MacOS
/Users/<username>/Library/Android/sdk/platform-tools/adb
Informacije dobijene sa: http://adbshell.com/
Povezivanje
adb devices
Ovo će prikazati povezane uređaje; ako se pojavi "neovlašćeno", to znači da morate otključati svoj mobilni i prihvatiti vezu.
Ovo ukazuje uređaju da treba da pokrene adb server na portu 5555:
adb tcpip 5555
Povežite se na tu IP adresu i tu Portu:
adb connect <IP>:<PORT>
Ako dobijete grešku poput sledeće u virtuelnom Android softveru (kao što je Genymotion):
adb server version (41) doesn't match this client (36); killing...
To je zato što pokušavate da se povežete na ADB server sa drugom verzijom. Samo pokušajte da pronađete adb binarni fajl koji softver koristi (idite na C:\Program Files\Genymobile\Genymotion
i potražite adb.exe)
Nekoliko uređaja
Kada god pronađete nekoliko uređaja povezanih sa vašim računarom moraćete da odredite u kojem želite da pokrenete adb komandu.
adb devices
List of devices attached
10.10.10.247:42135 offline
127.0.0.1:5555 device
adb -s 127.0.0.1:5555 shell
x86_64:/ # whoami
root
Port Tunneling
U slučaju da je adb port dostupan samo sa localhost na android uređaju, ali imate pristup putem SSH, možete proslediti port 5555 i povezati se putem adb:
ssh -i ssh_key username@10.10.10.10 -L 5555:127.0.0.1:5555 -p 2222
adb connect 127.0.0.1:5555
Paket Menadžer
Instaliraj/Deinstaliraj
adb install [option] <path>
adb install test.apk
adb install -l test.apk # forward lock application
adb install -r test.apk # replace existing application
adb install -t test.apk # allow test packages
adb install -s test.apk # install application on sdcard
adb install -d test.apk # allow version code downgrade
adb install -p test.apk # partial application install
adb uninstall [options] <PACKAGE>
adb uninstall com.test.app
adb uninstall -k com.test.app Keep the data and cache directories around after package removal.
Paketi
Ispisuje sve pakete, opcionalno samo one čija ime paketa sadrži tekst u <FILTER>.
adb shell pm list packages [options] <FILTER-STR>
adb shell pm list packages <FILTER-STR>
adb shell pm list packages -f <FILTER-STR> #See their associated file.
adb shell pm list packages -d <FILTER-STR> #Filter to only show disabled packages.
adb shell pm list packages -e <FILTER-STR> #Filter to only show enabled packages.
adb shell pm list packages -s <FILTER-STR> #Filter to only show system packages.
adb shell pm list packages -3 <FILTER-STR> #Filter to only show third party packages.
adb shell pm list packages -i <FILTER-STR> #See the installer for the packages.
adb shell pm list packages -u <FILTER-STR> #Also include uninstalled packages.
adb shell pm list packages --user <USER_ID> <FILTER-STR> #The user space to query.
adb shell pm path <PACKAGE>
Ispisuje putanju do APK-a datog .
adb shell pm path com.android.phone
adb shell pm clear <PACKAGE>
Obriši sve podatke povezane sa paketom.
adb shell pm clear com.test.abc
File Manager
adb pull <remote> [local]
Preuzmite određenu datoteku sa emulatora/uređaja na vaš računar.
adb pull /sdcard/demo.mp4 ./
adb push <local> <remote>
Otpremite određenu datoteku sa vašeg računara na emulator/uređaj.
adb push test.apk /sdcard
Screencapture/Screenrecord
adb shell screencap <filename>
Uzima screenshot prikaza uređaja.
adb shell screencap /sdcard/screen.png
adb shell screenrecord [options] <filename>
Snima ekran uređaja koji koriste Android 4.4 (API nivo 19) i novije verzije.
adb shell screenrecord /sdcard/demo.mp4
adb shell screenrecord --size <WIDTHxHEIGHT>
adb shell screenrecord --bit-rate <RATE>
adb shell screenrecord --time-limit <TIME> #Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).
adb shell screenrecord --rotate # Rotates 90 degrees
adb shell screenrecord --verbose
(pritiskom Ctrl-C prekinite snimanje)
**Možete preuzeti datoteke (slike i video zapise) koristeći **adb pull
Shell
adb shell
Dobijte shell unutar uređaja
adb shell
adb shell <CMD>
Izvršite komandu unutar uređaja
adb shell ls
pm
Sledeće komande se izvršavaju unutar shell-a
pm list packages #List installed packages
pm path <package name> #Get the path to the apk file of tha package
am start [<options>] #Start an activity. Whiout options you can see the help menu
am startservice [<options>] #Start a service. Whiout options you can see the help menu
am broadcast [<options>] #Send a broadcast. Whiout options you can see the help menu
input [text|keyevent] #Send keystrokes to device
Procesi
Ako želite da dobijete PID procesa vaše aplikacije, možete izvršiti:
adb shell ps
I pretražite svoju aplikaciju
Ili možete uraditi
adb shell pidof com.your.application
I odštampati PID aplikacije
Sistem
adb root
Ponovo pokreće adbd daemon sa root dozvolama. Zatim, morate ponovo da se povežete na ADB server i bićete root (ako je dostupno).
adb sideload <update.zip>
flashing/restoring Android update.zip paketa.
Logovi
Logcat
Da filtrirate poruke samo jedne aplikacije, dobijte PID aplikacije i koristite grep (linux/macos) ili findstr (windows) da filtrirate izlaz logcata:
adb logcat | grep 4526
adb logcat | findstr 4526
adb logcat [опција] [филтер-спецификације]
adb logcat
Napomene: pritisnite Ctrl-C da zaustavite nadzor
adb logcat *:V # lowest priority, filter to only show Verbose level
adb logcat *:D # filter to only show Debug level
adb logcat *:I # filter to only show Info level
adb logcat *:W # filter to only show Warning level
adb logcat *:E # filter to only show Error level
adb logcat *:F # filter to only show Fatal level
adb logcat *:S # Silent, highest priority, on which nothing is ever printed
adb logcat -b <Buffer>
adb logcat -b # radio View the buffer that contains radio/telephony related messages.
adb logcat -b # event View the buffer containing events-related messages.
adb logcat -b # main default
adb logcat -c # Clears the entire log and exits.
adb logcat -d # Dumps the log to the screen and exits.
adb logcat -f test.logs # Writes log message output to test.logs .
adb logcat -g # Prints the size of the specified log buffer and exits.
adb logcat -n <count> # Sets the maximum number of rotated logs to <count>.
dumpsys
dumps sistemske podatke
adb shell dumpsys [options]
adb shell dumpsys
adb shell dumpsys meminfo
adb shell dumpsys battery
Napomene: Mobilni uređaj sa omogućenom opcijom za programere koji koristi Android 5.0 ili noviji.
adb shell dumpsys batterystats collects battery data from your device
Napomene: Battery Historian pretvara te podatke u HTML vizualizaciju. KORAK 1 adb shell dumpsys batterystats > batterystats.txt KORAK 2 python historian.py batterystats.txt > batterystats.html
adb shell dumpsys batterystats --reset erases old collection data
adb shell dumpsys activity
Backup
Napravite rezervnu kopiju Android uređaja putem adb.
adb backup [-apk] [-shared] [-system] [-all] -f file.backup
# -apk -- Include APK from Third partie's applications
# -shared -- Include removable storage
# -system -- Include system Applciations
# -all -- Include all the applications
adb shell pm list packages -f -3 #List packages
adb backup -f myapp_backup.ab -apk com.myapp # backup on one device
adb restore myapp_backup.ab # restore to the same or any other device
Ako želite da pregledate sadržaj rezervne kopije:
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 myapp_backup.ab ) | tar xfvz -
tip
Učite i vežbajte AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Učite i vežbajte GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
Podržite HackTricks
- Proverite planove pretplate!
- Pridružite se 💬 Discord grupi ili telegram grupi ili pratite nas na Twitteru 🐦 @hacktricks_live.
- Podelite hakerske trikove slanjem PR-ova na HackTricks i HackTricks Cloud github repozitorijume.