diff options
Diffstat (limited to 'module/plugins/container/RSDF.py')
-rw-r--r-- | module/plugins/container/RSDF.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index 42296f2d5..0c43f0e6c 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -1,24 +1,32 @@ # -*- coding: utf-8 -*- +from __future__ import with_statement + import base64 import binascii import re from module.plugins.Container import Container +from module.utils import fs_encode + class RSDF(Container): - __name__ = "RSDF" - __version__ = "0.21" + __name__ = "RSDF" + __version__ = "0.24" + __pattern__ = r'.+\.rsdf' + __description__ = """RSDF container decrypter plugin""" - __author_name__ = ("RaNaN", "spoob") - __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org")] + def decrypt(self, pyfile): from Crypto.Cipher import AES - infile = pyfile.url.replace("\n", "") + infile = fs_encode(pyfile.url.replace("\n", "")) Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') @@ -27,21 +35,22 @@ class RSDF(Container): obj = AES.new(Key, AES.MODE_CFB, IV) - rsdf = open(infile, 'r') - - data = rsdf.read() - rsdf.close() + try: + with open(infile, 'r') as rsdf: + data = rsdf.read() + except IOError, e: + self.fail(str(e)) if re.search(r"<title>404 - Not Found</title>", data) is None: data = binascii.unhexlify(''.join(data.split())) data = data.splitlines() - links = [] for link in data: + if not link: + continue link = base64.b64decode(link) link = obj.decrypt(link) decryptedUrl = link.replace('CCF: ', '') - links.append(decryptedUrl) + self.urls.append(decryptedUrl) - self.log.debug("%s: adding package %s with %d links" % (self.__name__,pyfile.package().name,len(links))) - self.packages.append((pyfile.package().name, links)) + self.logDebug("Adding package %s with %d links" % (pyfile.package().name, len(self.urls))) |