summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Plugin.py2
-rw-r--r--module/plugins/ReCaptcha.py19
-rw-r--r--module/plugins/crypter/LofCc.py47
-rw-r--r--module/plugins/hooks/UnRar.py1
4 files changed, 68 insertions, 1 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 02a15dfbc..f64a5defb 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -202,7 +202,7 @@ class Plugin(object):
Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__)
- if Ocr or not forceUser:
+ if Ocr and not forceUser:
sleep(randint(3000, 5000) / 1000.0)
if self.pyfile.abort: raise Abort
diff --git a/module/plugins/ReCaptcha.py b/module/plugins/ReCaptcha.py
new file mode 100644
index 000000000..23e1064ce
--- /dev/null
+++ b/module/plugins/ReCaptcha.py
@@ -0,0 +1,19 @@
+import re
+
+class ReCaptcha():
+ def __init__(self, plugin):
+ self.plugin = plugin
+
+ def challenge(self, id):
+ js = self.plugin.req.load("http://api.recaptcha.net/challenge", get={"k":id}, cookies=True)
+ print js
+ challenge = re.search("challenge : '(.*?)',", js).group(1)
+ server = re.search("server : '(.*?)',", js).group(1)
+ try:
+ challenge = re.search("challenge : '(.*?)',", js).group(1)
+ server = re.search("server : '(.*?)',", js).group(1)
+ except:
+ self.plugin.fail("recaptcha error")
+ result = self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True)
+
+ return challenge, result
diff --git a/module/plugins/crypter/LofCc.py b/module/plugins/crypter/LofCc.py
new file mode 100644
index 000000000..cd3a6fe4d
--- /dev/null
+++ b/module/plugins/crypter/LofCc.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+from time import sleep
+from os.path import join
+
+from module.plugins.Crypter import Crypter
+from module.plugins.ReCaptcha import ReCaptcha
+
+class LofCc(Crypter):
+ __name__ = "LofCc"
+ __type__ = "container"
+ __pattern__ = r"http://lof.cc/(.*)"
+ __version__ = "0.1"
+ __description__ = """lof.cc Plugin"""
+ __author_name__ = ("mkaay")
+ __author_mail__ = ("mkaay@mkaay.de")
+
+ def setup(self):
+ self.multiDL = False
+
+ def decrypt(self, pyfile):
+ html = self.req.load(self.pyfile.url, cookies=True)
+
+ m = re.search(r"src=\"http://api.recaptcha.net/challenge\?k=(.*?)\"></script>", html)
+ if not m:
+ self.offline()
+
+ recaptcha = ReCaptcha(self)
+ challenge, code = recaptcha.challenge(m.group(1))
+
+ resultHTML = self.req.load(self.pyfile.url, post={"recaptcha_challenge_field":challenge, "recaptcha_response_field":code}, cookies=True)
+
+ if re.search("class=\"error\"", resultHTML):
+ self.retry()
+
+ dlc = self.req.load(self.pyfile.url+"/dlc", cookies=True)
+
+ name = re.search(self.__pattern__, self.pyfile.url).group(1)+".dlc"
+
+ dlcFile = join(self.config["general"]["download_folder"], name)
+ f = open(dlcFile, "wb")
+ f.write(dlc)
+ f.close()
+
+ self.packages.append((self.pyfile.package().name, [dlcFile], self.pyfile.package().folder))
diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py
index 30cda62af..38a5a55e8 100644
--- a/module/plugins/hooks/UnRar.py
+++ b/module/plugins/hooks/UnRar.py
@@ -121,4 +121,5 @@ class UnRar(Hook):
self.removeFiles(pack, fname)
finally:
pyfile.alternativePercent = None
+ pyfile.setStatus("finished")