forked from txthinking/bypass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmitm.tengo
30 lines (25 loc) · 875 Bytes
/
mitm.tengo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// How to write script: https://talks.txthinking.com/articles/brook-en.article#mitm
// 如何写脚本: https://talks.txthinking.com/articles/brook.article#mitm
text := import("text")
_ := (func(request, response) {
// Begin
if(!response){
if(text.has_prefix(request["URL"], "http://http3.ooo")){
return {
"StatusCode": 301,
"Location": text.replace(request["URL"], "http://", "https://", 1)
}
}
if(text.has_prefix(request["URL"], "https://http3.ooo")){
request["User-Agent"] = "curl/7.79.1"
return request
}
return request
}
if(text.has_prefix(request["URL"], "https://6.http3.ooo")){
response["Body"] = bytes("You hacked me :)")
return response
}
return response
// End
})(request, response)