From 1eca209b85eb714fb112c9f65916fa383d206578 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 2 Jan 2015 02:50:49 +0100 Subject: [RelinkUs] Improve unlockPasswordProtection --- module/plugins/crypter/RelinkUs.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 5933839ec..5a3eca803 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -56,9 +56,8 @@ class RelinkUs(Crypter): def setup(self): - self.fileid = None + self.fileid = None self.package = None - self.password = None self.captcha = False @@ -102,7 +101,6 @@ class RelinkUs(Crypter): def initPackage(self, pyfile): self.fileid = re.match(self.__pattern__, pyfile.url).group('ID') self.package = pyfile.package() - self.password = self.getPassword() def requestPackage(self): @@ -130,10 +128,14 @@ class RelinkUs(Crypter): def unlockPasswordProtection(self): - self.logDebug("Submitting password [%s] for protected links" % self.password) - passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid - passwd_data = {'id': self.fileid, 'password': self.password, 'pw': 'submit'} - self.html = self.load(passwd_url, post=passwd_data, decode=True) + password = self.getPassword() + + self.logDebug("Submitting password [%s] for protected links" % password) + + if password: + passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid + passwd_data = {'id': self.fileid, 'password': password, 'pw': 'submit'} + self.html = self.load(passwd_url, post=passwd_data, decode=True) def unlockCaptchaProtection(self): -- cgit v1.2.3 From 8d1231901b3ccccdc2d3d2593c0baf4ff7be4220 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 2 Jan 2015 15:46:46 +0100 Subject: Spare code cosmetics --- module/plugins/crypter/RelinkUs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 5a3eca803..c5a3f1011 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -129,9 +129,9 @@ class RelinkUs(Crypter): def unlockPasswordProtection(self): password = self.getPassword() - + self.logDebug("Submitting password [%s] for protected links" % password) - + if password: passwd_url = self.PASSWORD_SUBMIT_URL + "?id=%s" % self.fileid passwd_data = {'id': self.fileid, 'password': password, 'pw': 'submit'} -- cgit v1.2.3 From e1baccf1ec914563d3b2b845906cce024e7cd3b1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 13 Jan 2015 23:14:50 +0100 Subject: Replace 'except' with 'except Exception' --- module/plugins/crypter/RelinkUs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index c5a3f1011..0fd80d593 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -204,7 +204,7 @@ class RelinkUs(Crypter): (vcrypted, vjk) = self._getCipherParams(cnl2_form) for (crypted, jk) in zip(vcrypted, vjk): package_links.extend(self._getLinks(crypted, jk)) - except: + except Exception: self.logDebug("Unable to decrypt CNL2 links") return package_links @@ -223,7 +223,7 @@ class RelinkUs(Crypter): with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) - except: + except Exception: self.fail("Unable to download DLC container") return package_links -- cgit v1.2.3 From cf4ded052964047de88d676045329b8fa4fca2dc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 22 Jan 2015 21:31:19 +0100 Subject: Update plugins after CaptchaService changes --- module/plugins/crypter/RelinkUs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 0fd80d593..a6014c866 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -191,7 +191,7 @@ class RelinkUs(Crypter): elif source == 'web': return self.handleWEBLinks() else: - self.error('Unknown source type "%s" (this is probably a bug)' % source) + self.error(_('Unknown source type "%s"') % source) def handleCNL2Links(self): @@ -223,8 +223,10 @@ class RelinkUs(Crypter): with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) + except Exception: - self.fail("Unable to download DLC container") + self.fail(_("Unable to download DLC container")) + return package_links -- cgit v1.2.3 From cb9e67a5437ddfafd6a93f5a208b9faf3f2d5575 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 29 Jan 2015 15:56:57 +0100 Subject: Some file encoding fixup + optimizations --- module/plugins/crypter/RelinkUs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index a6014c866..2165445b6 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -9,12 +9,13 @@ import os from Crypto.Cipher import AES from module.plugins.Crypter import Crypter +from module.utils import save_join class RelinkUs(Crypter): __name__ = "RelinkUs" __type__ = "crypter" - __version__ = "3.11" + __version__ = "3.12" __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P.+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -219,7 +220,7 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = os.path.join(self.config['general']['download_folder'], dlc_filename) + dlc_filepath = save_join(self.config['general']['download_folder'], dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) -- cgit v1.2.3 From 79725268402043906f619f7c09e848e02ab8a17b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 31 Jan 2015 22:00:59 +0100 Subject: Spare code cosmetics --- module/plugins/crypter/RelinkUs.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 2165445b6..860dff06b 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -2,7 +2,6 @@ from __future__ import with_statement -import base64 import binascii import re import os @@ -279,14 +278,11 @@ class RelinkUs(Crypter): self.logDebug("JsEngine returns value [%s]" % jreturn) key = binascii.unhexlify(jreturn) - # Decode crypted - crypted = base64.standard_b64decode(crypted) - # Decrypt Key = key IV = key obj = AES.new(Key, AES.MODE_CBC, IV) - text = obj.decrypt(crypted) + text = obj.decrypt(crypted.decode('base64')) # Extract links text = text.replace("\x00", "").replace("\r", "") -- cgit v1.2.3 From b25bc61dd47d8d3c42969bd0f72443b21c4b059e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 8 Feb 2015 02:09:45 +0100 Subject: Spare code cosmetics --- module/plugins/crypter/RelinkUs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 860dff06b..c50481af0 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -286,8 +286,7 @@ class RelinkUs(Crypter): # Extract links text = text.replace("\x00", "").replace("\r", "") - links = text.split("\n") - links = filter(lambda x: x != "", links) + links = filter(bool, text.split('\n')) # Log and return self.logDebug("Package has %d links" % len(links)) -- cgit v1.2.3 From 7d90803262ccbb4fc5296a4dc3ce30fe98f55631 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/crypter/RelinkUs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index c50481af0..e3082be00 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -17,8 +17,8 @@ class RelinkUs(Crypter): __version__ = "3.12" __pattern__ = r'http://(?:www\.)?relink\.us/(f/|((view|go)\.php\?id=))(?P.+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Relink.us decrypter plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 02e3ede3edcf4415ac466fbea9d4f25d9ccc8671 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Apr 2015 15:38:01 +0200 Subject: Spare code cosmetics --- module/plugins/crypter/RelinkUs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/crypter/RelinkUs.py') diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index e3082be00..ed3da1f9b 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -153,7 +153,7 @@ class RelinkUs(Crypter): # Try to get info from web m = re.search(self.FILE_TITLE_REGEX, self.html) - if m is not None: + if m: title = m.group(1).strip() if not self.FILE_NOTITLE in title: name = folder = title @@ -198,7 +198,7 @@ class RelinkUs(Crypter): self.logDebug("Search for CNL2 links") package_links = [] m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) - if m is not None: + if m: cnl2_form = m.group(1) try: (vcrypted, vjk) = self._getCipherParams(cnl2_form) @@ -213,7 +213,7 @@ class RelinkUs(Crypter): self.logDebug("Search for DLC links") package_links = [] m = re.search(self.DLC_LINK_REGEX, self.html) - if m is not None: + if m: container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid self.logDebug("Downloading DLC container link [%s]" % container_url) try: -- cgit v1.2.3