1

I want to capture packets from Android apps. I need an packets forwarder on phone that creates a VPN to redirect all TCP packets to PC, then capture them with 'mitmproxy'. I want to use mitmproxy because it supports python addons, and it's free/opensource.

But I can't find a suitable packet forwarder. Here are what I've tried so far:

  • Postern: sometimes it causes DNS error, I can't ping sites when it's enabled, unable to modify DNS server in settings, project abandoned.
  • ProxyDroid: fails to resolve dns somehow
  • TunProxy: http only, not support tcp
  • burp, http_toolkit: non-free, not possible to save packets without paying
  • HttpCanary/Reqable/PacketCapture/PCapDroid: doesn't collaborate with other apps like mitmproxy

Any suggestion?

2
  • I have actually had some success setting up mitmproxy with PCAPdroid, using the SOCKS5 proxy option. There is even a plug-in for PCAPdroid that runs mitmproxy on the Android device. Feb 9 at 17:44
  • @user3840170 Oh thanks, didn't know there is socks5 mode, it does work.
    – aj3423
    Feb 10 at 9:42

2 Answers 2

2

You don't need external tools. Mitmproxy since version 9 has built-in WireGuard support which allows you to use the official Wireguard VPN app on Android side to forward all traffic to Mitmproxy running on your PC.

You just have to start mitmproxy with in Wireguard mode:

mitmweb --mode wireguard

It will then display the connection info in text and as QR for easy set-up of the WireGurd connection profile.

In rare cases where the computer running Mitmproxy doesn't know the correct IP address that should be used for the VPN server you may have to manually correct the WireGuard server IP in the installed VPN profile.

0

Assuming you have ADB access, you can use "reverse tethering" - share the PC's internet connection with the Android device, effectively routing all traffic through.

There are two useful tools in this thread: https://stackoverflow.com/questions/7119793/android-usb-debugging-with-pc-internet-connection

If you prefer not to compile APK's, there are a few available on Google Play, like this one: https://play.google.com/store/apps/details?id=com.curiouscompany.relink&hl=en_US

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.