Charles Rewrite rewrite (detailed! Must understand at first glance!)
table of Contents
Lead: Charles
Road - Charles rewrite
Author: become excellent white
hobbies: American some ice!
Note: If you encounter something you don’t understand halfway, you can directly comment and leave a message, and you will immediately answer questions!
What is Charles?
A macOs
very easy to use, powerful and excellent GUI
packet capture tool for the system.
windows
Users recommend it fiddler
.
Attachment: Charles official website address
What is 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.
Let me briefly summarize, it is a tool that can be used to modify the request ( request
) and return ( response
)modify
Not much to say, actual combat is the main
1. Open charles
, click on the menu bar to Tools
selectRewrite
2. The following interface appears, select Enable Rewrite
, click Add
, and one will appear Unitled Set
(names can be customized in 3 places)
3. Click Location
below Add
, the secondary interface appears
- Choose what you need
Protocol
(http/https
) - Put in the interface address that needs to be accessed
api
(after filling in, thePath
sumQuery
will be automatically generated) Port
AndQuery
changed to * (can also be customized)Path
Do not move
Click OK
4. Click Add below to fill in the rewrite rules
- Type: Type of rewriting, you can choose url/body, etc.
- Where: Where to modify the Request or Response
- Match
- Value: Find the value consistent with value in the matched content (supports regular matching)
- Replace
- Value: Substitute the value in Match's Value
- Replace first: Replace only the first matched value
- Replace all: Replace to all matched values
- Value: Substitute the value in Match's Value
Click OK, the secondary interface disappears, then click OK