[英]How to analyze https traffic from Android 6 emulator with Charles Proxy
I want to analyze the https traffic of the app I am developing for Android. 我想分析我正在为Android开发的应用的https流量。
Charles Web Debugging Proxy is the tool I want to use for that. Charles Web Debugging Proxy是我想要使用的工具。 I have the following system configuartion:
我有以下系统配置:
I already read several posts on StackOverflow like eg 我已经在StackOverflow上阅读过几篇文章,例如
But still I didn't reach my goal. 但我还没达到目标。 I walked through all the important steps:
我走过了所有重要的步骤:
~/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -http-proxy <IP_FROM_DEVICE_WITH_CHARLES_PROXY_INSTALLED>:8888 -avd Nexus_5_API_23
~/Library/Android/sdk/tools/emulator -netdelay none -netspeed full -http-proxy <IP_FROM_DEVICE_WITH_CHARLES_PROXY_INSTALLED>:8888 -avd Nexus_5_API_23
I can read all the http traffic in Charles Proxy without any problems. 我可以毫无问题地阅读Charles Proxy中的所有http流量。 I also can read the https traffic but Charles only lists IP addresses.
我也可以阅读https流量但 Charles只列出IP地址。 There are entries like
有条目喜欢
https://173.194.65.188:5228
So the ip addresses are not resolved. 所以ip地址没有解决。 How to get real https URLs?
如何获得真正的https网址? Do I have to activate DNS for https somewhere?
我是否必须在某处为https激活DNS?
I too found this to be an issue. 我也认为这是一个问题。 My solution when I want to debug network traffic via Charles Proxy, is to switch over to Genymotion emulator.
当我想通过Charles Proxy调试网络流量时,我的解决方案是切换到Genymotion模拟器。 The Genymotion emulator will give you the url(s) vs. ip(s) in Charles.
Genymotion模拟器将为您提供Charles中的url(s)与ip(s)。
In the Genymotion emulator you configure the Wifi proxy hostname to '10.0.3.2' and Proxy port enter '8888' (*assuming port 8888 is the listening port you have configured in Charles Proxy). 在Genymotion仿真器中,您将Wifi代理主机名配置为'10 .0.3.2',代理端口输入'8888'(*假设端口8888是您在Charles Proxy中配置的侦听端口)。
There are instructions that make the Android emulator work with Charles here: 有一些说明可以让Android模拟器在这里与Charles一起使用:
https://stackoverflow.com/a/35577864/2832027 https://stackoverflow.com/a/35577864/2832027
It is quite unreliable. 这是非常不可靠的。 You need to put the emulator in and out of airplane mode if it was working and then stops working.
如果模拟器工作正常,则需要将模拟器放入和退出飞行模式,然后停止工作。
Here are the steps from the above post: 以下是上述帖子的步骤:
Start the emulator from the terminal with /{path to your android sdk directory}/tools/emulator -avd Nexus_5X_API_23 -http-proxy http://192.168.2.38:8888
where the -avd
value is the name of your emulator and the -http-proxy
value is the ip address from Charles: Help > SSL Proxying > Install Charles Root Certificate on a Mobile Device or Remote Browser. 使用
/{path to your android sdk directory}/tools/emulator -avd Nexus_5X_API_23 -http-proxy http://192.168.2.38:8888
从终端启动模拟器,其中-avd
值是模拟器的名称,并且-http-proxy
值是Charles的IP地址:帮助> SSL代理>在移动设备或远程浏览器上安装Charles Root证书。
In Charles, the following should be set: Proxy > Proxies 8888 Enable transparent proxying
should be checked; 在Charles中,应设置以下内容:Proxy> Proxies 8888应检查
Enable transparent proxying
; Proxy > macOS Proxy should be checked 应检查代理> macOS代理
In the emulator, `Settings > More (Wireless > Cellular Networks > Access Points > T-Mobile US (or whichever other network is there) set Proxy to 10.0.2.2 and port to 8888 在模拟器中,`设置>更多(无线>蜂窝网络>接入点> T-Mobile US(或其他任何网络)将代理设置为10.0.2.2并将端口设置为8888
In the emulator, Settings > Developer Options > Use legacy DHCP
client should be on. 在模拟器中,应启用
Settings > Developer Options > Use legacy DHCP
客户端”。
In the emulator, turn Airplane mode on and off 在仿真器中,打开和关闭飞行模式
Also, see this if you have issues getting Charles working on Android 7 (API 24) and above. 另外,如果您在Charles使用Android 7(API 24)及更高版本时遇到问题,请参阅此内容。 https://android.jlelse.eu/android-nougat-charlesing-ssl-network-efa0951e66de
https://android.jlelse.eu/android-nougat-charlesing-ssl-network-efa0951e66de
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.