httptoolkit / httptoolkit-android

Automatic Android interception & debugging with HTTP Toolkit, for Android
https://httptoolkit.com
GNU Affero General Public License v3.0
476 stars 72 forks source link

Disable always-on VPN #4

Closed Veeresh8 closed 2 years ago

Veeresh8 commented 3 years ago

I'm trying to intercept all HTTP requests for my custom AOSP device. This does no have the Settings APK for tweaking n/w related things.

When I connect to my device and invoke "Android device connected via ADB" from my PC I get the below error. vpn1

Any idea how to resolve this and start intercepting requests?

Logs here logs.txt

pimterry commented 3 years ago

Hi @Veeresh8. That error is shown when HTTP Toolkit asks the system to start the VPN, using Android's standard VPN API, and then the request to do so fails immediately, implying the system itself is rejecting it.

I think the relevant bit of your logs there is this:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.vpndialogs/com.android.vpndialogs.ConfirmDialog}

This is saying that the system's built-in VPN dialog couldn't be opened. This is being opened by Android itself, not by HTTP Toolkit, so something very odd is happening here. It sounds like your custom AOSP build is missing some core parts of Android's settings, which makes it impossible to start a VPN. Does that sound plausible? Any idea why that's missing?

If you want to use HTTP Toolkit on this device, you'll either need to fix the Android system so that the VPN APIs work correctly, or you'll need to manually configure the device to use your HTTP Toolkit instance using the normal system proxy settings.

Does that all make sense?

Veeresh8 commented 3 years ago

Agreed on the point where my system is missing Android settings. Any idea how to manually configure proxy settings? I think here too we need access to Android's Settings App right?

pimterry commented 3 years ago

Ah, yes. It looks like this is possible via ADB (https://android.stackexchange.com/a/186820/289616):

adb shell settings put global http_proxy <address>:<port>

I haven't tested it, but that looks promising. You might also need to set https_proxy too, I'm not sure but I've seen some mention on that in a couple of places.

Pure curiosity, but why don't you want to install the Android Settings app?