Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config.py b/config.py
- index 97faeb5..a7a1225 100644
- --- a/config.py
- +++ b/config.py
- @@ -1,4 +1,3 @@
- -USER = "tg"
- -PASSWORD = "tgpass"
- +USERS = {"tg": "tgpass", "tg2": "tgpass2"}
- PORT = 3255
- diff --git a/tgsocksproxy.py b/tgsocksproxy.py
- index c04601e..ccb2e3a 100755
- --- a/tgsocksproxy.py
- +++ b/tgsocksproxy.py
- @@ -6,7 +6,7 @@ import socket
- import urllib.parse
- import urllib.request
- -from config import PORT, USER, PASSWORD
- +from config import PORT, USERS
- BLOCK_NON_TG_HOSTS = True
- @@ -107,7 +107,7 @@ async def login_password_subnegotiation(reader, writer):
- password = await reader.readexactly(password_len)
- - if user != USER.encode() or password != PASSWORD.encode():
- + if user.decode() not in USERS or password.decode() != USERS[user.decode()]:
- writer.write(SUBNEGOTIATION_VERSION + STATUS_FAIL)
- await writer.drain()
- return False
- @@ -237,10 +237,11 @@ def print_tg_info():
- if ip_is_local:
- my_ip = "YOUR_IP"
- - params = {
- - "server": my_ip, "port": PORT, "user": USER, "pass": PASSWORD
- - }
- - print("tg://socks?" + urllib.parse.urlencode(params), flush=True)
- + for user in USERS:
- + params = {
- + "server": my_ip, "port": PORT, "user": user, "pass": USERS[user]
- + }
- + print("tg://socks?" + urllib.parse.urlencode(params), flush=True)
- def main():
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement