From 117b8979c3fc26be2348b6cc02ca6302d1b2abf2 Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Wed, 23 May 2018 17:02:40 -0500 Subject: [PATCH] Add files via upload --- plugin.video.alfa/lib/megaserver/client.py | 2 +- plugin.video.alfa/lib/megaserver/cursor.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/plugin.video.alfa/lib/megaserver/client.py b/plugin.video.alfa/lib/megaserver/client.py index d81cb450..41adc3e2 100644 --- a/plugin.video.alfa/lib/megaserver/client.py +++ b/plugin.video.alfa/lib/megaserver/client.py @@ -169,7 +169,7 @@ class Client(object): #decryptor = aes.AESModeOfOperationCBC(key, iv='\0' * 16) except: import jscrypto - decryptor = jscrypto.new(key, AES.MODE_CBC, '\0' * 16) + decryptor = jscrypto.new(key, jscrypto.MODE_CBC, '\0' * 16) return decryptor.decrypt(data) def aes_cbc_decrypt_a32(self,data, key): diff --git a/plugin.video.alfa/lib/megaserver/cursor.py b/plugin.video.alfa/lib/megaserver/cursor.py index 39180eb5..97e667a3 100755 --- a/plugin.video.alfa/lib/megaserver/cursor.py +++ b/plugin.video.alfa/lib/megaserver/cursor.py @@ -1,6 +1,4 @@ import urllib2 -from Crypto.Cipher import AES -from Crypto.Util import Counter class Cursor(object): def __init__(self, file): @@ -61,8 +59,14 @@ class Cursor(object): def prepare_decoder(self,offset): initial_value = self.initial_value + int(offset/16) - self.decryptor = AES.new(self._file._client.a32_to_str(self.k), AES.MODE_CTR, counter = Counter.new(128, initial_value = initial_value)) - #self.decryptor = aes.AESModeOfOperationCTR(f=self,key=self._client.a32_to_str(self.k),counter=aes.Counter(initial_value=initial_value)) + try: + from Crypto.Cipher import AES + from Crypto.Util import Counter + self.decryptor = AES.new(self._file._client.a32_to_str(self.k), AES.MODE_CTR, counter = Counter.new(128, initial_value = initial_value)) + except: + from pyaes import aes + self.decryptor = aes.AESModeOfOperationCTR(f=self,key=self._client.a32_to_str(self.k),counter=aes.Counter(initial_value=initial_value)) + rest = offset - int(offset/16)*16 if rest: self.decode(str(0)*rest) \ No newline at end of file