如何在 Windows 上使用 Charles Web Proxy 和最新的 Android 模拟器配置 SSL 证书?
我想使用 Charles Web 代理在 Windows 中使用 Android 模拟器。我已经成功设置了 charles 并使用命令行启动了模拟器:
emulator -http-proxy 127.0.0.1:8888 @NexusOne
我可以看到来自 Charles 中的 android 模拟器的流量,但问题是我正在针对使用 SSL 的实时 API 进行开发,但我没有确定如何配置 Charles 让我了解发送和接收的数据。我知道 Charles 中设置了 SSL 的两个区域(代理 -> 代理设置 -> SSL 和代理 -> 客户端 SSL 证书),但我找不到任何像样的文档来让我做我想做的事情想做。有没有人有查尔斯的经验,或者一般的证书,谁可以解释如何实现这一点。也许证书入门也很好,因为我似乎缺乏关于为什么这如此困难的知识。
I would like to use Charles web proxy to work with the Android emulator in Windows. I've successfully set up charles and have started the emulator with the command line:
emulator -http-proxy 127.0.0.1:8888 @NexusOne
I can see traffic coming from the android emulator in Charles, but the problem is that I'm developing against a live API which uses SSL and I'm not sure how to configure Charles to let me play about the the data which is sent and received. I'm aware of two areas where SSL is set up in Charles (Proxy -> Proxy Settings -> SSL and Proxy -> Client SSL Certificates) but I can't find any decent documentation which has let me do what I want to do. Has anyone experience with Charles, or certificates in general, who can explain how to achieve this. Maybe a primer on certificates would be good too, as I seem to be lacking knowledge as to why this is so difficult.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
要使用 charles 远程捕获 http 或 https 流量,您需要执行以下操作:
HOST - 运行 Charles 并托管代理的机器
客户端 – 生成您将捕获的流量的用户机器
主机
客户端计算机:
http://www.charlesproxy.com/documentation/using-charles/ssl-证书/
当我对此进行测试时,我收到了两行 Facebook HTTPS 聊天内容(其中一行是 以下命令启动模拟器,
如果您使用
则也可以通过这种方式捕获 Android 模拟器流量:其中 LOCAL_IP 是您计算机的 IP 地址,而不是 127.0.0.1,因为这是模拟手机的 IP 地址。
资料来源:http://brakertech.com/capture-https-traffic-remotely-与查尔斯/
To remotely capture http or https traffic with charles you will need to do the following:
HOST - Machine running Charles and hosting the proxy
CLIENT – User’s machine generating the traffic you will capture
Host Machine
Client Machine:
http://www.charlesproxy.com/documentation/using-charles/ssl-certificates/
When I tested this out I picked up two lines of a Facebook HTTPS chat (one was a line TO someone, and the other FROM)
you can also capture android emulator traffic this way if you start the emulator with:
Where LOCAL_IP is the IP address of your computer, not 127.0.0.1 as that is the IP address of the emulated phone.
Source: http://brakertech.com/capture-https-traffic-remotely-with-charles/
在 Charles 中,转到“代理”>>“代理设置”并选择“SSL”选项卡。将您的主机添加到位置列表中。
例如,如果您的安全呼叫将前往 https://secure.example.com,您可以输入 secure。 example.com 或 *.example.com。
完成上述操作后,您可能需要在 Charles 主窗口中右键单击该呼叫,然后选择 SSL 代理选项。
希望这有帮助。
In Charles, go to Proxy>>Proxy Settings and select the SSL tab. Add your host to the list of Locations.
For example, if your secure call is going to https://secure.example.com, you can enter secure.example.com, or *.example.com.
Once the above is in place, you may need to right-click on the call in the main Charles window and select the SSL Proxying option.
Hope this helps.
这里有价值的是在 Android 设备中执行此操作的分步说明。 iOS 应该是一样的:
然后您应该能够在 Charles 中看到 SSL 文件。如果您想拦截并更改值,您可以使用“Map Local”工具,这真的很棒:
For what it's worth here are the step by step instructions for doing this in an Android device. Should be the same for iOS:
You should then be able to see the SSL files in Charles. If you want to intercept and change the values you can use the "Map Local" tool which is really awesome:
Charles 提供 HTTPS 代理的方式发生了一些变化。
首先,证书安装选项已移至帮助菜单。
其次,从 iOS 9 开始,您必须在
Info.plist
中提供NSAppTransportSecurity
选项,并且如果您希望 Charles 在中间,您必须添加:作为您的域的一部分,请参阅完整示例:
原因是(我猜)Charles 在充当中间 https 服务器中的人之后,在某些时候以明文 http 进行通信。
最后一步是在 Charles 中为此域激活 SSL 代理(右键单击域并选择启用 SSL 代理)
Things have changed a little in the way Charles provides HTTPS proxying.
First the certificates installation options have been moved to the help menu.
Second, starting in iOS 9 you must provide a
NSAppTransportSecurity
option in yourInfo.plist
and if you want Charles to work properly as a man in the middle, you must add:as part of the your domains see full example:
The reason being (I guess) that Charles at some point communicates in clear http after acting as the man in the middle https server.
Last step is to activate SSL Proxying for this domain in Charles (right click on domain and select Enable SSL Proxying)
您还应该从 Charles 帮助菜单中单击“安装 Charles CA SSL 证书..”。请参阅 http://blog.noodlewerk.com/general/tutorial-using-charles-proxy-to-debug-https-communication- Between-server-and-ios-apps/
You should also click on "Install Charles CA SSL Certificates.." from the Charles Help menu. See more detailed instructions at http://blog.noodlewerk.com/general/tutorial-using-charles-proxy-to-debug-https-communication-between-server-and-ios-apps/
对我有用的 - 应该真正转移到 iPhone:
Charles
Mac
iPhone
瞧,您现在可以查看来自 SSL 代理中添加的域的加密流量
What worked for me - should really be moved to iPhone:
Charles
Mac
iPhone
Voila, you can now view encrypted traffic from the domain added in the SSL proxying
这里提到的认证安装步骤都是正确的https://stackoverflow.com/a/35200795/865220
但是如果你是像我一样,必须为每个新网址单独启用 SSL 代理,然后要为所有主机名启用,只需在 SSL 代理设置中的主机和端口名称列表中输入 * 即可,如下所示:
The certification installation step whatever mentioned here is correct https://stackoverflow.com/a/35200795/865220
But if you are having a pain of individually having to enable SSL Proxy for each and every new url like me, then to enable for all host names just enter * into the host and port names list in the SSL Proxying Settings like this:
这些东西帮助我
SSL 代理”
希望这对那里的人有帮助。
These things helped me
SSL Proxying"
Hope this helps someone out there.