> For the complete documentation index, see [llms.txt](https://dhaneshsivasamy07.gitbook.io/oscp-2022/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dhaneshsivasamy07.gitbook.io/oscp-2022/mobile-pentesting/android-pentesting.md).

# Android Pentesting

### ADB Commands

```bash
# install adb
sudo apt install adb

# connect to a device
adb connect <ip>:5555

# check the connected devices
adb devices
adb devices -l

# get shell on the android device
adb shell

# get the list of installed applications
adb shell pm list packages | grep <appName>

# get the path of the installed application
adb shell pm path com.app.name

# obtain apk from the installed location
adb pull /data/data/*/*/base.apk <appname.apk>

```

### Wireless ADB

\| REQUIREMENTS: *Android 11*

> Android 11 and higher supports deploying and debugging your app wirelessly from your workstation using Android Debug Bridge (adb)

* Connect the device and check for adb devices
* Once the device is shown in the adb devices output, go to developers options and enable wireless debugging
* In the shell `adb tcpip 5555`
* `adb connect <ip>` of the mobile
* Now the adb can be performed wirelessly

### Tools Required

* apktool
* d2j-dex2jar
* jd-gui
* apkx
* jdax

### Nice Blogs

* <https://medium.com/@sarang6489/root-detection-bypass-by-manual-code-manipulation-5478858f4ad1>
* <https://serializethoughts.com/2016/08/18/bypassing-ssl-pinning-in-android-applications>
* <https://github.com/vaib25vicky/awesome-mobile-security>
* <https://mobexler.com/checklist.htm#android>
* <https://mobile-security.gitbook.io/mobile-security-testing-guide/overview/0x03-overview>
* <https://l33t-en0ugh.gitbook.io/infosec/android-pentesting>
* <https://manifestsecurity.com/appie/>

### Labs

* <https://www.linkedin.com/pulse/10-vulnerable-android-applications-beginners-learn-hacking-anugrah-sr/?trackingId=2B5LsMW8RDaNPvRPfZ1RAw%3D%3D>

### Troubleshooting

* Gennymotion: <https://support.genymotion.com/hc/en-us/articles/4415611962897#:~:text=finish%20the%20update-,c.%20Solution%203,-Open%20VirtualBox>
* Custom DNS - <https://devilbox.readthedocs.io/en/latest/howto/dns/add-custom-dns-server-on-android.html>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dhaneshsivasamy07.gitbook.io/oscp-2022/mobile-pentesting/android-pentesting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
