Skip to content
Skip to content

Android devices ​

Wirescry can capture the HTTP and HTTPS traffic of an Android phone or emulator connected to your computer for debugging. It points the device's proxy setting at Wirescry, through ADB, and puts it back when you stop. Each request shows in Traffic with the device's name. This is part of the free app, from Wirescry 0.1.19.

What you need ​

  • Android 7 (API 24) or later, a phone or an emulator.
  • USB debugging on a phone, allowed for this computer when the phone asks. Emulators have it already.
  • Android platform tools (adb), which come with Android Studio, or as SDK Platform Tools from developer.android.com (on macOS, also Homebrew's android-platform-tools). Wirescry doesn't include adb.

Setup → Android lists the devices ADB sees. Wirescry uses the ADB server Android Studio and the emulator use, on this computer. If none is running, it says No ADB server is running and offers Start the ADB server, which starts one with your adb. It never starts one by itself, except to put back a device it left set up (see If Wirescry quits or crashes). It never restarts or stops a server that's running.

To start a server, Wirescry looks for adb in this order: the adbPathsetting, ANDROID_HOME, ANDROID_SDK_ROOT, Android Studio's SDK folder, Homebrew's folder, then your PATH.

Capture a device ​

  1. Connect the phone, or start the emulator.
  2. In Setup → Android, click Capture next to it.
  3. Use the device. Its requests show in Traffic, each with a badge naming the device.
  4. Click Stop when you're done. The device's proxy goes back to what it was.

Wirescry asks first when the device already has a proxy (it puts that one back when you stop), or is connected over Wi-Fi.

While you capture, other apps on the device may stop working: those that don't trust Wirescry's certificate fail their HTTPS (see Which apps show up). Android may also say its Wi-Fi has limited connectivity, because its connection check doesn't trust Wirescry. Traffic still flows, and the warning goes soon after you stop.

Stop capture before unplugging a phone or closing an emulator: until it's put back, the device has no internet.

How it works ​

When you click Capture, Wirescry:

  • opens a proxy port for this device alone, on this computer;
  • connects a port on the device to it with adb reverse, which reaches this computer through ADB's connection. Only the device itself can use that port, not other devices on its network;
  • sets the device's global HTTP proxy to 127.0.0.1 and that port;
  • keeps a record of what it changed, in its data folder, so it can put the device back even after a crash.

While capturing, Wirescry checks the device every few seconds and makes the connection again if ADB or the device reconnected. If something else changes the device's proxy, Wirescry stops capturing it and leaves the new setting as it is.

Some devices can't be captured, and Wirescry says why: a proxy set by device management, a proxy auto-config (PAC) file, or a proxy with a list of hosts to bypass it. Some phones block the proxy setting over USB: on Xiaomi phones, turn on USB debugging (Security settings) in Developer options; on Samsung phones, turn off Auto Blocker.

Read HTTPS traffic ​

HTTPS stays unreadable until the device trusts Wirescry's certificate. While a device is capturing, Setup → Android shows these steps for it:

  1. Click Send certificate. Wirescry copies the certificate (never its key) to the device's Downloads as Wirescry-CA.crt, and opens Security settings there.

  2. Install it on the device. Wirescry shows the path for the device's version of Android:

    AndroidOn the device
    7 to 10Security & location (or Security) › Advanced › Encryption & credentials › Install from SD card (or Install from storage), then ☰ › Downloads › Wirescry-CA.crt. Give it any name. If the device has no screen lock, it asks you to set one first.
    11Security › Encryption & credentials › Install a certificate › CA certificate › Install anyway, then pick Wirescry-CA.crt (if it isn't listed: ☰ › Downloads).
    12The same as 11, but Encryption & credentials may be under Security › Advanced settings.
    13 to 16Security (or Security & privacy) › More security settings (or More security & privacy) › Encryption & credentials, then as on 11.
    17 and laterMore security & privacy › Encryption & credentials, then as on 11.

    These paths were checked on Android 9, 11, 13 and 17. Other versions, and phone makers, may name things differently: if a step isn't there, search Settings for "CA certificate" or "Install certificates".

  3. To make sure it's Wirescry's, open the device's installed certificates from the link in the steps. Wirescry's is named "Wirescry CA" followed by a code, and the SHA-256 the device shows matches the one in the steps. This is the SHA-256 of the whole certificate, so it differs from the fingerprint under Setup → Certificate.

  4. Click Check in Chrome. It opens Wirescry's page in Chrome on the device, and says so in Wirescry once Chrome there trusts the certificate. If Chrome shows its welcome screens first, finish them and click the button again.

Wirescry remembers which devices trusted the certificate, until a check fails or you reset the certificate. If you remove the certificate from a device, click Check again in the browser to update it.

On a device without Chrome, the check opens the default browser instead. A browser other than Chrome may not use certificates installed in Settings, so there the check may never pass.

Wirescry removes the copied Wirescry-CA.crt from Downloads when you stop, or when it quits, if the file is still the one it copied. The installed certificate stays until you remove it: open the device's installed certificates, choose Wirescry's, and remove it.

Which apps show up ​

HTTP from any app that uses Android's proxy setting shows in Traffic, as do WebSockets. HTTPS shows only from apps that trust certificates you install. Apps that target Android 7 (API 24) or later don't, unless they say so:

AppHTTPS in Wirescry
ChromeYes, once the certificate is installed.
Your own app's debug buildsYes, with the setting below.
Most other apps, including Google's and Android's own servicesNo: they refuse Wirescry's certificate, and those connections fail while you capture.
Apps that ignore Android's proxy settingNothing: their traffic doesn't reach Wirescry.

Your own app ​

To let your app's debug builds trust certificates you install, add res/xml/network_security_config.xml:

xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <debug-overrides>
        <trust-anchors>
            <certificates src="user" />
        </trust-anchors>
    </debug-overrides>
</network-security-config>

and point to it from the <application> element in AndroidManifest.xml:

xml
android:networkSecurityConfig="@xml/network_security_config"

debug-overrides applies only while the app is debuggable, so release builds are unchanged. While a device is capturing, both snippets are in Setup → Android under Your own app, with Copy buttons. An app that checks certificates in its own code may refuse Wirescry's even so.

Refused connections ​

While a device captures, Setup → Android counts the HTTPS connections from it that refused Wirescry's certificate, by the host they were for. It names the apps' hosts, and counts Android's own services on a separate line. Before the certificate is installed, Chrome's connections are among them: the summary then says to install the certificate first. The count starts again with each capture, and when the device is seen to trust the certificate.

Hide Android's background traffic ​

A captured device sends requests of its own, such as Android's connectivity check and Play services' and Chrome's background requests. Hide Android's background traffic in Traffic adds a search that hides them, and opens Traffic. It goes by host name (and one address), so it hides requests to those hosts from this computer too. To show them again, remove those terms from the search.

The device's badge in Traffic shows where each request came from; you can't search by device.

This computer and your local networks ​

By default, a captured device can't use Wirescry to reach this computer or the networks it's on: its own services, your local network and VPNs, and cloud metadata addresses. Such a request gets a 403 from Wirescry, and shows in Traffic as Blocked, saying why. Public addresses aren't blocked, even ones only this computer's network or VPN can reach.

To test against a server on this computer or your network, turn on Let this device reach this computer and its local networks under the device. It's off again after you stop.

Stop, quit and disconnect ​

  • Stop puts back the device's earlier proxy, or none, and removes what Wirescry added. If something else changed the proxy meanwhile, Wirescry leaves it as it is, and says so.
  • Quitting Wirescry, installing an update, or logging off Windows puts back every device Wirescry can reach within a couple of seconds. Any it can't shows Resume and Restore next time.
  • The ADB server stops while capturing: devices have no internet until it runs again, and Wirescry shows a notification. Start Android Studio, run adb start-server, or click Start the ADB server; capture then carries on.
  • A phone unplugged, or an emulator closed, while capturing: it has no internet until you connect it again, or start the emulator again, while Wirescry is running. Capture then carries on. Setup → Android lists it meanwhile, and Wirescry shows a notification.

If Wirescry quits or crashes ​

A device Wirescry couldn't put back shows next time with Resume, which carries on capturing it, and Restore, which puts it back as it was. Wirescry starts the ADB server itself when it launches, if needed, to reach such a device, and keeps Setup → Android on for it even if you turned Android setup off.

If a device left set up isn't connected, for example an emulator you deleted, Forget stops Wirescry offering to put it back. If it turns up again still pointing at Wirescry, Setup → Android offers Clear proxy for it.

Fixing a device by hand ​

If a device has no internet and Wirescry can't reach it, run this with only that device connected:

bash
adb shell settings put global http_proxy :0

If a device's proxy is 127.0.0.1 with nothing behind it that Wirescry knows of, Setup → Android offers Clear proxy, which does the same.

Wi-Fi debugging ​

Wirescry can capture a device connected through wireless debugging, but asks first: wireless debugging turns itself off when the device sleeps or changes network, and Android's Wi-Fi settings don't show this proxy. The device could then be left without internet until you connect it here again, or run the command above. USB is safer. Wirescry never turns wireless debugging on.

Settings ​

Two settings, set by hand in settings.json in Wirescry's data folder. Quit Wirescry first, and start it again after:

SettingWhat it does
"androidSetup": falseTurns Android setup off: no Android section, and Wirescry doesn't contact ADB at all, unless a device it left set up still needs putting back.
"adbPath": "/path/to/adb"The adb to start the ADB server with, if Wirescry doesn't find yours. An absolute path.

Wirescry finds the ADB server the way adb does: ADB_SERVER_SOCKET (only tcp:port or tcp:host:port), or ANDROID_ADB_SERVER_ADDRESS and ANDROID_ADB_SERVER_PORT, otherwise port 5037. It only uses a server on this computer. Wirescry reads these variables, and ANDROID_HOME, from its own environment, not your shell profile, so when it's started from the Finder, the Dock or a desktop launcher it may not have them. Use adbPath if Wirescry doesn't find your adb.

Not supported yet ​

  • Android 6 and older.
  • An ADB server on another computer.
  • Apps that ignore Android's proxy setting, apps that pin certificates, and apps that don't trust certificates you install (see Which apps show up).
  • Putting Wirescry's certificate in Android's system store, which would let apps that refuse it trust it.
  • Devices whose proxy is set by device management, a PAC file, or with a bypass list.

Tested on emulators only. Capture is tested automatically on Android 7, 9 and 15. Installing the certificate was done by hand on 9, 11, 13 and 17, and Chrome's check and a debug app on 17. Not yet tested on a physical phone, where Settings can differ from the steps above.