vcrypt: pyaes invece di pycrypto

This commit is contained in:
mac12m99
2019-09-26 20:59:26 +02:00
parent 1048ca4d31
commit 7f9608e465
+11 -5
View File
@@ -469,16 +469,19 @@ class UnshortenIt(object):
def _unshorten_vcrypt(self, uri): def _unshorten_vcrypt(self, uri):
r = None r = None
import base64 import base64, pyaes
from Crypto.Cipher import AES
def decrypt(str): def decrypt(str):
str = str.replace("_ppl_", "+").replace("_eqq_", "=").replace("_sll_", "/") str = str.replace("_ppl_", "+").replace("_eqq_", "=").replace("_sll_", "/")
iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" iv = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
key = "naphajU2usWUswec" key = "naphajU2usWUswec"
crypt_object = AES.new(key=key, mode=AES.MODE_CBC, IV=iv)
decoded = base64.b64decode(str) decoded = base64.b64decode(str)
return crypt_object.decrypt(decoded).replace('\0', '') decoded = decoded + '\0' * (len(decoded) % 16)
crypt_object = pyaes.AESModeOfOperationCBC(key, iv)
decrypted = ''
for p in range(0, len(decoded), 16):
decrypted += crypt_object.decrypt(decoded[p:p + 16]).replace('\0', '')
return decrypted
if '/shield' in uri: if '/shield' in uri:
uri = decrypt(uri.split('/')[-1]) uri = decrypt(uri.split('/')[-1])
else: else:
@@ -496,6 +499,9 @@ class UnshortenIt(object):
uri = r.headers['location'] uri = r.headers['location']
if "4snip" in uri: if "4snip" in uri:
if 'out_generator' in uri:
uri = re.findall('url=(.*)$', uri)[0]
else:
uri = decrypt(uri) uri = decrypt(uri)
return uri, r.code if r else 200 return uri, r.code if r else 200