From 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:25:41 +0200 Subject: Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics --- module/plugins/crypter/NCryptIn.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index eacd4aa8d..cadf2760f 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -32,7 +32,6 @@ class NCryptIn(Crypter): self.protection_type = None def decrypt(self, pyfile): - # Init self.package = pyfile.package() package_links = [] @@ -75,7 +74,7 @@ class NCryptIn(Crypter): def isSingleLink(self): link_type = re.match(self.__pattern__, self.pyfile.url).group('type') - return link_type in ('link', 'frame') + return link_type in ("link", "frame") def requestFolderHome(self): return self.load(self.pyfile.url, decode=True) @@ -163,7 +162,6 @@ class NCryptIn(Crypter): return self.load(self.pyfile.url, post=postData, decode=True) def handleErrors(self): - if self.protection_type == "password": if "This password is invalid!" in self.cleanedHtml: self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") @@ -178,9 +176,8 @@ class NCryptIn(Crypter): self.correctCaptcha() def handleLinkSource(self, link_source_type): - # Check for JS engine - require_js_engine = link_source_type in ('cnl2', 'rsdf', 'ccf', 'dlc') + require_js_engine = link_source_type in ("cnl2", "rsdf", "ccf", "dlc") if require_js_engine and not self.js: self.logDebug("No JS engine available, skip %s links" % link_source_type) return [] @@ -190,9 +187,9 @@ class NCryptIn(Crypter): return self.handleSingleLink() if link_source_type == 'cnl2': return self.handleCNL2() - elif link_source_type in ('rsdf', 'ccf', 'dlc'): + elif link_source_type in ("rsdf", "ccf", "dlc"): return self.handleContainer(link_source_type) - elif link_source_type == 'web': + elif link_source_type == "web": return self.handleWebLinks() else: self.fail('unknown source type "%s" (this is probably a bug)' % link_source_type) @@ -279,7 +276,6 @@ class NCryptIn(Crypter): return vcrypted, vjk def _getLinks(self, crypted, jk): - # Get key jreturn = self.js.eval("%s f()" % jk) self.logDebug("JsEngine returns value [%s]" % jreturn) -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/crypter/NCryptIn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index cadf2760f..ec6533ffc 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -28,7 +28,7 @@ class NCryptIn(Crypter): self.package = None self.html = None self.cleanedHtml = None - self.links_source_order = ['cnl2', 'rsdf', 'ccf', 'dlc', 'web'] + self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"] self.protection_type = None def decrypt(self, pyfile): -- cgit v1.2.3 From 8e47b0de30a25d0fd5dfb518bfe4e1e7beff93fd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:27:44 +0200 Subject: Key attributes cleanup for account, container and crypter plugins --- module/plugins/crypter/NCryptIn.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index ec6533ffc..dc2f29519 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -5,25 +5,28 @@ import binascii import re from Crypto.Cipher import AES + from module.plugins.Crypter import Crypter from module.plugins.internal.CaptchaService import ReCaptcha class NCryptIn(Crypter): __name__ = "NCryptIn" + __version__ = "1.32" __type__ = "crypter" + __pattern__ = r'http://(?:www\.)?ncrypt.in/(?Pfolder|link|frame)-([^/\?]+)' - __version__ = "1.32" + __description__ = """NCrypt.in decrypter plugin""" __author_name__ = ("fragonib", "stickell") __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "l.stickell@yahoo.it") - # Constants - _JK_KEY_ = "jk" - _CRYPTED_KEY_ = "crypted" + JK_KEY = "jk" + CRYPTED_KEY = "crypted" NAME_PATTERN = r' Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/crypter/NCryptIn.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index dc2f29519..f9953b994 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -100,20 +100,20 @@ class NCryptIn(Crypter): return True def isProtected(self): - form_match = re.search(r'(.*?)', self.cleanedHtml, re.DOTALL) - if form_match: - form_content = form_match.group(1) + form = re.search(r'(.*?)', self.cleanedHtml, re.DOTALL) + if form is not None: + content = form.group(1) for keyword in ("password", "captcha"): - if keyword in form_content: + if keyword in content: self.protection_type = keyword self.logDebug("Links are %s protected" % self.protection_type) return True return False def getPackageInfo(self): - m = re.search(self.NAME_PATTERN, self.html) - if m: - name = folder = m.group('N').strip() + found = re.search(self.NAME_PATTERN, self.html) + if found: + name = folder = found.group('N').strip() self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) else: name = self.package.name -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/crypter/NCryptIn.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index f9953b994..9a9d76f51 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -95,7 +95,7 @@ class NCryptIn(Crypter): def isOnline(self): if "Your folder does not exist" in self.cleanedHtml: - self.logDebug("File not found") + self.logDebug("File not m") return False return True @@ -111,14 +111,14 @@ class NCryptIn(Crypter): return False def getPackageInfo(self): - found = re.search(self.NAME_PATTERN, self.html) - if found: - name = folder = found.group('N').strip() + m = re.search(self.NAME_PATTERN, self.html) + if m: + name = folder = m.group('N').strip() self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) else: name = self.package.name folder = self.package.folder - self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) + self.logDebug("Package info not m, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return name, folder def unlockProtection(self): -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/crypter/NCryptIn.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/crypter/NCryptIn.py') diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 9a9d76f51..1b7b8b3d4 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -12,8 +12,8 @@ from module.plugins.internal.CaptchaService import ReCaptcha class NCryptIn(Crypter): __name__ = "NCryptIn" - __version__ = "1.32" __type__ = "crypter" + __version__ = "1.32" __pattern__ = r'http://(?:www\.)?ncrypt.in/(?Pfolder|link|frame)-([^/\?]+)' @@ -54,7 +54,7 @@ class NCryptIn(Crypter): if not self.isOnline(): self.offline() - # Check for folder protection + # Check for folder protection if self.isProtected(): self.html = self.unlockProtection() self.cleanedHtml = self.removeHtmlCrap(self.html) @@ -141,7 +141,7 @@ class NCryptIn(Crypter): self.logDebug("Captcha resolved [%s]" % captcha) postData['captcha'] = captcha - # Resolve recaptcha + # Resolve recaptcha if "recaptcha" in form: self.logDebug("ReCaptcha protected") captcha_key = re.search(r'\?k=(.*?)"', form).group(1) -- cgit v1.2.3