diff options
Diffstat (limited to 'module/plugins/crypter/LinkCryptWs.py')
-rw-r--r-- | module/plugins/crypter/LinkCryptWs.py | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 9d421ad03..0cdfa1e34 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -3,12 +3,11 @@ import binascii import re +import Crypto.Cipher import pycurl -from Crypto.Cipher import AES - -from module.plugins.internal.Crypter import Crypter, create_getInfo -from module.plugins.internal.utils import html_unescape +from module.plugins.internal.Crypter import Crypter +from module.plugins.internal.misc import html_unescape, set_cookie class LinkCryptWs(Crypter): @@ -41,7 +40,7 @@ class LinkCryptWs(Crypter): #: Init self.fileid = re.match(self.__pattern__, self.pyfile.url).group('ID') - self.req.cj.setCookie("linkcrypt.ws", "language", "en") + set_cookie(req.cj, "linkcrypt.ws", "language", "en") #: Request package self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: Better chance to not get those key-captchas @@ -74,7 +73,7 @@ class LinkCryptWs(Crypter): self.getunrarpw() #: Get package name and folder - package_name, folder_name = self.get_package_info() + pack_name, folder_name = self.get_package_info() #: Get the container definitions from script section self.get_container_html() @@ -88,7 +87,7 @@ class LinkCryptWs(Crypter): break if self.urls: - self.packages = [(package_name, self.urls, folder_name)] + self.packages = [(pack_name, self.urls, folder_name)] def is_online(self): @@ -183,7 +182,7 @@ class LinkCryptWs(Crypter): def handle_web_links(self): self.log_debug("Search for Web links ") - package_links = [] + pack_links = [] pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"' ids = re.findall(pattern, self.data, re.I | re.S) @@ -199,12 +198,12 @@ class LinkCryptWs(Crypter): link2 = res[indexs:indexe] link2 = html_unescape(link2) - package_links.append(link2) + pack_links.append(link2) except Exception, detail: self.log_debug("Error decrypting Web link %s, %s" % (weblink_id, detail)) - return package_links + return pack_links def get_container_html(self): @@ -223,7 +222,7 @@ class LinkCryptWs(Crypter): def handle_container(self, type): - package_links = [] + pack_links = [] type = type.lower() self.log_debug('Search for %s Container links' % type.upper()) @@ -241,18 +240,18 @@ class LinkCryptWs(Crypter): self.log_debug("clink found") - 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.pyload.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) + pack_name, folder_name = self.get_package_info() + self.log_debug("Added package with name %s.%s and container link %s" %( pack_name, type, clink.group(1))) + self.pyload.api.uploadContainer('.'.join([pack_name, type]), self.load(clink.group(1))) return "Found it" - return package_links + return pack_links def handle_CNL2(self): self.log_debug("Search for CNL links") - package_links = [] + pack_links = [] cnl_line = None for line in self.container_html: @@ -267,13 +266,13 @@ class LinkCryptWs(Crypter): cnl_section = self.handle_javascript(cnl_line) (vcrypted, vjk) = self._get_cipher_params(cnl_section) for (crypted, jk) in zip(vcrypted, vjk): - package_links.extend(self._get_links(crypted, jk)) + pack_links.extend(self._get_links(crypted, jk)) except Exception: self.log_error(_("Unable to decrypt CNL links (JS Error) try to get over links"), trace=True) return self.handle_web_links() - return package_links + return pack_links def _get_cipher_params(self, cnl_section): @@ -299,7 +298,7 @@ class LinkCryptWs(Crypter): #: Decrypt Key = key IV = key - obj = AES.new(Key, AES.MODE_CBC, IV) + obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV) text = obj.decrypt(crypted.decode('base64')) #: Extract links @@ -310,6 +309,3 @@ class LinkCryptWs(Crypter): self.log_debug("Package has %d links" % len(links)) return links - - -getInfo = create_getInfo(LinkCryptWs) |