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

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.

Related

How to capture app traffic on Android

I'm trying to capture traffic from an app on an Android phone and although I've set the proxy on the phone and can capture all other internet traffic coming from the phone (using Charles Proxy), I can't see any traffic for this one app.
How is this done, and how can I capture the traffic?
UPDATE:
If you need help setting up a wifi hotspot from your computer, so you
can connect your phone to it and Wireshark the traffic, just look at
the following link for directions:
http://www.wi-fiplanet.com/tutorials/article.php/3849841/How-to-Create-Wireless-Hosted-Networks-in-Windows-7.htm
If you want help decompiling an IOS app to assembly, look at this
link: http://www.infointox.net/?tag=arm
If you want a better Dex to Java decompiler than dex2jar, check this
out: https://github.com/skylot/jadx
There're several ways:
Connect your phone to your internal wifi access point (before connecting check advanced options and set a manual proxy).. Note: this method do not work for all network data.. some connections ignore this setting.
(works on rooted phones only) Install 'Shark for Root' application on your device... it will capture ALL traffic.. it will generated dump files that can be analized on your PC using Wireshark software
The best way: Setup your PC as a wifi access point and make your android device to use this wifi connection, then sniff the traffic using the same Wireshark application.
I strongly recommend you use something like "CharlesProxy" (or similar). Be aware of 2 things when u setup the proxy (I hope it is an application you are developing, otherwise be sure of what you do cause it can be ILEGAL):
1 - If you want to attack from your Android/iOS phone to the proxy installed in your local computer, you need the proxy to be configured to use the local IP:PORT (which means CharlesProxy needs to be configured as an address as 192.168.x.x if using a normal wifi network). Then, the Android/iOS phone needs to be setting the proxy to the same IP:PORT
2 - If the app uses https, there are several ways to manage HTTPS connections:
a) If your application accepts ALL Certificates, then it is not a problem for whatever proxy to capture and decrypt the information.
b) If your application accepts only system (and trusted) certificates, you have to export the charlesproxy certificate to your Android phone and to add it into the list of user's trusted certificates.
c) If your application is correctly doing "Certificate pinning", you won't be able to capture the traffic, unless you have the private certificate of your server and you add it in both (your phone) and the proxy configuration.
Hope it helps!

Eclipse / Android - how to monitor device's HTTP traffic

I have my device connected to debug Android apps, but I need to see the HTTP requests and responses (inc. header info).
I've seen a similar question asked on how to do this for an emulator, but how to do this when a real device is connected?
You can use Charles, is a really powerful tool that does exactly what you need.
Charles allows you to sniff the packets sent through HTTP from your actual device, the way you use it is simple:
Download and install Charles, run the program and specify the proxy port
Connect the Android Device to the very same network of the computer running Charles
Go to Wifi-Settings in Android Device and long tap on the network connected, then go to Modify Network-> Show advanced Options
Set Proxy as Manual and in Proxy Host name set your computer IP "192.xxx.x.x" and in the Proxy port add the same port specified in Charles Proxy Settings.
And that's it, all the traffic from your phone will be proxy to charles and it will show you headers, parameters, etc...
Hope it Helps
Regards!

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.

Need to capture every http sent/received from android app on device

Thats it. I want to capture every http request response sent to from an app running on android device. I am offering a bounty for the answer to this question. I don't think all features replay from emulator so I want to do this from the device itself. Now I know there is wireshark on the PC, some apps for wireshark like shark reader gives back a lot of hex. My goal is to simulate offline a whole http request/response scenario from the app. This question has been asked in the past, but no clear answer on how it can be done for android successfully so I am offering a bounty.
Question with bounty is here:
Android How To Simulate HTTP Communication for Offline Demo
This one can be closed.
Here is how I accomplished it from my old HTC Droid Eris:
Install ProxyDroid on your phone https://play.google.com/store/apps/details?id=org.proxydroid&hl=en
Download and install charlesproxy on your computer http://www.charlesproxy.com/
Open Browser on your phone and navigate to http://charlesproxy.com/charles.crt to install charlesproxy certificate
Open charlesproxy and go under Help -> Local IP Address to check your ip address
Open ProxyDroid on your phone enter your IP under host and 8888 under port and start ProxyDroid
Go back to charlesproxy and hit 'Start Recording' Now every request you make from your phone should be visible in charlesproxy
IMPORTANT: ProxyDroid requires a ROOTED device

How can I connect to a proxy on 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.

Categories

Resources