How can I connect to a proxy on Android? - android

I have a Samsung Galaxy S, running on Android 2.2
I want to track all HTTP requests (from both browsers AND apps) with Charles (proxy installed on my computer).
I would like it similar to how it is on the iPhone where you go to settings, wifi, and on the right connection you can select the HTTP proxy settings

You can do it with Wireshark: http://www.wireshark.org/download.html
Here are instructions for Mac + Android device:
Launch Terminal and run the following commands:
cd /dev
sudo chmod a+r bpf*
Connect to the internet using an Ethernet cable
Click on the Airport/Wi-Fi icon at the top right of the screen and select Create Network; remember the name you give this network
Go to System Preferences, open the Sharing pane, highlight (but don’t check) Internet Sharing
Select Share connection from: Ethernet, To computers using: check AirPort/Wi-Fi
Click AirPort/Wi-Fi Options, and enter the network name you chose above (it should be displayed automatically, so just click OK)
Check the Internet Sharing box
Click Start
Connect your Android device to the network you just created
Launch Wireshark
From the menu, select Capture -> Interfaces. Click on Options next to en1 (or whichever one shows a Wi-Fi icon)
Click the Capture Filter: button
If you want, choose one of the filters, such as HTTP TCP Port (80) and click OK
Click Start

There is currently no out-of-the box proxy in Android. Several alternatives are discussed in this page. Also google for "Android proxy" to see what other alternatives are out there.

ProxySelector

Some alternatives to have partial support of proxy in Android are listed here: http://issue1273.blogspot.com. There is also an Android Proxy Library that try to abstract the access to proxy settings for every Android version.

A very nice write up on the procedure for setting up Charles with Android can be found here, including installing the certificate so you can also debug / proxy your SSL traffic:
http://jaanus.com/post/17476995356/debugging-http-on-an-android-phone-or-tablet-with

Since Android Studio 3.0 release, android now support setting proxy natively.
See documentation.

Related

Genymotion proxy with user/password

I'm running Android through Genymotion using the following configuration:
For the Host-Only I used 192.168.1.213 and DHCP allocates addresses starting with 192.168.1.214
My computer is behind a Squid proxy that has user and password, and address 192.168.1.2 with port 4444
I start the Android VM and in Genymotion Configuration I can see IP Management to be IP 192.168.1.214. I can also ping this address from my computer with success, so all good until here.
If I go to Menu -> Settings -> Wireless & Networks -> Wi-Fi -> WiredSSID -> Modify Network, I see IP address 10.0.3.15 - why is that?
Also, if I try to configure proxy, all I get is host and port, but no options for user/pass, so when I try to access a page in the browser, it says that proxy authentication doesn't work.
Is there a way to configure Android to work through my proxy? If so, what should I configure?
Thank you
Your IP configuration looks correct.
There is two connection between genymotion and your host.
The first one is only technical, to allow Genymotion to run (host
only).
The other one is the one that will be used when trying to get
internet from Genymotion. (NAT)
In Genymotion Settings, under proxy settings, you will be able to set your username & password for your proxy.
If you want to do more complex authentication schemes, like NTLM or Kerberos, Genymotion won't work. But as a workaround, you could use tools like Cntlm, or NtlmAps, that will provide a local, non authenticated, proxy and take care of upstream proxy authentication for Genymotion.
This settings will only work for the sofware Genymotion.
Inside Android, you will also need to set a proxy in the settings.
Go to: Settings -> Wi-Fi -> Long Click on "WiredSSID" -> Modify network -> Check "show advanced settings".
As mentionned there, the proxy will only works for the Browser, and maybe Gmail also.
You will need to set it also on the settings of each app you trying to use.
Not all of your apps will provide a proxy setting. I think Twitter does, but if your app doesn't provide one, you're screwed!
I found a much simpler solution.
All you have to do is to create a rule in proxifier which will let genymotion to use the host default ip. In this way it will manage to connect to the oracle virtual machine ( which has no problem with working with proxifier; obviously, in proxifier you will setup your proxy with its authentication credentials).

Android : Capturing HTTP Requests with non-rooted android device [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 months ago.
Improve this question
I have an android application which uses a third party jar in it.
Http request is sent from third party jar to server when application is running.
I need to capture HTTP Request that is sent from third party jar. I am wondering if there is an easy way to implement with non-rooted device
To start up :
I tried downloading "proxyDroid" but it need rooted phone
I have also tried downloading "shark for root" with "shark reader" which also need rooted device
I tried many other applications which could capture the complete request but all it need is rooted device
I need something what fiddler/wireshark can do for windows. A network packet analyzer which could be easily integrated with android application that could give request object with all header fields in it.
You could install Charles - an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet - on your PC or MAC.
Config steps:
Let your phone and PC or MAC in a same LAN
Launch Charles which you installed (default proxy port is 8888)
Setup your phone's wifi configuration: set the ip of delegate to your PC or MAC's ip, port of delegate to 8888
Lauch your app in your phone. And monitor http requests on Charles.
There are many ways to do that but one of them is fiddler
Fiddler Configuration
Go to options
In HTTPS tab, enable Capture HTTPS Connects and Decrypt HTTPS traffic
In Connections tab, enable Allow remote computers to connect
Restart fiddler
Android Configuration
Connect to same network
Modify network settings
Add proxy for connection with your PC's IP address ( or hostname ) and default fiddler's port ( 8888 / you can change that in settings )
Now you can see the full log from your device in fiddler
Also, you can find a full instructions here
I just installed Drony. It's not shareware and does not require root on a phone with Android 3.x or above.
https://play.google.com/store/apps/details?id=org.sandrob.drony
It can intercept and log requests.
It's 2020 now, for the latest solution, you can use Burp Suite to sniffing https traffic without rooting your Android device.
Steps:
Install Burp Suite
Enable Proxy
Import the certification in your Android phone
Change you Wifi configuration to listening to proxy
Profit!
I wrote the full tutorial and screenshot on how to do it at here: https://www.yodiw.com/monitor-android-network-traffic-with-burp/
You can use fiddler as webdebugger
http://www.telerik.com/fiddler/web-debugging
Fiddler is a debugging tool from telerik software, which helps you to intercept every request that is initiated from your machine.
you can use burp-suite. do follow below procedure.
Configure the Burp Proxy listener
In Burp, go to the “Proxy” tab and then the “Options” tab.In the “Proxy Listeners" section, click the “Add” button.
In the "Binding" tab, in the “Bind to port:” box, enter a port number that is not currently in use, e.g. “8082”.Then select the “All interfaces” option, and click "OK".
Configure your device to use the proxy
In your Android device, go to the“Settings” menu.
If your device is not already connected to the wireless network you are using, then switch the "Wi-Fi" button on, and tap the “Wi-Fi” button to access the "Wi-Fi" menu.
In the "Wi-Fi networks" table, find your network and tap it to bring up the connection menu.
Tap "Connect".If you have configured a password, enter it and continue.
Once you are connected hold down on the network button to bring up the context menu.Tap “Modify network config”.
Ensure that the “Show advanced options” box is ticked.
Change the “Proxy settings” to “Manual” by tapping the button.
Then enter the IP of the computer running Burp into the “Proxy hostname”.Enter the port number configured in the “Proxy Listeners” section earlier, in this example “8082”.Tap "Save".
Test the configuration
In Burp, go to the "Proxy Intercept" tab, and ensure that intercept is “on” (if the button says “Intercept is off" then click it to toggle the interception status).
Open the browser on your Android device and go to an HTTP web page (you can visit an HTTPS web page when you have installed Burp's CA Certificate in your Android device.)
The request should be intercepted in Burp.
Set a https://mitmproxy.org/ as proxy on a same LAN
Open Source
Built in python 3
Installable via pip
Have a Docker image
If you're willing to use Genymotion (or another supported emulated device) you can use HTTP Toolkit, which can analyze and intercept/rewrite HTTP calls. For HTTPS you will need a rooted device, to be able to trust the root CA certificate as a system certificate. Genymotion devices are rooted by default.
To install the app you want to investigate, Genymotion supports Open GApps (for Google Play support) and drag-and-drop for APK files.
HTTP Toolkit also works on real devices, but then root privileges are required (most Android phones are not rooted).
https://httptoolkit.tech/docs/guides/android/#intercepting-traffic-from-your-own-android-app
SandroProxy seems to be better than Drony (by the same developer): You can
(but do not have to) conveniently view and analyze the traffic in your PC's browser.
Should work in emulators as well.

How to catch non-browser traffic on Eclipse Android Emulator through Fiddler

I want to look at trafiic on Android Emulator in Eclipse through Fiddler.
Capturing on all processes is still missing non-browser trafiic. My Emulator Android have proxy setted to my local machine but i see ony Browser traffic.
You may have gone through these same steps, but here is what I did to get it to work. I pieced together info from different sites including Fiddler2.com:
In Fiddler, click Tools / Fiddler Options / Connections and ensure that the box Allow remote computers to connect is checked. (Restart Fiddler if this box wasn't already checked .)
Then Note the IP Address of the Fiddler PC; you can see this by hovering over the icon in Fiddler's toolbar: (it's just the IP of your pc):
Then on the emulator go to Setting->Wireless&Networks->Mobile Networks -> AccessPointNames. I used the existing APN (T-Mobile US) and just changed the Proxy and Port.
Proxy is just the IP from previous step (I did not need to enter http://)
Port is 8888
Restart the emulator and you should see your app traffic in Fiddler.

can't access Internet from 3.2 emulator

I'm developing an android app where I need to connect to some server & download data from the server
using http get
it works perfect on 2.3.3 emulator
but I test on 3.2 it works as if there's no connection ... any help ?
In Android Emulator's setting set the IP of your system
1.Click on Menu 2.Click on Settings 3.Click on Wireless & Networks 4.Go to Mobile Networks 5.Go to Access Point Names 6.Here you will Telkila Internet, click on it. 7.In the Edit access point section, input the IP and 8080 Proxy
Hope this will work
I Found the solution
actually 3.x Android OS doesn't allow to make network operations in the main Thread
so I had to make multithreading using AsynTask

How to start emulator from ADT plugin with proxy host/port/user/password?

I'm realizing that one problem I had with an app in the emulator is because the emulator wasn't working with my proxy. I have to set a proxy host, port, user, and password. I don't see any options for setting this from the ADT. I noticed that if you run the emulator from the command line, there is a "-http-proxy" option, but that's not available from the AVD Manager that is started from Eclipse. I also noticed that when I run the "SDK Manager" outside of Eclipse, there is an additional settings section labeled "Settings" which has proxy settings, but that's only the host and port, not user and password.
Did no one realize that some people would be running this from behind an authenticated proxy?
Try setting them in the mobile networks for the emulator by editing the API. If that doesnt work try something called as proxifier...
Within Eclipse, you can set it by going to Windows -> Preferences -> General -> Network Connections -> Proxy Entries. Select and edit HTTP/HTTPS as needed.
There's probably a "right" way to do this, but if all else fails, you could find an open source non-authenticated proxy, and run a local copy that you've modified to authenticate to the real (remote) proxy that it forwards everything through. Then you'd only have to tell the emulator about a vanilla unauthenticated proxy.
Or if even that won't work, you could hack your machine's network stack to push everything through the proxy and automatically handle the authentication.
But there's probably a better way.
In Eclipse, go to Run->Run Configurations. Select your application and then click on the "Target" tab. In the "Additional Emulator Command Line Options" you can type in the -http-proxy argument and any other arbitrary command line options you need. You might need to restart the emulator and/or your computer for the changes to take effect.
You could also just start the emulator from the command line, with the proxy switch. Eclipse will still deploy your application to it. It really won't make a difference during your development process.
The final thing to try is to set the proxy inside the emulator. If you drill into the APN settings on the device (something like settings->wireless and networks->) there are proxy settings. These will persist on the emulator. You might need to restart the emulator without the proxy switch after setting these.
Hopefully, one of these will work for you. Overall, I've found proxy support in the emulator to be pretty flaky.

Categories

Resources