diff options
author | fragonib <devnull@localhost> | 2010-11-18 22:16:51 +0100 |
---|---|---|
committer | fragonib <devnull@localhost> | 2010-11-18 22:16:51 +0100 |
commit | e7ec5b2770a9f0f82be1f7dce90283137a38a5d5 (patch) | |
tree | 67139433e5436027e8ca5b255943adc69be62e2b /module/plugins/crypter | |
parent | little fixes (diff) | |
download | pyload-e7ec5b2770a9f0f82be1f7dce90283137a38a5d5.tar.xz |
RelinkUs: Add support for password protected packages
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r-- | module/plugins/crypter/RelinkUs.py | 83 |
1 files changed, 66 insertions, 17 deletions
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index daf96fd76..ef00b1183 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -7,53 +7,102 @@ import binascii import re import urllib + class RelinkUs(Crypter): __name__ = "RelinkUs" __type__ = "crypter" - __pattern__ = r"http://(www\.)?relink.us/(f|((view|go).php))" - __version__ = "2.1" + __pattern__ = r"http://(www\.)?relink.us/(f/|((view|go).php\?id=))(?P<id>.+)" + __version__ = "2.2" __description__ = """Relink.us Crypter Plugin""" - __author_name__ = ("Sleeper-", "spoob", "fragonib") - __author_mail__ = ("@nonymous", "spoob@pyload.org", "fragonib AT yahoo DOT es") + __author_name__ = ("fragonib") + __author_mail__ = ("fragonib AT yahoo DOT es") # Constants _JK_KEY_ = "jk" _CRYPTED_KEY_ = "crypted" + + def setup(self): + self.html = None def decrypt(self, pyfile): - - # Request page - self.html = self.load(pyfile.url) - if not self.fileExists(): + # Init + self.pyfile = pyfile + self.package = pyfile.package() + + # Request package + self.html = self.requestPackageInfo() + if not self.isOnline(): self.offline() + + # Check for password protection + if self.isPasswordProtected(): + self.html = self.submitPassword() + if self.html is None: + self.fail("Incorrect password, please set right password on Add package form and retry") # Get package name and folder (package_name, folder_name) = self.getPackageNameAndFolder() # Get package links - (crypted, jk) = self.getCipherParams() - package_links = self.getLinks(crypted, jk) + try: + (crypted, jk) = self.getCipherParams() + package_links = self.getLinks(crypted, jk) + except: + self.fail("Unable to decrypt package") # Pack self.packages = [(package_name, package_links, folder_name)] - def fileExists(self): + def isOnline(self): if "sorry.png" in self.html: self.log.debug("RelinkUs: File not found") return False return True + + def isPasswordProtected(self): + if "<h1>Container Protection</h1>" in self.html: + self.log.debug("RelinkUs: Links are password protected") + return True + return False + + def requestPackageInfo(self): + return self.load(self.pyfile.url) + + def submitPassword(self): + # Gather data + url = self.pyfile.url + m = re.match(self.__pattern__, url) + if m is None: + self.log.debug("RelinkUs: Unable to get package id from url [%s]" % (url)) + return + id = m.group('id') + password = self.package.password + + # Submit package password + url = "http://www.relink.us/container_password.php?id=" + id + post = { '#' : '', 'password' : password, 'pw' : 'submit' } + self.log.debug("RelinkUs: Submitting password [%s] for protected links with id [%s]" % (password, id)) + html = self.load(url, {}, post) + + # Check for invalid password + if "An error occurred!" in html: + self.log.debug("RelinkUs: Incorrect password, please set right password on Add package form and retry") + return None + else: + return html def getPackageNameAndFolder(self): title_re = r'<td class="top">Title</td><td class="top">\|</td><td><span class="info_view_id"><i>(?P<title>.+)</i></span></td>' m = re.search(title_re, self.html) if m is not None: name = folder = m.group('title') - self.log.debug("RelinkUs: Found name [%s] and folder [%s] for package" % (name, folder)) + self.log.debug("RelinkUs: Found name [%s] and folder [%s] in package info" % (name, folder)) + return (name, folder) + else: + name = self.package.name + folder = self.package.folder + self.log.debug("RelinkUs: Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) return (name, folder) - name = self.pyfile.package().name - folder = self.pyfile.package().folder - self.log.debug("RelinkUs: Default to pyfile name [%s] and folder [%s] for package" % (name, folder)) - return (name, folder) def getCipherParams(self): @@ -78,7 +127,7 @@ class RelinkUs(Crypter): # Get key jreturn = self.js.eval("%s f()" % jk) - self.log.debug("RelinkUs: JsEngine returns value [%s]" % jreturn) + self.log.debug("RelinkUs: JsEngine returns value key=[%s]" % jreturn) key = binascii.unhexlify(jreturn) # Decode crypted |