Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.40 KB | None | 0 0
  1. diff --git a/config.py b/config.py
  2. index 97faeb5..a7a1225 100644
  3. --- a/config.py
  4. +++ b/config.py
  5. @@ -1,4 +1,3 @@
  6. -USER = "tg"
  7. -PASSWORD = "tgpass"
  8. +USERS = {"tg": "tgpass", "tg2": "tgpass2"}
  9.  
  10.  PORT = 3255
  11. diff --git a/tgsocksproxy.py b/tgsocksproxy.py
  12. index c04601e..ccb2e3a 100755
  13. --- a/tgsocksproxy.py
  14. +++ b/tgsocksproxy.py
  15. @@ -6,7 +6,7 @@ import socket
  16.  import urllib.parse
  17.  import urllib.request
  18.  
  19. -from config import PORT, USER, PASSWORD
  20. +from config import PORT, USERS
  21.  
  22.  BLOCK_NON_TG_HOSTS = True
  23.  
  24. @@ -107,7 +107,7 @@ async def login_password_subnegotiation(reader, writer):
  25.  
  26.      password = await reader.readexactly(password_len)
  27.  
  28. -    if user != USER.encode() or password != PASSWORD.encode():
  29. +    if user.decode() not in USERS or password.decode() != USERS[user.decode()]:
  30.          writer.write(SUBNEGOTIATION_VERSION + STATUS_FAIL)
  31.          await writer.drain()
  32.          return False
  33. @@ -237,10 +237,11 @@ def print_tg_info():
  34.      if ip_is_local:
  35.          my_ip = "YOUR_IP"
  36.  
  37. -    params = {
  38. -        "server": my_ip, "port": PORT, "user": USER, "pass": PASSWORD
  39. -    }
  40. -    print("tg://socks?" + urllib.parse.urlencode(params), flush=True)
  41. +    for user in USERS:
  42. +        params = {
  43. +            "server": my_ip, "port": PORT, "user": user, "pass": USERS[user]
  44. +        }
  45. +        print("tg://socks?" + urllib.parse.urlencode(params), flush=True)
  46.  
  47.  
  48.  def main():
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement