十分钟学会Charles抓包(iOS的http/https请求)
2017-03-09 13:18
393 查看
转载自 十分钟学会Charles抓包(iOS的http/https请求) 作者 Roy_Liang
Charles安装
HTTP抓包
HTTPS抓包
![](http://upload-images.jianshu.io/upload_images/2469183-c422573ff7075723.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
官网下载安装Charles:
https://www.charlesproxy.com/download/
(1)查看电脑IP地址
![](http://upload-images.jianshu.io/upload_images/2469183-ff851ce2abe6cfe8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(2)设置手机HTTP代理
手机连上电脑,点击“设置->无线局域网->连接的WiFi”,设置HTTP代理:
服务器为电脑IP地址:如192.168.1.169
端口:8888
![](http://upload-images.jianshu.io/upload_images/2469183-ad19fa10a1815cbc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(3)电脑上打开Charles进行HTTP抓包
手机上打开某个App或者浏览器什么的
![](http://upload-images.jianshu.io/upload_images/2469183-8630cf0087d20187.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击“Allow”允许,出现手机的HTTP请求列表
![](http://upload-images.jianshu.io/upload_images/2469183-874a256420dcae1f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
HTTP抓包
HTTPS的抓包需要在HTTP抓包基础上再进行设置
设置前抓包HTTPS是这样的
![](http://upload-images.jianshu.io/upload_images/2469183-81c9d7cd686f86eb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置后抓包HTTPS长这样
![](http://upload-images.jianshu.io/upload_images/2469183-3b9210f6ea4c6403.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](http://upload-images.jianshu.io/upload_images/2469183-c83e45626a1cb35e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以下为在HTTP抓包基础上进行HTTP抓包的进一步设置步骤
(1)安装SSL证书到手机设备
点击 Help -> SSL Proxying -> Install Charles Root Certificate on a Mobile Device
![](http://upload-images.jianshu.io/upload_images/2469183-8f47a1b1c1540ef7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
出现弹窗得到地址 chls.pro/ssl
![](http://upload-images.jianshu.io/upload_images/2469183-c7f6ad4a204b0bd4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
手机安装SSL证书的地址
在手机Safari浏览器输入地址 chls.pro/ssl,出现证书安装页面,点击安装
手机设置有密码的输入密码进行安装
(注意:有兄弟姐妹说Safari浏览器输入这个网址chls.pro/ssl安装不了证书的情况,亲测要(1)设置好手机HTTP代理(2)电脑上Charles要开着)
![](http://upload-images.jianshu.io/upload_images/2469183-7ed4a5c8c2a36217.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装证书
(2)Charles设置Proxy
Proxy -> SSL Proxying Settings...
![](http://upload-images.jianshu.io/upload_images/2469183-2c460b4652797ccf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
勾选Enable SSL Proxying,点击Add
![](http://upload-images.jianshu.io/upload_images/2469183-11eb2be75eae13fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Host设置要抓取的https接口,比如想抓这个
![](http://upload-images.jianshu.io/upload_images/2469183-b39831342a11daca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Host填写:https://api.weibo.cn
Port填写:443
![](http://upload-images.jianshu.io/upload_images/2469183-ca37de9cdb920511.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(3)进行HTTPS抓包
让手机重新发送https请求,可看到抓包
![](http://upload-images.jianshu.io/upload_images/2469183-5f1b21912781d466.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
HTTPS抓包
注意:不抓包请关闭手机HTTP代理,否则断开与电脑连接后会连不上网
----end
Charles安装
HTTP抓包
HTTPS抓包
![](http://upload-images.jianshu.io/upload_images/2469183-c422573ff7075723.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1. Charles安装
官网下载安装Charles:https://www.charlesproxy.com/download/
2. HTTP抓包
(1)查看电脑IP地址
![](http://upload-images.jianshu.io/upload_images/2469183-ff851ce2abe6cfe8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(2)设置手机HTTP代理
手机连上电脑,点击“设置->无线局域网->连接的WiFi”,设置HTTP代理:
服务器为电脑IP地址:如192.168.1.169
端口:8888
![](http://upload-images.jianshu.io/upload_images/2469183-ad19fa10a1815cbc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(3)电脑上打开Charles进行HTTP抓包
手机上打开某个App或者浏览器什么的
![](http://upload-images.jianshu.io/upload_images/2469183-8630cf0087d20187.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击“Allow”允许,出现手机的HTTP请求列表
![](http://upload-images.jianshu.io/upload_images/2469183-874a256420dcae1f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
HTTP抓包
3. HTTPS抓包
HTTPS的抓包需要在HTTP抓包基础上再进行设置设置前抓包HTTPS是这样的
![](http://upload-images.jianshu.io/upload_images/2469183-81c9d7cd686f86eb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置后抓包HTTPS长这样
![](http://upload-images.jianshu.io/upload_images/2469183-3b9210f6ea4c6403.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](http://upload-images.jianshu.io/upload_images/2469183-c83e45626a1cb35e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
以下为在HTTP抓包基础上进行HTTP抓包的进一步设置步骤
(1)安装SSL证书到手机设备
点击 Help -> SSL Proxying -> Install Charles Root Certificate on a Mobile Device
![](http://upload-images.jianshu.io/upload_images/2469183-8f47a1b1c1540ef7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
出现弹窗得到地址 chls.pro/ssl
![](http://upload-images.jianshu.io/upload_images/2469183-c7f6ad4a204b0bd4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
手机安装SSL证书的地址
在手机Safari浏览器输入地址 chls.pro/ssl,出现证书安装页面,点击安装
手机设置有密码的输入密码进行安装
(注意:有兄弟姐妹说Safari浏览器输入这个网址chls.pro/ssl安装不了证书的情况,亲测要(1)设置好手机HTTP代理(2)电脑上Charles要开着)
![](http://upload-images.jianshu.io/upload_images/2469183-7ed4a5c8c2a36217.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
安装证书
(2)Charles设置Proxy
Proxy -> SSL Proxying Settings...
![](http://upload-images.jianshu.io/upload_images/2469183-2c460b4652797ccf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
勾选Enable SSL Proxying,点击Add
![](http://upload-images.jianshu.io/upload_images/2469183-11eb2be75eae13fb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Host设置要抓取的https接口,比如想抓这个
![](http://upload-images.jianshu.io/upload_images/2469183-b39831342a11daca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Host填写:https://api.weibo.cn
Port填写:443
![](http://upload-images.jianshu.io/upload_images/2469183-ca37de9cdb920511.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(3)进行HTTPS抓包
让手机重新发送https请求,可看到抓包
![](http://upload-images.jianshu.io/upload_images/2469183-5f1b21912781d466.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
HTTPS抓包
注意:不抓包请关闭手机HTTP代理,否则断开与电脑连接后会连不上网
----end
相关文章推荐
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- 十分钟学会Charles抓包(iOS的http/https请求)
- Charles抓包(iOS的http/https请求)
- Charles抓包(iOS的http/https请求)
- Charles抓包(iOS的http/https请求)
- 学会Charles抓包(http/https请求)
- Mac 环境 下使用Charles 抓包Http/Https请求
- iOS开发工具-如何使用网络封包分析工具Charles,通过配置proxy对http、https、tcp、udp 等协议的请求响应过程交互信息进行分析、判断、解决我们移动开发中的遇到的各种实际问题。
- Charles抓包(http/https请求)
- iOS中http转https,及https请求抓包
- Charles抓包(http/https请求)