diff options
Diffstat (limited to 'pyload/plugin/container')
-rw-r--r-- | pyload/plugin/container/CCF.py | 6 | ||||
-rw-r--r-- | pyload/plugin/container/DLC.py | 12 | ||||
-rw-r--r-- | pyload/plugin/container/RSDF.py | 25 | ||||
-rw-r--r-- | pyload/plugin/container/TXT.py | 14 |
4 files changed, 33 insertions, 24 deletions
diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py index f39318208..65f96033a 100644 --- a/pyload/plugin/container/CCF.py +++ b/pyload/plugin/container/CCF.py @@ -26,13 +26,13 @@ class CCF(Container): def decrypt(self, pyfile): - file = fs_encode(pyfile.url.strip()) - opener = build_opener(MultipartPostHandler) + fs_filename = fs_encode(pyfile.url.strip()) + opener = build_opener(MultipartPostHandler) dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', {'src' : "ccf", 'filename': "test.ccf", - 'upload' : open(file, "rb")}).read() + 'upload' : open(fs_filename, "rb")}).read() download_folder = self.config['general']['download_folder'] dlc_file = fs_join(download_folder, "tmp_%s.dlc" % pyfile.name) diff --git a/pyload/plugin/container/DLC.py b/pyload/plugin/container/DLC.py index 8b8a0199b..04dabb6b2 100644 --- a/pyload/plugin/container/DLC.py +++ b/pyload/plugin/container/DLC.py @@ -33,8 +33,8 @@ class DLC(Container): def decrypt(self, pyfile): - file = fs_encode(pyfile.url.strip()) - with open(file) as dlc: + fs_filename = fs_encode(pyfile.url.strip()) + with open(fs_filename) as dlc: data = dlc.read().strip() data += '=' * (-len(data) % 4) @@ -49,11 +49,11 @@ class DLC(Container): except AttributeError: self.fail(_("Container is corrupted")) - cipher = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) + key = iv = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) - self.data = AES.new(cipher, AES.MODE_CBC, cipher).decrypt(dlc_data).decode('base64') - self.packages = [(entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name) \ - for entry in self.getPackages()] + self.data = AES.new(key, AES.MODE_CBC, iv).decrypt(dlc_data).decode('base64') + self.packages = [(name or pyfile.name, links, name or pyfile.name) \ + for name, links in self.getPackages()] def getPackages(self): diff --git a/pyload/plugin/container/RSDF.py b/pyload/plugin/container/RSDF.py index c4b743d14..e43eb4c2b 100644 --- a/pyload/plugin/container/RSDF.py +++ b/pyload/plugin/container/RSDF.py @@ -14,7 +14,7 @@ from pyload.utils import fs_encode class RSDF(Container): __name__ = "RSDF" __type__ = "container" - __version__ = "0.27" + __version__ = "0.29" __pattern__ = r'.+\.rsdf$' @@ -31,22 +31,31 @@ class RSDF(Container): def decrypt(self, pyfile): KEY = binascii.unhexlify(self.KEY) - IV = AES.new(Key, AES.MODE_ECB).encrypt(binascii.unhexlify(self.IV)) + IV = binascii.unhexlify(self.IV) - cipher = AES.new(KEY, AES.MODE_CFB, IV) + iv = AES.new(KEY, AES.MODE_ECB).encrypt(IV) + cipher = AES.new(KEY, AES.MODE_CFB, iv) try: - file = fs_encode(pyfile.url.strip()) - with open(file, 'r') as rsdf: + fs_filename = fs_encode(pyfile.url.strip()) + with open(fs_filename, 'r') as rsdf: data = rsdf.read() except IOError, e: self.fail(e) if re.search(r"<title>404 - Not Found</title>", data): - return + pyfile.setStatus("offline") - for link in binascii.unhexlify(''.join(data.split())).splitlines(): - if link: + else: + try: + raw_links = binascii.unhexlify(''.join(data.split())).splitlines() + + except TypeError: + self.fail(_("Container is corrupted")) + + for link in raw_links: + if not link: + continue link = cipher.decrypt(link.decode('base64')).replace('CCF: ', '') self.urls.append(link) diff --git a/pyload/plugin/container/TXT.py b/pyload/plugin/container/TXT.py index 9a3df8bf1..75940f55d 100644 --- a/pyload/plugin/container/TXT.py +++ b/pyload/plugin/container/TXT.py @@ -23,15 +23,15 @@ class TXT(Container): def decrypt(self, pyfile): try: - encoding = codecs.lookup(self.getConfig("encoding")).name + encoding = codecs.lookup(self.getConfig('encoding')).name except Exception: encoding = "utf-8" - file = fs_encode(pyfile.url.strip()) - txt = codecs.open(file, 'r', encoding) - curPack = "Parsed links from %s" % pyfile.name - packages = {curPack:[],} + fs_filename = fs_encode(pyfile.url.strip()) + txt = codecs.open(fs_filename, 'r', encoding) + curPack = "Parsed links from %s" % pyfile.name + packages = {curPack:[],} for link in txt.readlines(): link = link.strip() @@ -57,9 +57,9 @@ class TXT(Container): if not value: packages.pop(key, None) - if self.getConfig("flush"): + if self.getConfig('flush'): try: - txt = open(file, 'wb') + txt = open(fs_filename, 'wb') txt.close() except IOError: |