Local Proxy Server Running On Android Device
Asked Answered
A

3

8

I am trying to write a http proxy server that would run on the device itself. In fact, need to find a way to capture the outbound http traffic generated by the device.

The code I have so far is compiling OK, it is based on the code found here: http://www.jtmelton.com/2007/11/27/a-simple-multi-threaded-java-http-proxy-server/

The problem is that the http request to the actual server would block and never return .

Is there a better way to write such a service without rooting the device?

Allanson answered 29/9, 2013 at 19:16 Comment(0)
M
4

You should check SandroProxy. Can caputre traffic on non rooted device if os proxy settings are used, or with iptables rules on rooted one. Traffic is stored it in local sqlite database. Captured data can be also examined by chrome devtools. To capture traffic in your app you should check source code for plugins. It has all the code for iptables redirections and proper settings.

Check out the wiki link on google source code HowToInterceptTrafficOnMyOwn

http://code.google.com/p/sandrop/wiki/HowToInterceptTrafficOnMyOwn

btw: send by sandroproxy support :)

Mariettamariette answered 1/10, 2013 at 6:0 Comment(5)
Hi SandroProxy support! Thank you for you help. I will give it a go and post results here.Allanson
Hi, please can you assist? I am facing a problem with System.loadLibrary("socketdest"); I am using AndroidStudio and don't know how to build the jni librariesAllanson
You can use this one so you can skip building it. code.google.com/p/sandrop/downloads/…Mariettamariette
SandroProxy support you rock!Allanson
To help you more. For SSL you need to trust SandroProxy CA certificate. Sometimes this is not enough because app use certificate pinning (e.g:Twitter)Mariettamariette
L
0

I've been using a piece of software called proxydroid to use my device as a proxy server, and its the only one I've found which doesn't require root. I'm not sure if it will be any help to you, but its an open source project and the code can be found here:

https://github.com/madeye/proxydroid

I have noticed that the application will freeze after a while, or if a large number of request are sent at once, but I've not had chance to find out why this is happening.

Lapwing answered 30/9, 2013 at 10:19 Comment(2)
Hi Kennifer! that is very good and I will experiment.The performance limitation is not a big problem as I am just trying to do a PoC at the moment.Allanson
Hi Kennifer, I found that proxydroid is not doing the job for me as I only want to capture and intercept traffic. With proxy droid I need to have a proxy server to connect to :-(Allanson
P
0

Forget about setting proxy, use Facebook Stetho library (http://facebook.github.io/stetho/) to review all http requests and responses from emulator/device

enter image description here

Pernicious answered 12/4, 2017 at 10:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.