-
Notifications
You must be signed in to change notification settings - Fork 67
/
getVmess.py
115 lines (98 loc) · 3.08 KB
/
getVmess.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This tool will create Vmess proxies with popular servers
# Imports
import requests, base64, time, sys
# Printer
def printer(message: str) -> None:
for char in message:
sys.stdout.write(char)
sys.stdout.flush()
time.sleep(0.01)
print()
# Gets servers
def get_servers() -> zip:
names, addrs = [], []
try:
# Servers from Isegaro (https://twitter.com/iSegaro)
for addrss, name in [
("isegaro.ddns.net", "Isegaro1"),
("ip.isegaro.click", "Isegaro2"),
]:
addrs.append(addrss)
names.append(name)
# Other servers (You need more? run randomVmess.py)
servers_list = [
("Atlanta.v2ray.online", "Altania"),
("Seattle.v2ray.online", "Seattle"),
("Helsinki.v2ray.online", "Helsinki"),
("Phoenix.v2ray.online", "Phoenix"),
("Vienna.v2ray.online", "Vienna"),
("Amsterdam.v2ray.online", "Amesterdam"),
("LosAngeles.v2ray.online", "LosAngeles"),
("Tokyo.v2ray.online", "Tokyo"),
]
for addrss, name in servers_list:
addrs.append(addrss)
names.append(name)
return zip(names, addrs)
except Exception as ex:
raise SystemExit(f"Can't get servers due to '{ex}'!")
# Vmess generator
def vmess_generator() -> list:
# Open config file and extract config
with open(sys.argv[1].strip(), "r") as config:
lines = config.read().split("\n")
worker = lines[1]
doprax = lines[4]
uuid = lines[7]
path = lines[13]
alias = lines[16]
names, addrs, result = [], [], []
# Make vmess urls
worker_host = worker.split("/")[2]
for name, addrs in get_servers():
vmess_config = {
"v": "2",
"ps": alias + "-" + name,
"add": addrs,
"port": "443",
"id": uuid,
"aid": "0",
"net": "ws",
"type": "none",
"host": worker_host,
"path": path,
"tls": "tls",
"alpn": "http/1.1",
"sni": worker_host,
"utls": "chrome",
}
message = str(vmess_config).encode("ascii")
vmess_url = base64.b64encode(message).decode("ascii")
result.append("vmess://" + vmess_url)
# Return result
return result
# Main function
def main():
with open("data/result.txt", "a") as result:
for proxy in vmess_generator():
result.write(proxy + "\n\n")
printer("\033[2;34mResults saved in data/result.txt\033[m\n")
# Main
if __name__ == "__main__":
if len(sys.argv) != 1:
if sys.argv[1] in ["-h", "--help"]:
print(
"""
Help: python getVmess.py [arguments]
create proxy -> python getVmess.py config.conf
help message -> python getVmess.py -h/--help
"""
)
elif sys.argv[1]:
main()
else:
print("Invalid argument! run with -h")
else:
print("No argument! run with -h")