diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-29 22:20:54 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-29 22:20:54 +0100 |
commit | 083127ffcb12e05eb95affa01a1c4e261271f1bb (patch) | |
tree | 8442c79fcc72a70b41148b46bb48dcdd8b0fe9d1 /module/plugins/crypter | |
parent | new translations integrated, thanks to all translators (diff) | |
download | pyload-083127ffcb12e05eb95affa01a1c4e261271f1bb.tar.xz |
linksave and ncrypt working with captchas
Diffstat (limited to 'module/plugins/crypter')
-rw-r--r-- | module/plugins/crypter/LinkSaveIn.py | 16 | ||||
-rw-r--r-- | module/plugins/crypter/NCryptIn.py | 42 |
2 files changed, 43 insertions, 15 deletions
diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index c9621d658..2497b3693 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -26,6 +26,8 @@ class LinkSaveIn(Crypter): if not self.fileExists():
self.offline()
+ self.checkCaptcha()
+
# Get package name and folder
(package_name, folder_name) = self.getPackageNameAndFolder()
@@ -87,4 +89,16 @@ class LinkSaveIn(Crypter): # Log and return
self.log.debug("LinkSaveIn: Package has %d links" % len(links))
- return links
\ No newline at end of file + return links
+
+ def checkCaptcha(self):
+
+ if "<b>Captcha:</b>" 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})
\ No newline at end of file diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 419c7f388..edee30f46 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -34,10 +34,8 @@ class NCryptIn(Crypter): 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 Edit package form and retry")
+ if self.isProtected():
+ self.html = self.submitProtection()
# Get package name and folder
(package_name, folder_name) = self.getPackageInfo()
@@ -60,36 +58,52 @@ class NCryptIn(Crypter): return False
return True
- def isPasswordProtected(self):
+ def isProtected(self):
p1 = r'''<form.*?name.*?protected.*?>'''
p2 = r'''<input.*?name.*?password.*?>'''
m1 = re.search(p1, self.html)
- m2 = re.search(p2, self.html)
+ m2 = re.search(p2, self.html)
+
+ captcha = False
+ if "<!-- CAPTCHA PROTECTED -->" in self.html:
+ captcha = True
- if m1 is not None and m2 is not None:
- self.log.debug("NCryptIn: Links are password protected")
+ if m1 is not None and m2 is not None or captcha:
+ self.log.debug("NCryptIn: Links are protected")
return True
return False
def requestPackage(self):
return self.load(self.pyfile.url)
- def submitPassword(self):
+ def submitProtection(self):
# Gather data
password = self.package.password
+
+ post = {}
+
+
+ if "<!-- CAPTCHA PROTECTED -->" in self.html:
+ url = re.search(r'src="(/temp/anicaptcha/[^"]+)', self.html).group(1)
+ print url
+ captcha = self.decryptCaptcha("http://ncrypt.in"+ url)
+ post.update({"captcha" : captcha})
+
- # Submit package password
+ # Submit package password and captcha
url = self.pyfile.url
- post = { 'submit_protected' : 'Weiter zum Ordner', 'password' : password }
+ post.update({ 'submit_protected' : 'Weiter zum Ordner', 'password' : password })
self.log.debug("NCryptIn: Submitting password [%s] for protected links" % (password,))
html = self.load(url, {}, post)
# Check for invalid password
if "This password is invalid!" in html:
self.log.debug("NCryptIn: Incorrect password, please set right password on Add package form and retry")
- return None
- else:
- return html
+ self.fail("Incorrect password, please set right password on Edit package form and retry")
+ if "The securitycheck was wrong!" in html:
+ return self.submitProtection()
+
+ return html
def getPackageInfo(self):
title_re = r'<h2><span.*?class="arrow".*?>(?P<title>[^<]+).*?</span>.*?</h2>'
|