summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-29 22:20:54 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-29 22:20:54 +0100
commit083127ffcb12e05eb95affa01a1c4e261271f1bb (patch)
tree8442c79fcc72a70b41148b46bb48dcdd8b0fe9d1
parentnew translations integrated, thanks to all translators (diff)
downloadpyload-083127ffcb12e05eb95affa01a1c4e261271f1bb.tar.xz
linksave and ncrypt working with captchas
-rw-r--r--module/plugins/Account.py2
-rw-r--r--module/plugins/Plugin.py2
-rw-r--r--module/plugins/crypter/LinkSaveIn.py16
-rw-r--r--module/plugins/crypter/NCryptIn.py42
4 files changed, 45 insertions, 17 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index 5fa7140f5..30561f126 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -86,7 +86,7 @@ class Account():
def getAccountInfo(self, name, force=False):
""" return dict with infos, do not overwrite this method! """
data = Account.loadAccountInfo(self, name)
- if force:
+ if force or not self.infos.has_key(name):
self.core.log.debug("Get %s Account Info for %s" % (self.__name__, name))
req = self.getAccountRequest(name)
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 3c0cabb54..79bc753ac 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -226,7 +226,7 @@ class Plugin(object):
content = self.load(url, get=get, post=post, cookies=cookies)
id = ("%.2f" % time())[-6:]
- temp = open(join("tmp","tmpCaptcha_%s_%s" % (id, self.__name__)), "wb")
+ temp = open(join("tmp","tmpCaptcha_%s_%s" % (self.__name__, id)), "wb")
temp.write(content)
temp.close()
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>'