Skip to content

Commit

Permalink
Update getVmess.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Kourva authored Aug 25, 2023
1 parent 001ca41 commit b41bf6c
Showing 1 changed file with 54 additions and 50 deletions.
104 changes: 54 additions & 50 deletions getVmess.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,69 @@
#!/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():
names = []
addrs = []

# Servers from Isegaro : Thank you so much for your help <3
# Follow him on Twitter: 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)
raise SystemExit("Can't get 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():
def vmess_generator() -> list:

# Open config file and extract config
with open(sys.argv[1].strip(), "r") as config:
lines = config.read()
lines = config.read().split("\n")

worker = lines.split("\n")[1]
doprax = lines.split("\n")[4]
uuid = lines.split("\n")[7]
path = lines.split("\n")[13]
alias = lines.split("\n")[16]
worker = lines[1]
doprax = lines[4]
uuid = lines[7]
path = lines[13]
alias = lines[16]

names, addrs = [], []
result = []
names, addrs, result = [], [], []

# Make vmess urls
worker_host = worker.split("/")[2]
for name, addrs in get_servers():
vmess_config = {
Expand All @@ -76,20 +85,18 @@ def vmess_generator():
message = str(vmess_config).encode("ascii")
vmess_url = base64.b64encode(message).decode("ascii")
result.append("vmess://" + vmess_url)
return result

# 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")
for char in "\033[2;34mResults saved in data/result.txt\033[m\n":
print(char, end="", flush=True)
time.sleep(0.01)
printer("\033[2;34mResults saved in data/result.txt\033[m\n")


# Run the program
# Main
if __name__ == "__main__":
if len(sys.argv) != 1:
if sys.argv[1] in ["-h", "--help"]:
Expand All @@ -106,6 +113,3 @@ def main():
print("Invalid argument! run with -h")
else:
print("No argument! run with -h")


# EOF

0 comments on commit b41bf6c

Please sign in to comment.