diff options
Diffstat (limited to 'module/plugins/crypter/ShareLinksBiz.py')
-rw-r--r-- | module/plugins/crypter/ShareLinksBiz.py | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 1968fcf8e..fd9eb4124 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -11,7 +11,7 @@ from module.plugins.internal.Crypter import Crypter class ShareLinksBiz(Crypter): __name__ = "ShareLinksBiz" __type__ = "crypter" - __version__ = "1.23" + __version__ = "1.24" __status__ = "testing" __pattern__ = r'http://(?:www\.)?(share-links|s2l)\.biz/(?P<ID>_?\w+)' @@ -21,8 +21,8 @@ class ShareLinksBiz(Crypter): __description__ = """Share-Links.biz decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), - ("Arno-Nymous", None)] + __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), + ("Arno-Nymous", None )] def setup(self): @@ -81,7 +81,7 @@ class ShareLinksBiz(Crypter): self.file_id = re.match(self.__pattern__, url).group('ID') else: - self.log_debug("Could not initialize, URL [%s] does not match pattern [%s]" % (url, self.__pattern__)) + self.log_debug(_("Could not initialize, URL [%s] does not match pattern [%s]") % (url, self.__pattern__)) self.fail(_("Unsupported download link")) self.package = pyfile.package() @@ -89,7 +89,7 @@ class ShareLinksBiz(Crypter): def is_online(self): if "No usable content was found" in self.data: - self.log_debug("File not found") + self.log_debug(_("File not found")) return False else: return True @@ -97,14 +97,14 @@ class ShareLinksBiz(Crypter): def is_password_protected(self): if re.search(r'<form.*?id="passwordForm".*?>', self.data): - self.log_debug("Links are protected") + self.log_debug(_("Links are protected")) return True return False def is_captcha_protected(self): if '<map id="captchamap"' in self.data: - self.log_debug("Links are captcha protected") + self.log_debug(_("Links are captcha protected")) return True return False @@ -117,7 +117,7 @@ class ShareLinksBiz(Crypter): def unlock_password_protection(self): password = self.get_password() - self.log_debug("Submitting password [%s] for protected links" % password) + self.log_debug(_("Submitting password [%s] for protected links") % password) post = {'password': password, 'login': 'Submit form'} url = self.base_url + '/' + self.file_id self.data = self.load(url, post=post) @@ -125,22 +125,22 @@ class ShareLinksBiz(Crypter): def unlock_captcha_protection(self): #: Get captcha map - captchaMap = self._get_captcha_map() - self.log_debug("Captcha map with [%d] positions" % len(captchaMap.keys())) + captcha_map = self._get_captcha_map() + self.log_debug(_("Captcha map with [%d] positions") % len(captcha_map.keys())) #: Request user for captcha coords m = re.search(r'<img src="/captcha.gif\?d=(.+?)&PHPSESSID=(.+?)&legend=1"', self.data) if m is None: - self.log_debug("Captcha url data not found, maybe plugin out of date?") + self.log_debug(_("Captcha url data not found, maybe plugin out of date?")) self.fail(_("Captcha url data not found")) - captchaUrl = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) - self.log_debug("Waiting user for correct position") - coords = self.captcha.decrypt(captchaUrl, input_type="gif", output_type='positional') - self.log_debug("Captcha resolved! Coords: {}, {}".format(*coords)) + captcha_url = self.base_url + '/captcha.gif?d=%s&PHPSESSID=%s' % (m.group(1), m.group(2)) + self.log_debug(_("Waiting user for correct position")) + coords = self.captcha.decrypt(captcha_url, input_type="gif", output_type='positional') + self.log_debug(_("Captcha resolved! Coords: *s, %s") % (coords[0], coords[1])) #: Resolve captcha - href = self._resolve_coords(coords, captchaMap) + href = self._resolve_coords(coords, captcha_map) if href is None: self.retry_captcha(wait=5) @@ -157,9 +157,9 @@ class ShareLinksBiz(Crypter): return mapp - def _resolve_coords(self, coords, captchaMap): + def _resolve_coords(self, coords, captcha_map): x, y = coords - for rect, href in captchaMap.items(): + for rect, href in captcha_map.items(): x1, y1, x2, y2 = rect if (x >= x1 and x <= x2) and (y >= y1 and y <= y2): return href @@ -186,13 +186,13 @@ class ShareLinksBiz(Crypter): title = m.group(1).strip() if 'unnamed' not in title: name = folder = title - self.log_debug("Found name [%s] and folder [%s] in package info" % (name, folder)) + self.log_debug(_("Found name [%s] and folder [%s] in package info") % (name, folder)) #: Fallback to defaults if not name or not folder: name = self.package.name folder = self.package.folder - self.log_debug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) + self.log_debug(_("Package info not found, defaulting to pyfile name [%s] and folder [%s]") % (name, folder)) #: Return package info return name, folder @@ -200,55 +200,55 @@ class ShareLinksBiz(Crypter): def handle_web_links(self): pack_links = [] - self.log_debug("Handling Web links") + self.log_debug(_("Handling Web links")) #@TODO: Gather paginated web links pattern = r'javascript:_get\(\'(.*?)\', \d+, \'\'\)' ids = re.findall(pattern, self.data) - self.log_debug("Decrypting %d Web links" % len(ids)) + self.log_debug(_("Decrypting %d Web links") % len(ids)) for i, ID in enumerate(ids): try: - self.log_debug("Decrypting Web link %d, [%s]" % (i + 1, ID)) + self.log_debug(_("Decrypting Web link %d, [%s]") % (i + 1, ID)) - dwLink = self.base_url + "/get/lnk/" + ID - res = self.load(dwLink) + dw_link = self.base_url + "/get/lnk/" + ID + res = self.load(dw_link) code = re.search(r'frm/(\d+)', res).group(1) - fwLink = self.base_url + "/get/frm/" + code - res = self.load(fwLink) + fw_link = self.base_url + "/get/frm/" + code + res = self.load(fw_link) jscode = re.search(r'<script language="javascript">\s*eval\((.*)\)\s*</script>', res, re.S).group(1) - jscode = self.js.eval("f = %s" % jscode) + jscode = self.js.eval(_("f = %s") % jscode) jslauncher = "window=''; parent={frames:{Main:{location:{href:''}}},location:''}; %s; parent.frames.Main.location.href" - dlLink = self.js.eval(jslauncher % jscode) + dl_link = self.js.eval(jslauncher % jscode) - self.log_debug("JsEngine returns value [%s] for redirection link" % dlLink) + self.log_debug(_("JsEngine returns value [%s] for redirection link") % dl_link) - pack_links.append(dlLink) + pack_links.append(dl_link) except Exception, detail: - self.log_debug("Error decrypting Web link [%s], %s" % (ID, detail)) + self.log_debug(_("Error decrypting Web link [%s], %s") % (ID, detail)) return pack_links def handle_containers(self): pack_links = [] - self.log_debug("Handling Container links") + self.log_debug(_("Handling Container links")) pattern = r'javascript:_get\(\'(.*?)\', 0, \'(rsdf|ccf|dlc)\'\)' - containersLinks = re.findall(pattern, self.data) - self.log_debug("Decrypting %d Container links" % len(containersLinks)) - for containerLink in containersLinks: - link = "%s/get/%s/%s" % (self.base_url, containerLink[1], containerLink[0]) + containers_links = re.findall(pattern, self.data) + self.log_debug(_("Decrypting %d Container links") % len(containers_links)) + for container_link in containers_links: + link = "%s/get/%s/%s" % (self.base_url, container_link[1], container_link[0]) pack_links.append(link) return pack_links def handle_CNL2(self): pack_links = [] - self.log_debug("Handling CNL2 links") + self.log_debug(_("Handling CNL2 links")) if '/lib/cnl2/ClicknLoad.swf' in self.data: try: @@ -282,8 +282,8 @@ class ShareLinksBiz(Crypter): def _get_links(self, crypted, jk): #: Get key - jreturn = self.js.eval("%s f()" % jk) - self.log_debug("JsEngine returns value [%s]" % jreturn) + jreturn = self.js.eval(_("%s f()") % jk) + self.log_debug(_("JsEngine returns value [%s]") % jreturn) key = binascii.unhexlify(jreturn) #: Decrypt @@ -297,5 +297,5 @@ class ShareLinksBiz(Crypter): links = filter(bool, text.split('\n')) #: Log and return - self.log_debug("Block has %d links" % len(links)) + self.log_debug(_("Block has %d links") % len(links)) return links |