Search code examples
androidsniffing

Debugging web application in android


I am doing a small project for learning purposes in android.

I am using genymotion as an android emulator and installing my apk inside. However, the question is, i am using Fiddler4 as a proxy but it is only able to capture HTTP/HTTPS traffic. However, the application my port is using has its own defined packet structure and it does not run on port 80/443.

Are there any other tools that allows me to capture all the packets that goes through my emulator. Wireshark does not work.


Solution

  • For Http/Https:

    Genymotion is a good emulator and it has wifi settings , so you can set the proxy to your PC (It may need more steps to find the PC's ip for emulator). And then follow the guide to use fiddler capture the request : Set Remote Machine Proxy Settings

    For TCP/UDP or others(Including http/https):

    Tcpdump is easy used, but you should root your emulator first.

    1. adb shell
    2. su
    3. chmod 777 /data/local/
    4. adb push E:\tcpdump /data/local/
    5. chmod 777 /data/local/tcpdump
    6. /data/local/tcpdump -p -vv -s 0 -w /sdcard/ThinkDrive.pcap

    Now the capture is running and you can use Ctrl+C to stop it . The result data will be saved in /sdcard/ThinkDrive.pcap. You can copy it out and use Wireshark to read the data.

    For webview in Android 4.4 or above :

    You can follow this guide:Remote Debugging on Android with Chrome. It is much much much easier to debug html page in webview .