简体   繁体   English

在Mac OS X上有选择地为iOS模拟器使用Charles Proxy

[英]Using Charles Proxy on Mac OS X selectively for iOS Simulator

Is there any way to use Charles proxy selectively with particular applications like iOS Simulator on Mac OS X? 有没有办法在Mac OS X上有选择地使用Charles代理与iOS模拟器等特定应用程序? Currently while monitoring HTTP traffic to and fro iOS application running with iOS Simulator, Charles also monitors HTTP traffic from other apps like Chrome and Mail app etc. This is really distracting. 目前,在监控与iOS模拟器一起运行的iOS应用程序的HTTP流量时,Charles还会监控来自其他应用程序(如Chrome和Mail应用程序等)的HTTP流量。这实在令人分心。 Is there any way to do this except adding the list of domains that we want to bypass under Charles Proxy settings ? 除了在Charles Proxy设置下添加我们想要绕过的域列表之外,有没有办法做到这一点?

Chrome is really a problem because it uses Mac OS X proxy settings. Chrome确实是一个问题,因为它使用的是Mac OS X代理设置。 I tried extension like Proxy Switchy but it either doesn't help or I don't know how to configure it. 我试过像Proxy Switchy这样的扩展,但它要么没有帮助,要么我不知道如何配置它。

Any pointers will be highly appreciated. 任何指针都将受到高度赞赏。 Thanks! 谢谢!

You can indeed filter the records in Charles proxy. 您确实可以过滤Charles代理中的记录。 Just go to Proxy>Record Settings... Then u can include or exclude any domain that you need to. 只需转到代理>记录设置...然后您可以包含或排除您需要的任何域。 Thats the only way to do it. 这是唯一的方法。 using domain, port, path or query. 使用域,端口,路径或查询。

If you dont wanna record things coming from google Chorme, just disable the option pressing Cmd+Shift+P , this will disable Mac OS X Proxy. 如果您不想记录来自谷歌Chorme的内容,只需禁用按Cmd + Shift + P的选项,这将禁用Mac OS X代理。

在此输入图像描述

Using the Sequence tab, you can set a filter: 使用“序列”选项卡,您可以设置过滤器:

在此输入图像描述

Quick, easy and no proxy menus and settings to worry about. 快速,简单,无需担心代理菜单和设置。

I was trying to do something similar. 我试图做类似的事情。 Consider this as an alternative. 将此视为替代方案。 If you have an iOS device, you can run your app on the device and configure Charles to only show traffic from remote clients by disabling the "Mac OS X proxy" 如果您有iOS设备,则可以在设备上运行应用程序并将Charles配置为仅通过禁用“Mac OS X代理”来显示来自远程客户端的流量

Here is an example setup: Using one remote client (say an iPad in this case) and a Mac running Charles as your proxy host, disable the "Mac OS X proxy" by deselecting the checkbox in Proxy Settings >> Mac OS X Tab >> Enable Mac OS X proxy (See image below.) 以下是一个示例设置:使用一个远程客户端(在本例中为iPad)和运行Charles作为代理主机的Mac,通过取消选中代理设置>> Mac OS X选项卡中的复选框来禁用“Mac OS X代理” >>启用Mac OS X代理(见下图)

By doing so, you essentially filter your simple setup to only display traffic that is coming from remote client (the iPad). 通过这样做,您实际上过滤了您的简单设置,仅显示来自远程客户端(iPad)的流量。

在此输入图像描述

To audit the whole traffic, I actually had to use a real device. 为了审核整个流量,我实际上不得不使用真正的设备。 it's not possible to filter the client app easily with an iOS simulator because the simulator and the host (your mac) shared the same IP. 由于模拟器和主机(您的Mac)共享相同的IP,因此无法使用iOS模拟器轻松过滤客户端应用程序。 But it's pretty nice if you use a device. 但是如果你使用一个设备,这是非常好的。 More info Help > SSL Proxying > Install Charles Root Certificate on a Mobile Device or Remote Browser. 更多信息帮助> SSL代理>在移动设备或远程浏览器上安装Charles Root证书。

  1. Check your IP, make sure the device and your mac are in the same network (your IP can be checked in the "Install Charles Root Certificate..." above-mentioned section of Charle's Help. 检查您的IP,确保设备和您的Mac在同一个网络中(可以在上面提到的Charle帮助的“安装Charles Root证书......”中检查您的IP。
  2. Open chls.pro/ssl on your device and install the certificate on your device. 在您的设备上打开chls.pro/ssl并在您的设备上安装证书。
  3. Make sure your certificate pinning is off (if you use some sort of it). 确保您的证书固定已关闭(如果您使用某种类型)。
  4. Check you Proxy > SSL Proxying Setting as normally (make sure all hosts you want to track are there). 检查代理> SSL代理正常设置(确保您要跟踪的所有主机都在那里)。
  5. Run the app. 运行应用程序。
  6. Accept the upcoming traffic from your device in Charles if asked. 如果被问到,请接受来自Charles设备的即将到来的流量。
  7. Save the session and filter outside from the Charles because there is still no Client Address/Client IP filterable in Charles. 保存会话并从Charles外部过滤,因为Charles中仍然没有可过滤的客户端地址/客户端IP。 😔 Alternatively, it's quite easier to see the traffic from a device listed in the app and distinguish from 127.0.0.1 and "anything else". 😔或者,从应用程序中列出的设备中查看流量并区别于127.0.0.1和“其他任何内容”要容易得多。

BTW. BTW。 To filter my application backend I prefer not to use the basic filter feature (on the bottom) as djibouti33 proposed, but rather Focused Hosts (View > Focused Hosts...). 为了过滤我的应用程序后端,我不想像djibouti33那样使用基本过滤器功能(在底部),而是使用聚焦主机(View> Focused Hosts ...)。 And there is a toggle/check box to hide/show other calls on the sequence list. 并且有一个切换/复选框来隐藏/显示序列列表上的其他调用。 Pretty convenient. 很方便。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM