-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrewrite_host.py
More file actions
23 lines (18 loc) · 867 Bytes
/
rewrite_host.py
File metadata and controls
23 lines (18 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
Re-write request Host header.
This can be useful in situations where you are using a transparent "Invisible" proxy
but for one reason or another, it isn't convenient or possible to get the client to
send requests with the Host header corresponding to the actual target.
Similarly, Burp can be configured to forward requests to specific targets, but it
does not rewrite the Host header to the forward destination.
- https://portswigger.net/burp/documentation/desktop/tools/proxy/invisible
- https://portswigger.net/burp/documentation/desktop/settings/tools/proxy#request-handling
"""
REQ_FILTER = """
(header-matches "Host" ".*not-ivision.com.*")
"""
def on_request(req):
from_host = req.header("Host").value()
to_host = "ivision.com"
print(f"Rewriting host header from {from_host} to {to_host}")
return req.withUpdatedHeader("Host", to_host)