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/ShareLinksBiz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/crypter/ShareLinksBiz.py') diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index d2e8138f6..df53b5879 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -235,7 +235,7 @@ class ShareLinksBiz(Crypter): try: (crypted, jk) = self._getCipherParams() package_links.extend(self._getLinks(crypted, jk)) - except: + except Exception: self.fail(_("Unable to decrypt CNL2 links")) return package_links -- 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/ShareLinksBiz.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'module/plugins/crypter/ShareLinksBiz.py') diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index df53b5879..d79735d42 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import base64 import binascii import re @@ -248,14 +247,12 @@ class ShareLinksBiz(Crypter): params = res.split(";;") # Get jk - strlist = list(base64.standard_b64decode(params[1])) - strlist.reverse() - jk = ''.join(strlist) + strlist = list(params[1].decode('base64')) + jk = ''.join(strlist[::-1]) # Get crypted - strlist = list(base64.standard_b64decode(params[2])) - strlist.reverse() - crypted = ''.join(strlist) + strlist = list(params[2].decode('base64')) + crypted = ''.join(strlist[::-1]) # Log and return return crypted, jk @@ -267,14 +264,11 @@ class ShareLinksBiz(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/ShareLinksBiz.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/crypter/ShareLinksBiz.py') diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index d79735d42..00a037b2e 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -272,8 +272,7 @@ class ShareLinksBiz(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("Block has %d links" % len(links)) -- cgit v1.2.3