user3391196
user3391196

Reputation: 371

How to Do a http eavesdropper or proxy app on android

The use case is that:

How do I achieve this ?

I will tell what I tried:

Now if the addRoute is called with ("0.0.0.0", 0), Iam able to intercept the traffic and see packet contents. But Iam not able to route the packets without creating udp tunnel to an external server which I dont want to do.

If the addRoute is called with the Wifi router IP, then routing automatically happens for all packets generated. But I am not able to intercept the packets on the file descriptor associated with the virtual interface. It simply doesnt receive any data on read() call.

What I want to do is:

Upvotes: 3

Views: 4191

Answers (1)

Sebastiano
Sebastiano

Reputation: 12339

I would suggest 1) setting a proxy and 2) running an app which acts as one. The combination of these two won't require root privileges.

SETTING THE PROXY

This first point is probably the most tricky one. The only way of setting a software-level proxy (without requiring root) is by navigating to the Wi-Fi connection settings and manually set the proxy. However, there is an open-source application that can eventually bypass this particular step: ProxySettings.

INTERCEPTING THE TRAFFIC

In my opinion, your best bet is using SandroProxy, an open-source proxy application for Android. It is extremely well written, currently maintained and supported, and will allow you to intercept the HTTP traffic and even modify it. The code can be found here, while the example application can be found here.


This solution should fulfil all of your requirements:

  1. Intercept the traffic (even edit it): thanks to the proxy setting, all the network traffic goes through the proxy address, which corresponds to your application
  2. Edit is optional: everything will keep working as no proxy is set
  3. Everything is local: no need for external servers, your proxy is the installed application
  4. No root is required

Upvotes: 1

Related Questions