diff options
Diffstat (limited to 'module/plugins/internal/Captcha.py')
-rw-r--r-- | module/plugins/internal/Captcha.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py new file mode 100644 index 000000000..b4af46493 --- /dev/null +++ b/module/plugins/internal/Captcha.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Plugin import Base + + +#@TODO: Extend (new) Plugin class; remove all `html` args +class Captcha(Base): + __name__ = "Captcha" + __type__ = "captcha" + __version__ = "0.29" + + __description__ = """Base captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + key = None #: last key detected + + + def __init__(self, plugin): + self.plugin = plugin + super(Captcha, self).__init__(plugin.core) + + + #@TODO: Recheck in 0.4.10 + def fail(self, reason): + self.plugin.fail(reason) + raise AttributeError(reason) + + + #@TODO: Recheck in 0.4.10 + def retrieve_key(self, html): + if self.detect_key(html): + return self.key + else: + self.fail(_("%s key not found") % self.__name__) + + + #@TODO: Recheck in 0.4.10 + def retrieve_html(self): + if hasattr(self.plugin, "html") and self.plugin.html: + return self.plugin.html + else: + self.fail(_("%s html not found") % self.__name__) + + + def detect_key(self, html=None): + raise NotImplementedError + + + def challenge(self, key=None, html=None): + raise NotImplementedError + + + def result(self, server, challenge): + raise NotImplementedError |