From 82593367a4328703e329766c32f0109afca79a29 Mon Sep 17 00:00:00 2001 From: Marco Romano Date: Wed, 4 Oct 2023 16:54:40 +0200 Subject: [PATCH] Add docs for debug mitm proxying. (#1490) --- docs/debug_proxying.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/debug_proxying.md diff --git a/docs/debug_proxying.md b/docs/debug_proxying.md new file mode 100644 index 0000000000..77c109461b --- /dev/null +++ b/docs/debug_proxying.md @@ -0,0 +1,22 @@ +# Setup a debug mitm proxy to inspect all the app's network traffic + +1) Install mitmproxy: `brew install mitmproxy`. + 1) Launch `mitmweb` from a terminal. It will pop up mitmproxy's web interface in a web browser. +1) Configure Android Emulator. + 1) Launch your android emulator. + 1) Open its settings page and go to Settings -> Proxy (nb this tab isn't visible when running the emu inside the Android Studio window, you need to set it so it runs in its own window). + 1) Disable "Use Android Studio HTTP proxy settings" and pick "Manual proxy configuration". + 1) Set `127.0.0.1` as "Host name" and `8080` as "Port number". + 1) Click "Apply" and verify that "Proxy status" is "Success" and close the settings window. + Screenshot 2023-10-04 at 14 48 47 +1) Install the mitmproxy CA cert (this is needed to see traffic from java/kotlin code, it's not needed for traffic coming from native code e.g. the matrix-rust-sdk). + 1) Open the emulator Chrome browser app + 1) Go to the url `mitm.it` + 1) Follow the instructions to install the CA cert on Android devices. + Screenshot 2023-10-04 at 14 51 27 +1) Slightly modify the Element X app source code. + 1) Go to the `RustMatrixClientFactory.create()` method. + 1) Add `.disableSslVerification()` in the `ClientBuilder` method chain. +1) Build and run the Element X app. +1) Enjoy, you will see all the traffic in mitmproxy's web interface. + Screenshot 2023-10-04 at 14 50 03