Charles Rewrite重写(详解!一看必懂!)
目录
导语:Charles
之路–Charles rewrite
作者:变优秀的小白
爱好:美式一定加冰!
注:如中途遇到不懂的地方,直接评论留言看到会马上答疑!
什么是Charles?
一款针对于macOs
系统十分好用、功能强大及优秀的GUI
的抓包工具。
windows
用户们推荐使用fiddler
。
附:charles官网地址
什么是Charles Rewrite呢?
官网的原义:The Rewrite tool enables you to create rules that modify requests and responses as they pass through Charles. Rules such as adding or changing a header or search and replace some text in the response body.
我来简单的总结一下,就是一个可用于修改请求(request
)和返回(response
)的modify
工具
话不多说,实战为主
1.打开charles
,点击菜单栏的Tools
选中Rewrite
2.出现如下界面,选择Enable Rewrite
,点击Add
,此时会出现一个Unitled Set
(3处可自定义名称)
3.点击Location
下方的Add
,出现二级界面
- 选择自己需要的
Protocol
(http/https
) - 放入需要访问的接口地址
api
(填写完,Path
和Query
会自动生成) Port
和Query
改为*(也可自定义)Path
不动
点击OK
4.点击下面的Add,填写重写规则
- Type: 重写的类型,可以选择url/body等
- Where: 在哪里修改Request中还是Response中
- Match
- Value:寻找匹配内容中与value一致的值(支持正则匹配)
- Replace
- Value:替代Match的Value里的值
- Replace first:仅替代掉第一个被匹配的值
- Replace all:替代到所有被匹配的值
- Value:替代Match的Value里的值
点击OK,二级界面消失,再点击OK