若是要手机抓包的话,须要设置fiddler, 容许远程设备链接 tools/fiddler options/connection/allow remote computers to connectjavascript
开启/中止监控php
F12
start/stop
选择会话html
ctrl + click
多选shift + click
选择连续的会话ctrl + up/down
向上/向下选择ctrl + i
反选会话 //焦点先定位到 session listP
选择当前会话的父会话 //对前端而言,好比选择一个js, 按P
,就会定位到html文件C
选择子会话 //选择html文件,按C
, 定位全部由该html发起的请求, 其实颇有用查找会话前端
ctrl + f
? keyword
, select image
, @targetHostnmae
, =304
会话对比
选择两个会话,点击右键-compare(需安装对比工具winMerge), 这颇有用(两个请求,1个成功返回, 1个报错或被重定向了,这时能够对比两个session)java
删除会话api
delete
删除选中会话shift + delete
删除未选中会话shift + delete
就很方便了(固然也能够先反选再delete)。ctrl + x
删除全部会话cls/clear
删除全部会话会话列表添加列跨域
cols add accept @request.Accept
shift
, 点击 execute按钮 , 会在请求发出前断点,容许再次修改从左侧拖一个session到autoresponder中,默认会自动建立规则 精确匹配(EXACT:the-url),响应为该session的response(*200-SESSION-6) 若是什么都不改,就是replay的效果;能够在rule list中选择该rule, 按enter
编辑响应内容, 很是实用的说浏览器
自动响应的规则定义cookie
hello.com
// 匹配url包含 hello.com 的*
// 匹配全部urlNOT: hello
// 匹配url不包含hello的EXACT: http://localhost/test.php?foo=BAR
//精确匹配 包括大小写regex:(?inxs)http://localhost/\w+\.php
regex:.+
, regex:.+jpg
, regex:.+(gif|png|jpg)$
inxs
i
ignore case 忽略大小写n
requires explicit capture groups 要求明确的捕获组s
enables single-line syntax 单行x
enables comments after the #character 支持#后加注释自动响应的内容session
http://targetUrl
重定向到目标url(原来的请求参数并没有带过去)*redir:http://targetUrl
*bpu
请求前断点*bpafter
响应前断点*delay: Xms
延迟发出请求*header: hi=hello
修改/新增请求头*CORSPreflightAllow
返回容许跨域的header*reset
Reset the client connection*drop
close the client connection*exit
该规则什么都不作,让后续规则处理实例: 将正则规则捕获到的参数,应用到目标url
rule: regex:youdao\.com(.\*) action: http://localhost/test.php$1
聚焦到quickExec box上: ctrl + alt + f
显示fiddler, alt + q
光标定位到quickExec, 此时若是session list中有选中,ctrl + i
可将选中会话的url粘贴到命令行中.
? hello
搜索url包含 hello 的会话> 2000
查询 content-length > 2kb的会话, 同 >2k
< 2000
=301
查询 statusCode=301的会话=get
查询 method=get的会话@localhost
查询hostname=localhost的会话bold hello
若后续的session的url包含hello,则加粗显示 很实用bold
不带参数 则清除以前的设定bpafter api/get/user
在匹配的session响应前断点bpafter
清除以前bpafter的断点bps 302
若session的statusCode=302 则断点 bps
清除断点bpu hello
若请求的url包含hello,则断点; bpu
清除断点bpm post
若method为post, 则请求前断点; 同 bpv post
bpm
清除断点cls or clear
清除session列表g or go
继续执行断点help
打开帮助网页urlreplace findstr replacestr
在url中找到匹配字符串,则替换;彷佛不支持正则start
开始监听http请求stop
中止监听http请求select image
查询content-type,匹配关键字则选中响应session, select html
select javascript
select ui-comments hello
select @Request.Accept html
select @Response.set-cookie domain
allbut html
同 keeponly html
只保留content-type匹配html的会话 实用quit
退出fiddler!dns www.hello.com
发起dns解析请求添加请求头部
function OnBeforeRequest(oSession) { oSession.oRequest['x-hi'] = 'hello'; }
将请求重定向到其余主机
function OnBeforeRequest(oSession) { if(oSession.HostnameIs('test.com')) { // test.com:90/foo/bar -> localhost:90/foo/bar oSession.hostname = 'localhost'; } if(oSession.host == 'foo.com:90') { oSession.host = 'bar.com:9012'; } }
将一个url重定向到另外的url
function OnBeforeRequest(oSession) { if(oSession.url == 'example.com/test.js') { oSession.url = 'localhost.com/mock-test.js'; } }
取消发送cookie
function OnBeforeRequest(oSession) { oSession.oRequest.headers.Remove('Cookie'); }
替换html文件的内容
function OnBeforeResponse(oSession) { if(oSession.HostnameIs('www.test.com') && oSession.oResponse.headers.ExistsAndContains('Content-type', 'text/html')) { oSession.utilDecodeResponse(); oSession.utilReplaceInResponse('<b>', '<u>'); } if(oSession.utilFindInResponse('hello-world', false) > -1) { oSession['ui-color'] = 'red'; } if(oSession.oResponse.headers.ExistsAndContains('Content-Type', 'text/html')) { oSession.utilDecodeResponse(); var oBody = System.Text.Encoding.UTF8.GetString(oSession.responseBodyByte); oBody.replace(/<div>.*?</div>/, ''); oSession.setResponseBody(oBody); } }
网速模拟
function OnBeforeRequest(oSession) { oSession['request-trickle-delay'] = 300; // delay 300ms to request oSession['response-trickle-delay'] = 500; // delay 500ms to response }
手机安装fiddler证书 浏览器访问 http://ipv4.fiddler:8888/, 而后下载证书