forked from Kourva/V2rayDoprax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getScript.py
66 lines (45 loc) · 1.25 KB
/
getScript.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
# This Script gets CloudFlare worker script from your Doprax url
# Imports
import time, sys, re
# Script
script = """
addEventListener(
"fetch", event => {
let url = new URL(event.request.url);
url.hostname = "target";
url.protocol = "https";
let request = new Request(url, event.request);
event.respondWith(
fetch(request)
)
}
)
"""
# Worker script
def worker_script(doprax):
if "https://" in doprax:
doprax = doprax.split("/")[2]
temp = re.sub("target", doprax, script)
return temp
# Run the program
if __name__ == "__main__":
if len(sys.argv) != 1:
if sys.argv[1] in ["-h", "--help"]:
print(
"""
Help: python getScript.py [arguments]
create Script -> python getScript.py [Doprax url without 'https://' and '/' at the end]
example:
python getScript.py test.eu-gacagfhs.dopraxrocks.net
"""
)
elif sys.argv[1]:
for char in worker_script(sys.argv[1]):
print(char, end="", flush=True)
time.sleep(0.01)
else:
print("Invalid argument! run with -h")
else:
print("No argument! run with -h")
# EOF