androidwindowsadbfiddlerwindows-subsystem-for-android

Capture network traffic using fiddler in Window Subsystem for Android (WSA)


Fiddler is not capturing network traffic of WSA. I want to set proxy in WSA so I can capture network traffic in fiddler, also before setting proxy in WSA, I also need to install Telerik Fiddler Certificate in WSA, how can I do this?


Solution

  • In Windows PowerShell, enter:

    ifconfig
    

    And note the IPV4 Address of the first Ethernet adapter vEthernet: Ethernet adapter vEthernet

    Go to Fiddler in Tools > Options > Connections and note the port on which it listens to (usually 8888)

    To add the proxy to the settings via adb

    First enable the Developer mode in WSA Advanced settings.

    Then you can connect to the WSA using adb (assuming you have adb installed):

    adb connect 127.0.0.1:58526
    

    Finally run those commands to configure the proxy:

    adb shell settings put global http_proxy XXX.XXX.XXX.XXX:8888
    adb shell settings put global global_http_proxy_host XXX.XXX.XXX.XXX
    adb shell settings put global global_http_proxy_port 8888
    adb shell reboot
    

    with XXX.XXX.XXX.XXX being the IPV4 Address you previously noted.

    To remove the proxy, just run those commands:

    adb shell settings delete global http_proxy
    adb shell settings delete global global_http_proxy_host
    adb shell settings delete global global_http_proxy_port
    adb shell reboot
    

    To add the proxy in the Android settings menu

    You can also configure the proxy in the settings menu. You still need adb however, as I didn't find any other way to open WSA android settings other than running:

    adb shell am start -n com.android.settings/.Settings
    

    There you can open Network & internet > Internet > VirtWifi. Modify it, the interface of the popup is a bit buggy on my side; you might have to navigate through the fields with the TAB key.

    Set Proxy to Manual, Proxy hostname to the IPV4 Address, and Proxy port to the Fiddler port.

    Don't forget to hit save after that.

    NB: Since we are in the Android settings, we can also set the CA Certificate of Fiddler to sniff HTTPS packet. For that, you can follow this tutorial