在使用Fiddler抓包并篡改返回数据时,如果请求中包含时间戳(timestamp),并且时间戳是动态生成的,可能会导致下一次请求的时间戳发生变化,从而导致篡改后的数据失效。
为了解决这个问题,可以使用Fiddler的AutoResponder
Fiddler的AutoResponder功能可以拦截请求并返回自定义的响应数据。以下是具体步骤:
步骤1:
抓取HTTPS请求
打开Fiddler,确保可以抓到HTTPS包
在浏览器或客户端中发起请求,Fiddler会捕获到该请求。
请求:https://域名/serverApi/puture-mail/mail/mailEvent/getQuato?_t=1739507271&mailAccountId=138
步骤2:保存原始响应
在Fiddler中找到捕获的请求,右键点击,选择Save > Response > Response Body,保存原始响应数据。
{"success":true,"code":"200","msg":"Success","traceId":"6d94e96dc6391bc4","data":{"hourlyQuota":1000,"monthlyQuota":1000,"smtp2goMonthlyQuota":24692},"failed":false}
修改保存的响应文件,更改需要调整的参数值。
hourlyQuota 改为:0
{"success":true,"code":"200","msg":"Success","traceId":"6d94e96dc6391bc4","data":{"hourlyQuota":0,"monthlyQuota":1000,"smtp2goMonthlyQuota":24692},"failed":false}
步骤3:配置AutoResponder
在Fiddler中,切换到AutoResponder选项卡。
点击Add Rule,添加一条规则:
regex:https://域名/serverApi/puture-mail/mail/mailEvent/getQuato?_t=\d+&mailAccountId=138
- 如果实际请求中没有后面的参数,则规则为:
regex:https://域名/serverApi/puture-mail/mail/mailEvent/getQuato?_t=\d+ - 如果实际请求中还有其他参数,则用多个&连接:
regex:https://域名/serverApi/puture-mail/mail/mailEvent/getQuato?_t=\d+&mailAccountId=138&参数名=参数值
在Rule Editor中输入请求的URL模式,这里使用正则表达式匹配动态时间戳。
在Action中选择Find a file,选择你修改后的响应文件。
勾选Enable rules和Unmatched requests passthrough,启用规则。
步骤4:测试
重新发起请求,Fiddler会拦截请求并返回你修改后的响应数据。