From 29f9dc8fb3396b03d732ebcbeb1cc8f00fe13897 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 25 Aug 2010 18:22:27 +0200 Subject: new dirs --- module/plugins/ReCaptcha.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 module/plugins/ReCaptcha.py (limited to 'module/plugins/ReCaptcha.py') diff --git a/module/plugins/ReCaptcha.py b/module/plugins/ReCaptcha.py new file mode 100644 index 000000000..d29530a64 --- /dev/null +++ b/module/plugins/ReCaptcha.py @@ -0,0 +1,17 @@ +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) + + 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 -- cgit v1.2.3