Created
June 9, 2018 22:01
-
-
Save AmirSbss/caa40ffdbf3fb1d2fc6aa9524ffe803b to your computer and use it in GitHub Desktop.
Hotgram free Socks5 proxies, 10 different servers, Python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
import base64 | |
from Crypto.Cipher import AES as _AES | |
import random | |
class AES(object): | |
def __init__(self, key="KCH@LQj#>6VCqqLg", iv="YC'2bmK=b%#NQ?9j"): | |
self.bs = 16 | |
self.cipher = _AES.new(key, _AES.MODE_CBC, iv) | |
def encrypt(self, raw): | |
raw = self._pad(raw) | |
encrypted = self.cipher.encrypt(raw) | |
encoded = base64.b64encode(encrypted) | |
return str(encoded, 'utf-8') | |
def decrypt(self, raw): | |
decoded = base64.b64decode(raw) | |
decrypted = self.cipher.decrypt(decoded) | |
return str(self._unpad(decrypted), 'utf-8') | |
def _pad(self, s): | |
return s + (self.bs - len(s) % self.bs) * chr(self.bs - len(s) % self.bs) | |
def _unpad(self, s): | |
return s[:-ord(s[len(s)-1:])] | |
def get_proxy(server=None) : | |
servers = ["lh1.talagram.ir", "lh81.talagram.ir", "lh80.talagram.ir", "lh9.talagram.ir", "lh23.talagram.ir", "lh82.talagram.ir", "lh12.talagram.ir", "lh33.talagram.ir", "lh53.talagram.ir", "lh12.talagram.ir", "lh67.talagram.ir"] | |
if not server: | |
server = random.choice(servers) | |
data = json.loads(urllib.request.urlopen("http://" + server + "/v1/proxy").read())["data"][0] | |
raw = AES().decrypt(data) | |
proxy = json.loads(raw) | |
ip = proxy["ip"].split(".") | |
proxy["ip"] = ".".join([ip[1], ip[0], ip[2], ip[3]]) | |
return "https://t.me/socks?server={ip}&port={prt}&user={usr}&pass={pwd}".format(**proxy) | |
print(get_proxy()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not work !