首页
导航
博客
电子书
算法
众创
代码
随贴
关于我们
您好,欢迎来到码863代码分享网! 请
[登录]
/
[注册]
搜 索
标题:
*
140
字
TAG标签:
(用空格隔开)
30
字
恢复历史版本:
请选择分类
html
python
javascript
php
sql
c
c++
c#
java
plain
所有人可见
仅自己可见
编辑器:UEditor
编辑器:TinyMCE
编辑器:Editor.md
HTML转MD
HTML转MD2
<ul style="margin-left: 30px; padding: 0px; word-break: break-all; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; white-space: normal; background-color: rgb(254, 254, 242);" class=" list-paddingleft-2"><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Fiddler是强大的抓包工具,它的原理是以web代理服务器的形式进行工作的,使用的代理地址是:127.0.0.1,端口默认为8888,我们也可以通过设置进行修改。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">代理就是在客户端和服务器之间设置一道关卡,客户端先将请求数据发送出去后,代理服务器会将数据包进行拦截,代理服务器再冒充客户端发送数据到服务器;同理,服务器将响应数据返回,代理服务器也会将数据拦截,再返回给客户端。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Fiddler可以抓取支持http代理的任意程序的数据包,如果要抓取https会话,要先安装证书。</span></p></li></ul><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">HTTP协议</span></strong></p><ul style="margin-left: 30px; padding: 0px; word-break: break-all; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; white-space: normal; background-color: rgb(254, 254, 242);" class=" list-paddingleft-2"><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">要分析Fiddler抓取的数据包,我们首先要熟悉HTTP协议。HTTP即超文本传输协议,是一个基于请求与响应模式的、无状态的、应用层的协议,绝大多数的Web开发,都是构建在HTTP协议之上的Web应用。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">HTTP的工作过程:当我们请求一个超链接时,HTTP就开始工作了,客户端先发送一个请求到服务器,请求内容包括:协议版本号、请求地址、请求方式、请求头和请求参数;服务器收到请求后做相应的处理,并将响应数据返回到客户端,响应内容包括:协议版本号、状态码和响应数据。前端根据响应数据做相应的处理,就是最终我们看到的内容。这些过程是HTTP自动完成的,我们只是输入或点击请求地址,然后查看前端给我们展示的内容。更多关于HTTP协议的介绍请参考:http://www.cnblogs.com/li0803/archive/2008/11/03/1324746.html</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">请求方式常用的有:GET、PUT、POST、DELETE。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">HTTP状态码主要分为5类:以1开头的代表请求已被接受,需要继续处理;以2开头的代表请求已成功被服务器接收、理解、并接受;以3开头的代表需要客户端采取进一步的操作才能完成请求;以4开头的代表了客户端看起来可能发生了错误,妨碍了服务器的处理;以5开头的代表了服务器在处理请求的过程中有错误或者异常状态发生,也有可能是服务器意识到以当前的软硬件资源无法完成对请求的处理。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">常见的主要有:200:服务器成功处理了请求;404:未找到资源;500:内部服务器错误;503:服务器目前无法为请求提供服务;302:请求的URL已临时转移;304:客户端的缓存资源是最新的,要客户端使用缓存。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">每个状态码的详细介绍请参考:https://baike.baidu.com/item/HTTP%E7%8A%B6%E6%80%81%E7%A0%81/5053660?fr=aladdin</span></p></li></ul><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Fiddler的使用</span></strong></p><ul style="margin-left: 30px; padding: 0px; word-break: break-all; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; white-space: normal; background-color: rgb(254, 254, 242);" class=" list-paddingleft-2"><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Fiddler是一个很好用的抓包工具,可以将网络传输发送与接收的数据包进行截获、重发、编辑等操作。也可以用来检测流量。</span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><span style="margin: 0px; padding: 0px; line-height: 1.5;"><span style="margin: 0px; padding: 0px; line-height: 1.5;">Fiddler安装后,设置的端口默认为8888,当Fiddler启动后,默认将IE的代理设为了127.0.0.1:8888,而其他如火狐浏览器需要手动设置代理后才可以抓包。设置内容如图:</span></span></span></p></li><li><p><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><span style="margin: 0px; padding: 0px; line-height: 1.5;"><span style="margin: 0px; padding: 0px; line-height: 1.5;"><img src="/ueditor/php/upload/image/20190110/1547112324751633.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; max-width: 900px; height: auto; display: block;"/></span></span></span> </p></li></ul><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">1)要使用Fiddler进行抓包,首先需要确保Capture Traffic是开启的(安装后是默认开启的),勾选File->Capture Traffic,也可以直接点击Fiddler界面左下角的图标开启和关闭抓包。</span></p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><img src="/ueditor/php/upload/image/20190110/1547112324554884.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">2)所以基本上不需要做什么配置,安装后就可以进行抓包了。那么我们怎么分析抓到的这些数据包呢?如图所示的区域为数据包列表,要分析这些数据包,首先要了解各字段的含义。</span></p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><img src="/ueditor/php/upload/image/20190110/1547112324285573.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">#:顺序号,按照抓包的顺序从1递增</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Result:HTTP状态码</span><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"> </span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Protocol:请求使用的协议,如HTTP/HTTPS/FTP等</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">HOST:请求地址的主机名或域名</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">URL:请求资源的位置</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Body:请求大小</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Caching:请求的缓存过期时间或者缓存控制值</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Content-Type:请求响应的类型</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Process:发送此请求的进程ID</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Comments:备注 </span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Custom:自定义值</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">3)<span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">每个Fiddler抓取到的数据包都会在该列表中展示,点击具体的一条数据包可以<span style="margin: 0px; padding: 0px; line-height: 1.5;">在右侧菜单点击Insepector查看详细内容</span>。主要分为请求(即客户端发出的数据)和响应(服务器返回的数据)两部分。</span></span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><img src="/ueditor/php/upload/image/20190110/1547112325799893.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"> 4)HTTP Request Header:以百度为例,查看请求百度主页这条数据包的请求数据,从上面的Headers中可以看到如下内容:</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><img src="/ueditor/php/upload/image/20190110/1547112325313847.png" alt="" style="margin: 0px auto; padding: 0px; border: 0px; max-width: 900px; height: auto; display: block;"/></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">请求方式</strong>:GET</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">协议</strong>: HTTP/1.1</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">Client 头域:</strong></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Accept: text/html, application/xhtml+xml, image/jxr, */* <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);">---------浏览器端可以接受的媒体类型</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Accept-Encoding: gzip, deflate <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>压缩方法</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Accept-Language: zh-CN <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>语言类型</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393 <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"> <span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>客户端使用的操作系统和浏览器的名称和版本</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">COOKIE头域</strong>:将cookie值发送给服务器</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">Transport 头域:</strong></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Connection:当网页打开完成后,客户端和服务器之间用于传输HTTP数据的TCP连接是否关闭。keep-alive表示不会关闭,客户端再次访问这个服务器上的网页,会继续使用这一条已经建立的连接;close表示关闭,客户端再次访问这个服务器上的网页,需要重新建立连接。</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">HOST:主机名或域名,若没有指定端口,表示使用默认端口80.</span></p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"> 5)HTTP Response Header:继续以百度为例,如图所示:</span></p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><img src="/ueditor/php/upload/image/20190110/1547112325180765.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">协议</strong>:HTTP/1.1</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><strong style="margin: 0px; padding: 0px;">状态码</strong>:200</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Cache头域:</span></strong><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Cache-Control: private <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>此响应消息不能被共享缓存处理,对于其他用户的请求无效</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Date: Sat, 05 Aug 2017 04:37:43 GMT <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>生成消息的具体时间和日期</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Expires: Sat, 05 Aug 2017 04:37:42 GMT <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>浏览器会在指定过期时间内使用本地缓存</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Cookie/Login 头域:</span></strong></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Set-Cookie: BDSVRTM=264; path=/ <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>把cookie发送到客户端</span></span><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Set-Cookie: BD_HOME=1; path=/</span><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Set-Cookie: H_PS_PSSID=1425_21097_22157; path=/; domain=.baidu.com</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Entity头域</span></strong></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Content-Length: 202740 <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>正文长度</span></span><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Content-Type: text/html;charset=utf-8 <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>告知客户端<span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">服务器</span>本身响应的对象的类型和字符集</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Miscellaneous 头域:</span></strong><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Bdpagetype: 2</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Bdqid: 0x99791efd00036253</span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Bduserid: 2577220064</span><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Server: BWS/1.1 <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"> <span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------</span>指明HTTP服务器的软件信息</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">X-Ua-Compatible: IE=Edge,chrome=1</span><br style="margin: 0px; padding: 0px;"/><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Security头域:</span></strong><br style="margin: 0px; padding: 0px;"/><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Strict-Transport-Security: max-age=172800 <span style="margin: 0px; padding: 0px; line-height: 1.5; color: rgb(255, 0, 0);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">---------基于安全考虑而需要发送的参数,</span>关于这个参数的解释,请参考:http://www.freebuf.com/articles/web/66827.html</span></span></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Transport头域:</span></strong></p><p style="margin: 10px auto 10px 60px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">Connection: Keep-Alive</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">6)TextView:显示请求或响应的数据。</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">7)WebForms:请求部分以表单形式显示所有的请求参数和参数值;响应部分与TextView内容是一样的。</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">8)Auth:显示认证信息,如Authorization</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">9)Cookies:显示所有cookies</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">10)Raw:显示Headers和Body数据</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">11)JSON:若请求或响应数据是json格式,以json形式显示请求或响应内容</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">12)XML:<span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">若请求或响应数据是xml格式,</span>以xml形式显示请求或响应内容</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">13)上面是以百度主页为例,百度主页采用的是GET请求,在TextView中没有请求body,我们再<span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: large;">以</span>无忧行网站登录接口为例,它是一个POST请求,除了请求头外,在TextView中多了请求数据。这也是GET请求和POST请求的一个区别。GET请求是将请求参数放在url中,而POST请求一般是将请求参数放在请求body中。</span></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;"><img src="/ueditor/php/upload/image/20190110/1547112325805062.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></span></p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"> </p><p style="margin: 10px auto; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242); text-align: center;"> <img src="/ueditor/php/upload/image/20190110/1547112325740855.png" alt="" style="margin: 0px; padding: 0px; border: 0px; max-width: 900px; height: auto;"/></p><p style="margin: 10px auto 10px 30px; padding: 0px; line-height: 1.5; font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; white-space: normal; background-color: rgb(254, 254, 242);"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: 18px;">总结:通过Fiddler可以抓取请求和响应参数,通过对参数进行分析,可以定位是前端还是后台问题。例如我们在测试登录接口时,输入了正确的手机号和密码,但前端提示“请输入正确的用户名和密码”;仅仅通过界面提示我们只能描述bug表象,但不能分析出问题原因。假设通过抓包我们发现是由于前端参数名错误或参数值为空,从而导致后台报错。这个时候我们将bug指向前端开发人员,并将参数数据和接口文档中对应的报文数据作为附件上传,是不是可以提高bug的解决效率呢?Fiddler在实际的功能测试中有很大的作用,一方面帮助我们更好的了解某个业务中客户端和服务器端是通过哪些接口进行请求的,从而更好的了解代码逻辑;另一方面,我们还可以通过响应数据判断哪里出现了问题,例如可能服务器程序挂了,导致前端报“服务器故障”,这时我们通过抓包发现响应数据返回502,这时我们可以手动去重启服务或是联系运维重启服务,从而提高问题的解决效率。</span></p><p><br/></p>
CopyRight 2002~2023 精通2100网 联系邮箱:qqtxt@163.com
版权所有:精通2100网
湘ICP备2023018646号-1
MYSQl共执行 4 个查询,用时 0.0022468566894531 秒,PHP脚本用时 0.005300 秒,占用内存 0.749 MB,Gzip 已启用