summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/LinkCryptWs.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/crypter/LinkCryptWs.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/crypter/LinkCryptWs.py')
-rw-r--r--module/plugins/crypter/LinkCryptWs.py114
1 files changed, 57 insertions, 57 deletions
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index e889ca154..44ca502a9 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -14,7 +14,7 @@ from module.utils import html_unescape
class LinkCryptWs(Crypter):
__name__ = "LinkCryptWs"
__type__ = "crypter"
- __version__ = "0.09"
+ __version__ = "0.10"
__pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)'
@@ -52,34 +52,34 @@ class LinkCryptWs(Crypter):
self.prepare()
- if not self.isOnline():
+ if not self.is_online():
self.offline()
- if self.isKeyCaptchaProtected():
+ if self.is_key_captcha_protected():
self.retry(8, 15, _("Can't handle Key-Captcha"))
- if self.isCaptchaProtected():
+ if self.is_captcha_protected():
self.captcha = True
- self.unlockCaptchaProtection()
- self.handleCaptchaErrors()
+ self.unlock_captcha_protection()
+ self.handle_captcha_errors()
#: Check for protection
- if self.isPasswordProtected():
- self.unlockPasswordProtection()
- self.handleErrors()
+ if self.is_password_protected():
+ self.unlock_password_protection()
+ self.handle_errors()
#: get unrar password
self.getunrarpw()
#: Get package name and folder
- package_name, folder_name = self.getPackageInfo()
+ package_name, folder_name = self.get_package_info()
- #get the container definitions from script section
+ # get the container definitions from script section
self.get_container_html()
#: Extract package links
for type in self.sources:
- links = self.handleLinkSource(type)
+ links = self.handle_link_source(type)
if links:
self.links.extend(links)
@@ -89,59 +89,59 @@ class LinkCryptWs(Crypter):
self.packages = [(package_name, self.links, folder_name)]
- def isOnline(self):
+ def is_online(self):
if "<title>Linkcrypt.ws // Error 404</title>" in self.html:
- self.logDebug("Folder doesn't exist anymore")
+ self.log_debug("Folder doesn't exist anymore")
return False
else:
return True
- def isPasswordProtected(self):
+ def is_password_protected(self):
if "Authorizing" in self.html:
- self.logDebug("Links are password protected")
+ self.log_debug("Links are password protected")
return True
else:
return False
- def isCaptchaProtected(self):
+ def is_captcha_protected(self):
if 'id="captcha">' in self.html:
- self.logDebug("Links are captcha protected")
+ self.log_debug("Links are captcha protected")
return True
else:
return False
- def isKeyCaptchaProtected(self):
+ def is_key_captcha_protected(self):
if re.search(r'>If the folder does not open after klick on <', self.html, re.I):
return True
else:
return False
- def unlockPasswordProtection(self):
- password = self.getPassword()
+ def unlock_password_protection(self):
+ password = self.get_password()
if password:
- self.logDebug("Submitting password [%s] for protected links" % password)
+ self.log_debug("Submitting password [%s] for protected links" % password)
self.html = self.load(self.pyfile.url, post={"password": password, 'x': "0", 'y': "0"})
else:
self.fail(_("Folder is password protected"))
- def unlockCaptchaProtection(self):
+ def unlock_captcha_protection(self):
captcha_url = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="(.+?)"', self.html, re.I | re.S).group(1)
- captcha_code = self.decryptCaptcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional')
+ captcha_code = self.decrypt_captcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional')
self.html = self.load(self.pyfile.url, post={"x": captcha_code[0], "y": captcha_code[1]})
- def getPackageInfo(self):
+ def get_package_info(self):
name = self.pyfile.package().name
folder = self.pyfile.package().folder
- self.logDebug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder))
+ self.log_debug("Defaulting to pyfile name [%s] and folder [%s] for package" % (name, folder))
return name, folder
@@ -154,46 +154,46 @@ class LinkCryptWs(Crypter):
unrarpw = sitein[indexi:indexe]
if not (unrarpw == "Password" or "Dateipasswort") :
- self.logDebug("File password set to: [%s]"% unrarpw)
+ self.log_debug("File password set to: [%s]"% unrarpw)
self.pyfile.package().password = unrarpw
- def handleErrors(self):
- if self.isPasswordProtected():
+ def handle_errors(self):
+ if self.is_password_protected():
self.fail(_("Incorrect password"))
- def handleCaptchaErrors(self):
+ def handle_captcha_errors(self):
if self.captcha:
if "Your choice was wrong!" in self.html:
- self.invalidCaptcha()
+ self.invalid_captcha()
self.retry()
else:
- self.correctCaptcha()
+ self.correct_captcha()
- def handleLinkSource(self, type):
+ def handle_link_source(self, type):
if type == 'cnl':
- return self.handleCNL2()
+ return self.handle_CNL2()
elif type == 'web':
- return self.handleWebLinks()
+ return self.handle_web_links()
elif type in ('rsdf', 'ccf', 'dlc'):
- return self.handleContainer(type)
+ return self.handle_container(type)
else:
self.fail(_("Unknown source type: %s") % type) #@TODO: Replace with self.error in 0.4.10
- def handleWebLinks(self):
- self.logDebug("Search for Web links ")
+ def handle_web_links(self):
+ self.log_debug("Search for Web links ")
package_links = []
pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"'
ids = re.findall(pattern, self.html, re.I | re.S)
- self.logDebug("Decrypting %d Web links" % len(ids))
+ self.log_debug("Decrypting %d Web links" % len(ids))
for idx, weblink_id in enumerate(ids):
try:
@@ -208,7 +208,7 @@ class LinkCryptWs(Crypter):
package_links.append(link2)
except Exception, detail:
- self.logDebug("Error decrypting Web link %s, %s" % (weblink_id, detail))
+ self.log_debug("Error decrypting Web link %s, %s" % (weblink_id, detail))
return package_links
@@ -228,11 +228,11 @@ class LinkCryptWs(Crypter):
return self.js.eval(line.replace('{}))',"{}).replace('document.open();document.write','').replace(';document.close();',''))"))
- def handleContainer(self, type):
+ def handle_container(self, type):
package_links = []
type = type.lower()
- self.logDebug('Search for %s Container links' % type.upper())
+ self.log_debug('Search for %s Container links' % type.upper())
if not type.isalnum(): #: check to prevent broken re-pattern (cnl2, rsdf, ccf, dlc, web are all alpha-numeric)
self.fail(_("Unknown container type: %s") % type) #@TODO: Replace with self.error in 0.4.10
@@ -245,18 +245,18 @@ class LinkCryptWs(Crypter):
if not clink:
continue
- self.logDebug("clink avaible")
+ self.log_debug("clink avaible")
- package_name, folder_name = self.getPackageInfo()
- self.logDebug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1)))
+ package_name, folder_name = self.get_package_info()
+ self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1)))
self.core.api.uploadContainer( "%s.%s" %(package_name, type), self.load(clink.group(1)))
return "Found it"
return package_links
- def handleCNL2(self):
- self.logDebug("Search for CNL links")
+ def handle_CNL2(self):
+ self.log_debug("Search for CNL links")
package_links = []
cnl_line = None
@@ -267,21 +267,21 @@ class LinkCryptWs(Crypter):
break
if cnl_line:
- self.logDebug("cnl_line gefunden")
+ self.log_debug("cnl_line gefunden")
try:
cnl_section = self.handle_javascript(cnl_line)
- (vcrypted, vjk) = self._getCipherParams(cnl_section)
+ (vcrypted, vjk) = self._get_cipher_params(cnl_section)
for (crypted, jk) in zip(vcrypted, vjk):
- package_links.extend(self._getLinks(crypted, jk))
+ package_links.extend(self._get_links(crypted, jk))
except Exception:
- self.logError(_("Unable to decrypt CNL links (JS Error) try to get over links"))
- return self.handleWebLinks()
+ self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"))
+ return self.handle_web_links()
return package_links
- def _getCipherParams(self, cnl_section):
+ def _get_cipher_params(self, cnl_section):
#: Get jk
jk_re = r'<INPUT.*?NAME="%s".*?VALUE="(.*?)"' % LinkCryptWs.JK_KEY
vjk = re.findall(jk_re, cnl_section)
@@ -291,16 +291,16 @@ class LinkCryptWs(Crypter):
vcrypted = re.findall(crypted_re, cnl_section)
#: Log and return
- self.logDebug("Detected %d crypted blocks" % len(vcrypted))
+ self.log_debug("Detected %d crypted blocks" % len(vcrypted))
return vcrypted, vjk
- def _getLinks(self, crypted, jk):
+ def _get_links(self, crypted, jk):
#: Get key
jreturn = self.js.eval("%s f()" % jk)
key = binascii.unhexlify(jreturn)
- self.logDebug("JsEngine returns value [%s]" % jreturn)
+ self.log_debug("JsEngine returns value [%s]" % jreturn)
#: Decrypt
Key = key
@@ -313,6 +313,6 @@ class LinkCryptWs(Crypter):
links = filter(bool, text.split('\n'))
#: Log and return
- self.logDebug("Package has %d links" % len(links))
+ self.log_debug("Package has %d links" % len(links))
return links