From e771c9bb3cebede886fd37121df909e723d6c1e3 Mon Sep 17 00:00:00 2001 From: fragonib Date: Sun, 15 May 2011 14:39:19 +0200 Subject: Several Crypters and Hosters fixes, improvements, python2.5 issues... --- module/plugins/crypter/LinkSaveIn.py | 167 ++++++++++++++++++++++++------ module/plugins/crypter/NCryptIn.py | 12 +-- module/plugins/hoster/MegauploadCom.py | 127 ++++++++++++----------- module/plugins/hoster/OneFichierCom.py | 156 +++++++++++++++++++--------- module/plugins/hoster/UploadStationCom.py | 8 +- 5 files changed, 319 insertions(+), 151 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index 8809bd7d1..33d49608c 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -2,6 +2,7 @@ from Crypto.Cipher import AES from module.plugins.Crypter import Crypter +from module.unescape import unescape import base64 import binascii import re @@ -9,8 +10,8 @@ import re class LinkSaveIn(Crypter): __name__ = "LinkSaveIn" __type__ = "crypter" - __pattern__ = r"http://(www\.)?linksave.in/([a-z0-9]+)$" - __version__ = "1.01" + __pattern__ = r"http://(www\.)?linksave.in/(?P\w+)$" + __version__ = "2.0" __description__ = """LinkSave.in Crypter Plugin""" __author_name__ = ("fragonib") __author_mail__ = ("fragonib[AT]yahoo[DOT]es") @@ -18,64 +19,162 @@ class LinkSaveIn(Crypter): # Constants _JK_KEY_ = "jk" _CRYPTED_KEY_ = "crypted" + HOSTER_DOMAIN = "linksave.in" + + def setup(self): + self.html = None + self.fileid = None + self.captcha = False + self.package = None def decrypt(self, pyfile): - # Request page - self.html = self.load(pyfile.url) - if not self.fileExists(): + # Init + self.package = pyfile.package() + self.fileid = re.match(self.__pattern__, pyfile.url).group('id') + self.req.cj.setCookie(self.HOSTER_DOMAIN, "Linksave_Language", "english") + + # Request package + self.html = self.load(self.pyfile.url, cookies=True) + if not self.isOnline(): self.offline() - - # Handle captcha protection - self.handleCaptcha() + + # Check for protection + if self.isPasswordProtected(): + self.unlockPasswordProtection() + self.handleErrors() + + if self.isCaptchaProtected(): + self.captcha = True + self.unlockCaptchaProtection() + self.handleErrors() # Get package name and folder - (package_name, folder_name) = self.getPackageNameAndFolder() + (package_name, folder_name) = self.getPackageInfo() - # Get package links - (crypted, jk) = self.getCipherParams() - package_links = self.getLinks(crypted, jk) + # Extract package links + package_links = [] + package_links.extend(self.handleWebLinks()) + package_links.extend(self.handleContainers()) + package_links.extend(self.handleCNL2()) + package_links = set(package_links) # Pack self.packages = [(package_name, package_links, folder_name)] - def fileExists(self): - if "LinkSave.in - Error 404" in self.html: + def isOnline(self): + if "Error 404 - Folder not found!" in self.html: self.log.debug("%s: File not found" % self.__name__) return False return True - def getPackageNameAndFolder(self): + def isPasswordProtected(self): + if re.search(r'''Captcha:" in self.html: + self.log.debug("%s: Links are captcha protected" % self.__name__) + return True + return False + + def unlockPasswordProtection(self): + password = self.package.password + self.log.debug("%s: Submitting password [%s] for protected links" % (self.__name__, password)) + post = {"id": self.fileid, "besucherpasswort": self.package.password, 'login': 'submit'} + self.html = self.load(self.pyfile.url, post=post) + + def unlockCaptchaProtection(self): + hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1) + captchaUrl = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1) + code = self.decryptCaptcha("http://linksave.in" + captchaUrl, forceUser=True) + self.html = self.load(self.pyfile.url, post={"id": self.fileid, "hash": hash, "code": code}) + + def getPackageInfo(self): name = self.pyfile.package().name folder = self.pyfile.package().folder - self.log.debug("%s: Default to pyfile name [%s] and folder [%s] for package" % (self.__name__, name, folder)) + self.log.debug("%s: Defaulting to pyfile name [%s] and folder [%s] for package" % (self.__name__, name, folder)) return name, folder - - def handleCaptcha(self): - if "Captcha:" in self.html: - id = re.search(r'name="id" value="([^"]+)', self.html).group(1) - hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1) - url = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1) - value = self.decryptCaptcha("http://linksave.in" + url, forceUser=True) - self.html = self.load(self.pyfile.url, post={"id": id, "hash": hash, "code": value}) - def getCipherParams(self): + def handleErrors(self): + if "The visitorpassword you have entered is wrong" in self.html: + self.log.debug("%s: Incorrect password, please set right password on 'Edit package' form and retry" % self.__name__) + self.fail("Incorrect password, please set right password on 'Edit package' form and retry") + + if self.captcha: + if "Wrong code. Please retry" in self.html: + self.log.debug("%s: Invalid captcha, retrying" % self.__name__) + self.invalidCaptcha() + self.retry() + else: + self.correctCaptcha() + + def handleWebLinks(self): + package_links = [] + self.log.debug("%s: Handling Web links" % self.__name__) + + #@TODO: Gather paginated web links + pattern = r'(.*)', response)[-1] + jseval = self.js.eval("document = { write: function(e) { return e; } }; %s" % jscode) + dlLink = re.search(r'http://linksave\.in/dl-\w+', jseval).group(0) + self.log.debug("%s: JsEngine returns value [%s] for redirection link" % (self.__name__, dlLink)) + response = self.load(dlLink) + link = unescape(re.search(r'