diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-18 19:09:49 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-18 19:09:49 +0200 |
commit | 477120dfa8090f808ce17267896456c082714203 (patch) | |
tree | 6ad8d52bf354490a57d1890de3a78e37b2001f30 | |
parent | [RelinkUs] Fix regex errors and str conversion (diff) | |
download | pyload-477120dfa8090f808ce17267896456c082714203.tar.xz |
Fixed logging issue with coords values
-rw-r--r-- | module/plugins/accounts/XFileSharingPro.py | 2 | ||||
-rw-r--r-- | module/plugins/crypter/NCryptIn.py | 21 | ||||
-rw-r--r-- | module/plugins/crypter/ShareLinksBiz.py | 21 |
3 files changed, 39 insertions, 5 deletions
diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py index 5be377c40..fba774b21 100644 --- a/module/plugins/accounts/XFileSharingPro.py +++ b/module/plugins/accounts/XFileSharingPro.py @@ -10,7 +10,7 @@ class XFileSharingPro(XFSPAccount): __type__ = "account" __version__ = "0.02" - __description__ = """XFileSharingPro dummy account plugin""" + __description__ = """XFileSharingPro multi-purpose account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 64ce973e8..22fd53384 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -13,7 +13,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class NCryptIn(Crypter): __name__ = "NCryptIn" __type__ = "crypter" - __version__ = "1.32" + __version__ = "1.33" __pattern__ = r'http://(?:www\.)?ncrypt\.in/(?P<type>folder|link|frame)-([^/\?]+)' @@ -36,6 +36,7 @@ class NCryptIn(Crypter): self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"] self.protection_type = None + def decrypt(self, pyfile): # Init self.package = pyfile.package() @@ -77,13 +78,16 @@ class NCryptIn(Crypter): self.fail('Could not extract any links') self.packages = [(package_name, package_links, folder_name)] + def isSingleLink(self): link_type = re.match(self.__pattern__, self.pyfile.url).group('type') return link_type in ("link", "frame") + def requestFolderHome(self): return self.load(self.pyfile.url, decode=True) + def removeHtmlCrap(self, content): patterns = (r'(type="hidden".*?(name=".*?")?.*?value=".*?")', r'display:none;">(.*?)</(div|span)>', @@ -95,12 +99,14 @@ class NCryptIn(Crypter): content = re.sub(rexpr, "", content) return content + def isOnline(self): if "Your folder does not exist" in self.cleanedHtml: self.logDebug("File not m") return False return True + def isProtected(self): form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.DOTALL) if form is not None: @@ -112,6 +118,7 @@ class NCryptIn(Crypter): return True return False + def getPackageInfo(self): m = re.search(self.NAME_PATTERN, self.html) if m: @@ -123,6 +130,7 @@ class NCryptIn(Crypter): self.logDebug("Package info not m, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return name, folder + def unlockProtection(self): postData = {} @@ -158,7 +166,7 @@ class NCryptIn(Crypter): self.logDebug("CircleCaptcha protected") captcha_img_url = "http://ncrypt.in/classes/captcha/circlecaptcha.php" coords = self.decryptCaptcha(captcha_img_url, forceUser=True, imgtype="png", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % coords) + self.logDebug("Captcha resolved, coords [%s]" % str(coords)) postData['circle.x'] = coords[0] postData['circle.y'] = coords[1] @@ -166,6 +174,7 @@ class NCryptIn(Crypter): postData['submit_protected'] = 'Continue to folder' 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: @@ -180,6 +189,7 @@ class NCryptIn(Crypter): else: self.correctCaptcha() + def handleLinkSource(self, link_source_type): # Check for JS engine require_js_engine = link_source_type in ("cnl2", "rsdf", "ccf", "dlc") @@ -199,6 +209,7 @@ class NCryptIn(Crypter): else: self.fail('unknown source type "%s" (this is probably a bug)' % link_source_type) + def handleSingleLink(self): self.logDebug("Handling Single link") @@ -211,6 +222,7 @@ class NCryptIn(Crypter): return package_links + def handleCNL2(self): self.logDebug("Handling CNL2 links") @@ -226,6 +238,7 @@ class NCryptIn(Crypter): return package_links + def handleContainers(self): self.logDebug("Handling Container links") @@ -240,6 +253,7 @@ class NCryptIn(Crypter): return package_links + def handleWebLinks(self): self.logDebug("Handling Web links") @@ -256,6 +270,7 @@ class NCryptIn(Crypter): return package_links + def decryptLink(self, link): try: url = link.replace("link-", "frame-") @@ -264,6 +279,7 @@ class NCryptIn(Crypter): except Exception, detail: self.logDebug("Error decrypting link %s, %s" % (link, detail)) + def _getCipherParams(self): pattern = r'<input.*?name="%s".*?value="(.*?)"' @@ -280,6 +296,7 @@ class NCryptIn(Crypter): self.logDebug("Detected %d crypted blocks" % len(vcrypted)) return vcrypted, vjk + def _getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 9d4cfbb43..6e187ed6f 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -11,7 +11,7 @@ from module.plugins.Crypter import Crypter class ShareLinksBiz(Crypter): __name__ = "ShareLinksBiz" __type__ = "crypter" - __version__ = "1.13" + __version__ = "1.14" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' @@ -27,6 +27,7 @@ class ShareLinksBiz(Crypter): self.html = None self.captcha = False + def decrypt(self, pyfile): # Init self.initFile(pyfile) @@ -61,6 +62,7 @@ class ShareLinksBiz(Crypter): # Pack self.packages = [(package_name, package_links, package_folder)] + def initFile(self, pyfile): url = pyfile.url if 's2l.biz' in url: @@ -69,29 +71,34 @@ class ShareLinksBiz(Crypter): self.fileId = re.match(self.__pattern__, url).group('ID') self.package = pyfile.package() + def isOnline(self): if "No usable content was found" in self.html: self.logDebug("File not found") return False return True + def isPasswordProtected(self): if re.search(r'''<form.*?id="passwordForm".*?>''', self.html): self.logDebug("Links are protected") return True return False + def isCaptchaProtected(self): if '<map id="captchamap"' in self.html: self.logDebug("Links are captcha protected") return True return False + def unblockServer(self): imgs = re.findall(r"(/template/images/.*?\.gif)", self.html) for img in imgs: self.load(self.baseUrl + img) + def unlockPasswordProtection(self): password = self.getPassword() self.logDebug("Submitting password [%s] for protected links" % password) @@ -99,6 +106,7 @@ class ShareLinksBiz(Crypter): url = self.baseUrl + '/' + self.fileId self.html = self.load(url, post=post, decode=True) + def unlockCaptchaProtection(self): # Get captcha map captchaMap = self._getCaptchaMap() @@ -109,7 +117,7 @@ class ShareLinksBiz(Crypter): captchaUrl = self.baseUrl + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) self.logDebug("Waiting user for correct position") coords = self.decryptCaptcha(captchaUrl, forceUser=True, imgtype="gif", result_type='positional') - self.logDebug("Captcha resolved, coords [%s]" % coords) + self.logDebug("Captcha resolved, coords [%s]" % str(coords)) # Resolve captcha href = self._resolveCoords(coords, captchaMap) @@ -122,6 +130,7 @@ class ShareLinksBiz(Crypter): url = self.baseUrl + href self.html = self.load(url, decode=True) + def _getCaptchaMap(self): mapp = {} for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html): @@ -130,6 +139,7 @@ class ShareLinksBiz(Crypter): mapp[rect] = href return mapp + def _resolveCoords(self, coords, captchaMap): x, y = coords for rect, href in captchaMap.items(): @@ -137,6 +147,7 @@ class ShareLinksBiz(Crypter): if (x >= x1 and x <= x2) and (y >= y1 and y <= y2): return href + def handleErrors(self): if "The inserted password was wrong" in self.html: self.logDebug("Incorrect password, please set right password on 'Edit package' form and retry") @@ -152,6 +163,7 @@ class ShareLinksBiz(Crypter): else: self.correctCaptcha() + def getPackageInfo(self): name = folder = None @@ -173,6 +185,7 @@ class ShareLinksBiz(Crypter): # Return package info return name, folder + def handleWebLinks(self): package_links = [] self.logDebug("Handling Web links") @@ -200,6 +213,7 @@ class ShareLinksBiz(Crypter): self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail)) return package_links + def handleContainers(self): package_links = [] self.logDebug("Handling Container links") @@ -212,6 +226,7 @@ class ShareLinksBiz(Crypter): package_links.append(link) return package_links + def handleCNL2(self): package_links = [] self.logDebug("Handling CNL2 links") @@ -224,6 +239,7 @@ class ShareLinksBiz(Crypter): self.fail("Unable to decrypt CNL2 links") return package_links + def _getCipherParams(self): # Request CNL2 code = re.search(r'ClicknLoad.swf\?code=(.*?)"', self.html).group(1) @@ -244,6 +260,7 @@ class ShareLinksBiz(Crypter): # Log and return return crypted, jk + def _getLinks(self, crypted, jk): # Get key jreturn = self.js.eval("%s f()" % jk) |