Debugging iPhone traffic using Charles Proxy Socks feature? - iphone

I'm trying to use Charles Proxy in order to debug some performance issues on my iPhone. I got it all working using the "http proxy mode", but fail to do so with the "socks proxy mode". Since iOS exhibits different behavior under http proxy than in real life (see http://www.charlesproxy.com/documentation/configuration/proxy-settings/), I would really like to make the socks proxy work.
After configuring the socks proxy on my iPhone, I fail to connect to any site, and sniffing on the machine that runs Charles shows that I get a reset whenever I'm trying to connect. What step am I missing?
An explanation on how to make it work on either Mac or Windows would be much appreciated!

Setting up a Socks Proxy for iOS with a PAC file
Fire up the Apache server on your Mac or somewhere on the net (A raw gist would work). Create a simple PAC file.
proxy.pac
function FindProxyForURL(url, host) {
return "SOCKS <Address of Charles-The-Proxy>:<SOCKS port>";
}
Then point your iPhones proxy settings under the network connection to HTTP Proxy-> Auto-> http://<addressOfWebServer>/proxy.pac
Final note
Don't forget to undo your proxy settings when you're done.

According to charles documentation: https://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration/
Auto configuration
You can also supply an auto-configuration URL instead of entering manual configuration. This approach will enable your device to first try to use Charles, but then to fallback to using a direct connection if Charles isn't running. This is an experimental approach!
For the auto-configuration URL enter:
https://chls.pro/X.X.X.X.pac
Where you replace X.X.X.X with the IP address of your computer running Charles. This defaults to port 8888. If you use a different port, just include that, e.g. https://chls.pro/X.X.X.X:XXXX.pac
You can also use Charles in SOCKS proxy mode from iOS using an autoconfiguration rule, in spite of this not being available as a manual setting. Enter the auto-configuration URL as follows:
https://chls.pro/X.X.X.X:XXXX.socks.pac

Related

How can I create a network proxy programming?

Excuse me. I speak poor English.
I am trying to create a network proxy programming with sock5 protocol. But I have no way to learn it, I can't figure out how a proxy programming works especially the followings:
What is the difference and association between socks5 and the Shadowsocks ?
Can I set a the network proxy configure in macOs instead of using swift or oc ?
such as enabling this check button(socks5 proxy) and filling the specific configure using a language instead of swift or oc:
configure
Once I set the option on macOs in the Question 2,what kind of data will the programming get if it listening the network?
e.g. will the macOs automatically forward the all new TCP connections to 127.0.0.1:1086 and automatically make the connections confirm to the socks5 request standard?
If so, why the final processing programming (transmit the datas to the real remote proxy-server) can make a successful connection? Instead of a forever loop(a.programming create a socket to remote proxy-server -> b. macOs automatically forward it to 127.0.0.1:1086 and make the connection confirm to the socks5 request standard -> a.)
Is it called as a proxy-client? or local proxy-server? what is the job of it. Why do I set a proxy address as a local one instead of a direct remote server?
Why when I setting a fake socks5 option in macOs network proxy options, a UDP programming can still work successfully?
If you can UNDERSTAND CHINESE:
Chinese language
The follow answers are based on my own experience and opinion.
1、socks5 is an Internet protocol that exchanges network packets between a client and server through a proxy server. Sockes
while Shadowsocks is a software use this protocol.
2 、Yes,you can. Install a Shaowsocks don't need any
Programming language, actually it like installing a EXE file on Windows or pkg on MacOS, it's just a software.
3、Socks5 is an Internet protocol like a language between two computer.
The software's message run on you computer will be "translated" by Shadowsocks.
Those translated message will be sent to the remote service (also run a Shadowsocks) then the service can send message to those "blocked" Webs' services.
4、The remote service can be called an proxy service.The local don't do anything except be "translated" by Shadowsocks. Look this picture.
5、The QQ don't use the port 1080, Shadowsocks need a fixed port to "translate" message.

Fiddler 4-iOS 10.2.1 cannot reach internet after configure proxy

I am following this instruction http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/ConfigureForiOS. Everything works until section Set the iOS Device Proxy.
Once I set the proxy on my iPhone, I can't connect to the internet from the phone anymore. Not even accessing the echo page, which I could access before turning on the proxy on the phone. I already installed the root cert on my phone, the makecert add-on on Fiddler
Could someone help with ideas to diagnose the issue here? Thanks,
What might be stopping your iphone from reaching your Fiddler machine on the port specified, usually 8888?
Have you a firewall on the Fiddler machine? You might need to open
the port.
Does your LAN have an automatic redirect to a login page? Ours
does, so I have to disable the proxy on the iphone while I login,
then reenable it.
Does your LAN expose the IPs of cable-connected machines to WIFI
users? Not all do.
Can you browse a simple web page on your Fiddler machine from your
iphone, before starting fiddler or doing any proxy configuration?
You might need to get really serious and install a ping utility on the iphone.

How can I monitor HTTP traffic from BlueStacks?

I want monitor HTTP traffic from BlueStacks so that I can debug web analytics tracking - any idea how?
For example, my application calles my server. I want to know what actual API my application actually called during testing.
I do not see any HTTP requests in Fidller even when using the BlueStacks.
I thought fiddler capture all internet request done by any software.
Actually you can use fiddler. You see, fiddler configures the winINET proxy to go through it (the one used by internet explorer and all other microsoft software, but sometimes even third pary software uses winINET proxy config - that is why some programs just magically work with fiddle). Some programs ignore wininet config completly and have their own method of setting a proxy (like firefox, chrome). And other programs, like bluestacks, have no support for proxy at all.
But you can force BlueStacks to go through the fiddler proxy. A tool which can do that, and which has a tutorial on this, is ProxyCap:
http://www.proxycap.com/bluestacks.html
Just use 127.0.0.1 as server and 8888 as port number in configuration of the proxies in proxycap. You must also add HD-Agent and HD-Frontend executables in the rules, as specified in the last part of the step-by-step guide.
Unfortunately, proxycap is a 30 day trial. You can use free proxifiers out there. Find something that supports http.
http://en.wikipedia.org/wiki/Comparison_of_proxifiers
I did manage to make this work with proxyCap myself and haven't tried anything else yet.
I think this is better for http traffic sniffing than wireshark which is for lower level network sniffing
Use ProxyCap to let Fiddler capture the trafic.
ProxyCap forwards all Bluestack communication to HTTP proxy (in this case our proxy is Fiddler).
The full step-by-step guide, how to redirect the Bluestack application traffic through proxy, is HERE.
Use 127.0.0.1:8888 as proxy address. That is the address of Fiddler on the local computer.
Today I tried Fiddler - ProxyCap - BlueStacks. It didn't work at first. After I added "HD-Plus-Service.exe" everything was Okay. It seems like new bluestacks versions don't use HD-Network.exe? Anyway my program list includes:
HD-Service.exe
HD-Agent.exe
HD-Frontend.exe
HD-Network.exe
HD-Plus-Service.exe
HD-LogRotatorService.exe
In 2019, Fiddler has been updated to support Proxy, just set up your BlueStacks to use Fiddler's proxy and you can capture all HTTP/HTTPS traffic going out from it.
In addition, for latest Bluestacks3 version here are the list of apps you need to add to your both program lists:
HD-Agent.exe ( from "C:\Program Files\Bluestacks\" )
HD-Player.exe ( from "C:\Program Files\Bluestacks\" )
Bluestacks.exe ( from where you installed Bluestacks )
Fiddler has a documentation regarding how to capture traffic of Android devices: https://docs.telerik.com/fiddler/configure-fiddler/tasks/ConfigureForAndroid. You can use the same config for bluestack

No internet while running application in android emulator

I get internet access on the browser but when i run the application, the application doesnt get internet. I have used internet permissions.
Actually the problem is because of proxy settings.
Early there was no internet connectivity on the browser, but later I set the proxy in APN and internet started working on the browser. But the application doesnt get internet.
Any solution for this?
** EDITED Apr 13th 2010 **
To get the proxy working with WebView, you apparently need to call WebView.enablePlatformNotifications()
According to the HttpURLConnection docs (Proxies heading):
Proxies
By default, this class will connect
directly to the origin server. It can
also connect via an HTTP or SOCKS
proxy. To use a proxy, use
URL.openConnection(Proxy) when
creating the connection.
You should be able to enable proxy use by setting the system properties described here, however this may not work on Android - the bug report on Proxy support doesn't go into much detail on where the bug is (e.g. property not set vs property not used)
Proxy use can also be controlled using ProxySelectorRoutePlanner, which is used by AbstractHttpClient.setRoutePlanner. Unfortunately, this means re-writing the httpConnection code to use DefaultHttpClient
Hope this helps,
Phil Lello

Using Fiddler with IIS7 Express

I am using IIS7 Express while developing my web application. I need to use fiddler to investigate an issue and cannot figure out how to configure things so I can get the HTTP stream. It seems that IIS7 express will only listen on localhost which means I cannot access the stream.
This has nothing to do with IIS7 Express and everything to do with the fact that you're using loopback traffic.
Ref: https://www.fiddlerbook.com/fiddler/help/hookup.asp#Q-LocalTraffic
Click Rules > Customize Rules.
Update your Rules file like so:
static function OnBeforeRequest(oSession:Fiddler.Session)
{
if (oSession.HostnameIs("MYAPP")) { oSession.host = "localhost:portnumber"; }
}
Then, just visit http://myapp in your browser.
Or use the address http://localhost.fiddler/ and Fiddler will use the hostname localhost instead of converting to an IP address.
One useful variation of Eric's answer (that was edited by Brett) would be to use oSession.port to build the oSession.host. With this little change, if one needs to capture IIS express traffic on http://localhost:12345, they could use http://iisexpress:12345. That will make it easier to capture traffic for sites with random ports as created by WebMatrix and VS. I tried it out with IE and Firefox and capturing IIS Express traffic was a breeze. Fiddler rocks!.
static function OnBeforeRequest(oSession:Fiddler.Session)
{
//...
// workaround the iisexpress limitation
// URL http://iisexpress:port can be used for capturing IIS Express traffic
if (oSession.HostnameIs("iisexpress")) { oSession.host = "localhost:"+oSession.port; }
//...
}
With the latest version of fiddler, you only need to navigate to localhost.fiddler:port. However, doing that alone didn't help me and I was still getting access denied when using Windows Authentication. To fix this, I found this blog entry: http://www.parago.de/2013/01/fiddler-and-the-401-unauthorized-error-with-asp-net-web-api-using-integrated-windows-authentication-wia/
In short, create this key:
Key Path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\Lsa\MSV1_0
Value Name BackConnectionHostNames
Value Type REG_MULTI_SZ
String Value localhost.fiddler
You can use fiddler as a proxy between your clients and the server. This means you start up fiddler, and then access the server using fiddler's port rather then the usual port (default for fiddler2 is 8888 I think). If you need to debug the server "live" vs. real world clients, you can change the IIS binding from :80 to something else, and place fiddler's proxy on port 80.
EDIT: By the way, by default fiddler2 changes the proxy settings on your browsers so that they access everything through fiddler anyway (on the machine in which fiddler is installed only)