यह जुड़े हुए उपकरणों की सूची बनाएगा; यदि "अनधिकृत" दिखाई देता है, तो इसका मतलब है कि आपको अपने मोबाइल को अनब्लॉक करना होगा और कनेक्शन को स्वीकार करना होगा।
यह उपकरण को सूचित करता है कि इसे पोर्ट 5555 में adb सर्वर शुरू करना है:
adb tcpip 5555
किसी IP और पोर्ट से कनेक्ट करें:
adb connect <IP>:<PORT>
यदि आपको एक त्रुटि मिलती है जैसे निम्नलिखित वर्चुअल एंड्रॉइड सॉफ्टवेयर (जैसे Genymotion) में:
adb server version (41) doesn't match this client (36); killing...
यह इसलिए है क्योंकि आप एक विभिन्न संस्करण के ADB सर्वर से कनेक्ट करने का प्रयास कर रहे हैं। बस सॉफ़्टवेयर द्वारा उपयोग किए जा रहे adb बाइनरी को खोजने का प्रयास करें (जाएं C:\Program Files\Genymobile\Genymotion और adb.exe खोजें)
कई डिवाइस
जब भी आपके मशीन से कई डिवाइस कनेक्ट होते हैं तो आपको उसमें से किसमें adb कमांड चलाना है, उसे निर्दिष्ट करना होगा।
यदि adbपोर्ट केवल एंड्रॉयड डिवाइस में localhost से पहुंचने योग्य है लेकिन आपके पास SSH के माध्यम से पहुंच है, तो आप पोर्ट 5555 को फॉरवर्ड कर सकते हैं और adb के माध्यम से कनेक्ट कर सकते हैं:
उन सभी पैकेजों को प्रिंट करता है, वैकल्पिक रूप से केवल उन्हें जिनका पैकेज नाम <FILTER> में दिया गया पाठ हो।
adb shell pm list packages [options] <FILTER-STR>
adbshellpmlistpackages<FILTER-STR>adbshellpmlistpackages-f<FILTER-STR>#See their associated file.adbshellpmlistpackages-d<FILTER-STR>#Filter to only show disabled packages.adbshellpmlistpackages-e<FILTER-STR>#Filter to only show enabled packages.adbshellpmlistpackages-s<FILTER-STR>#Filter to only show system packages.adbshellpmlistpackages-3<FILTER-STR>#Filter to only show third party packages.adbshellpmlistpackages-i<FILTER-STR>#See the installer for the packages.adbshellpmlistpackages-u<FILTER-STR>#Also include uninstalled packages.adbshellpmlistpackages--user<USER_ID><FILTER-STR>#The user space to query.
adb shell pm path <PACKAGE>
दिए गए पैकेज के APK का पथ प्रिंट करें।
adbshellpmpathcom.android.phone
adb shell pm clear <PACKAGE>
एक पैकेज के साथ जुड़ी सभी डेटा को हटा देता है।
adbshellpmclearcom.test.abc
फ़ाइल प्रबंधक
adb pull <remote> [local]
एक निर्दिष्ट फ़ाइल को एम्युलेटर/डिवाइस से अपने कंप्यूटर पर डाउनलोड करें।
adbpull/sdcard/demo.mp4./
adb push <local> <remote>
अपने कंप्यूटर से एक निर्दिष्ट फ़ाइल को एम्युलेटर/डिवाइस पर अपलोड करें।
adbpushtest.apk/sdcard
स्क्रीनकैप्चर/स्क्रीनरिकॉर्ड
adb shell screencap <फ़ाइलनाम>
एक डिवाइस प्रदर्शन का स्क्रीनशॉट लेना।
adbshellscreencap/sdcard/screen.png
adb shell screenrecord [options] <filename>
उन उपकरणों की डिस्प्ले रिकॉर्ड करें जो Android 4.4 (API स्तर 19) और उससे ऊपर चल रहे हैं।
adbshellscreenrecord/sdcard/demo.mp4adbshellscreenrecord--size<WIDTHxHEIGHT>adbshellscreenrecord--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).
adbshellscreenrecord--rotate# Rotates 90 degreesadbshellscreenrecord--verbose
(press Ctrl-C दबाएं रिकॉर्डिंग रोकने के लिए)
आप फ़ाइलें (छवियाँ और वीडियो) डाउनलोड कर सकते हैं उपयोग करके _adb pull_
शैल
adb shell
उपकरण के अंदर एक शैल प्राप्त करें
adbshell
adb shell <CMD>
उपकरण के अंदर एक कमांड को चलाएं
adbshellls
pm
निम्नलिखित कमांड शैल में निष्पादित किए जाते हैं
pmlistpackages#List installed packagespmpath<packagename>#Get the path to the apk file of tha packageamstart [<options>] #Start an activity. Whiout options you can see the help menuamstartservice [<options>] #Start a service. Whiout options you can see the help menuambroadcast [<options>] #Send a broadcast. Whiout options you can see the help menuinput [text|keyevent]#Send keystrokes to device
प्रक्रियाएँ
यदि आप अपने एप्लिकेशन की प्रक्रिया का पीआईडी प्राप्त करना चाहते हैं तो आप निम्नलिखित को क्रियान्वित कर सकते हैं:
adbshellps
और अपने एप्लिकेशन के लिए खोजें
या आप कर सकते हैं
adbshellpidofcom.your.application
और यह एप्लिकेशन का पीआईडी प्रिंट करेगा
सिस्टम
adbroot
एडीबीडी डेमन को रूट अनुमतियों के साथ पुनः आरंभ करें। फिर, आपको फिर से एडीबी सर्वर से कनेक्ट करना होगा और आप रूट होंगे (यदि उपलब्ध है)।
adbsideload<update.zip>
लॉग
लॉगकैट
केवल एक एप्लिकेशन के संदेशों को फ़िल्टर करने के लिए, एप्लिकेशन का पीआईडी प्राप्त करें और लॉगकैट के आउटपुट को फ़िल्टर करने के लिए grep (लिनक्स/मैकओएस) या findstr (विंडोज) का उपयोग करें:
adblogcat|grep4526adblogcat|findstr4526
adb logcat [विकल्प] [फ़िल्टर-स्पेसिफिकेशन]
adblogcat
टिप्पणी: मॉनिटरिंग रोकने के लिए Ctrl-C दबाएं
adblogcat*:V# lowest priority, filter to only show Verbose leveladblogcat*:D# filter to only show Debug leveladblogcat*:I# filter to only show Info leveladblogcat*:W# filter to only show Warning leveladblogcat*:E# filter to only show Error leveladblogcat*:F# filter to only show Fatal leveladblogcat*:S# Silent, highest priority, on which nothing is ever printed
adb logcat -b <Buffer>
adblogcat-b# radio View the buffer that contains radio/telephony related messages.adblogcat-b# event View the buffer containing events-related messages.adblogcat-b# main defaultadblogcat-c# Clears the entire log and exits.adblogcat-d# Dumps the log to the screen and exits.adblogcat-ftest.logs# Writes log message output to test.logs .adblogcat-g# Prints the size of the specified log buffer and exits.adblogcat-n<count># Sets the maximum number of rotated logs to <count>.
Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with a device. Here are some useful ADB commands for Android app pentesting:
Check connected devices:
adbdevices
Install an APK:
adbinstallapp.apk
Uninstall an app:
adbuninstallpackage_name
Grant permissions:
adbshellpmgrantpackage_namepermission
Revoke permissions:
adbshellpmrevokepackage_namepermission
Start an activity:
adbshellamstart-npackage_name/activity_name
Pull a file from the device:
adbpull/path/to/file
Push a file to the device:
adbpushfile/path/on/device
Capture a bug report:
adbbugreportbugreport.zip
Access the device shell:
adbshell
Make sure to have a mobile device with Developer Options enabled running Android 5.0 or higher.
Notes: बैटरी इतिहासकार उस डेटा को एक HTML दृश्यीकरण में रूपांतरित करता है। चरण 1adb shell dumpsys batterystats > batterystats.txtचरण 2python historian.py batterystats.txt > batterystats.html
adb shell dumpsys activity# बैकअपएडीबी से एंड्रॉइड डिवाइस का बैकअप।
adbbackup [-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 applicationsadbshellpmlistpackages-f-3#List packagesadbbackup-fmyapp_backup.ab-apkcom.myapp# backup on one deviceadbrestoremyapp_backup.ab# restore to the same or any other device