Fiddler抓包工具其中一个组件功能:Composer(随意构建请求),四个选项卡分别表示:
1.Parsed:该方式是把一个请求分割成三个部分:
请求方式+ host 然后是Headers ,然后就是请求体,如果是Get请求是没有请求体的。
2.Raw:这个请求方式是要自己来写请求所需要的所有原始数据,然后点击Execute。
3.Scratchpad:跟Raw一样,只是raw是一条,这个是可以多条来进行访问。具体自己测试,可以直接拖拽前边的请求回话。
但是要注意一点:执行的时候必须要选中你所要执行的所有请求,否则会提示“in the box below , please highlight the complete HTTP request to be sent before pressing Execute”
4.Options:
【Inspect Session 】
勾选,点击execute后,直接跳转到inspector页面
不勾选,点击execute后,仍保留在当前页面
【Fix Content-Length header 】
adjusts the value of the Content-Length request header (if present) to match the size of the request body.
【Follow Redirects 】
causes a HTTP/3xx redirect to trigger a new request, if possible. The Composer will follow up to fiddler.composer.followredirects.max default redirections.
【Automatically Authenticate 】
causes Fiddler to automatically respond to HTTP/401 and HTTP/407 challenges that use NTLM or Negotiate protocols using the current user’s Windows credentials.
【Tear off 】
点击后,composer面板单独窗口显示
(Fiddler里边所有的回话都是可以拖动的,拖动到你需要放置的界面中)
实例: 模拟京东商城的登录
启动Fiddler, 启动browse, 打开京东,然后输入用户名和密码,登录。Fiddler 将捕获到这个登录的Request.
1. 首先找出哪个Request 是用来登录的, 然后把它拖拽到Composer中。
[用来登录的request是这个: https://passport.360buy.com/uc/loginService?uuid=6bc79fbf-e882-49bb-b63a-6fd6ee448944]
2. 在Composer可以看到, 登录是使用POST方法, 把用户名和密码发送给服务器。 那么我们可以修改Composer中的request内容, 比如用户名为:fiddlertest@fiddler.com,密码为test1234。
3. Request造好了后, 我们按"Execute" 按钮就可以发送Request了(如果按住Shift键的同时,按"Execute". Fiddler会自动给这个Request下断点)。
4. 发送的Request,将出现在左边的Web Session列表中。