From 81508f295cffc40c479fe72f24bdf1dbbedf5d92 Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 5 May 2010 23:03:43 +0200 Subject: refactored plugins, new plugin manager --- module/plugins/Container.py | 29 +++ module/plugins/Crypter.py | 28 +++ module/plugins/Hook.py | 16 +- module/plugins/Hoster.py | 29 +++ module/plugins/Plugin.py | 29 ++- module/plugins/container/CCF.py | 21 +- module/plugins/container/LinkList.py | 21 +- module/plugins/container/RSDF.py | 21 +- module/plugins/crypter/DDLMusicOrg.py | 56 +++++ module/plugins/crypter/FourChanOrg.py | 39 ++++ module/plugins/crypter/HoerbuchIn.py | 46 ++++ module/plugins/crypter/LixIn.py | 34 +++ module/plugins/crypter/OneKhDe.py | 36 +++ module/plugins/crypter/RSLayerCom.py | 37 +++ module/plugins/crypter/RelinkUs.py | 58 +++++ module/plugins/crypter/SecuredIn.py | 334 ++++++++++++++++++++++++++ module/plugins/crypter/SerienjunkiesOrg.py | 217 +++++++++++++++++ module/plugins/crypter/StealthTo.py | 45 ++++ module/plugins/crypter/YoutubeChannel.py | 52 +++++ module/plugins/crypter/__init__.py | 0 module/plugins/decrypter/DDLMusicOrg.py | 58 ----- module/plugins/decrypter/FourChanOrg.py | 41 ---- module/plugins/decrypter/HoerbuchIn.py | 48 ---- module/plugins/decrypter/LixIn.py | 36 --- module/plugins/decrypter/OneKhDe.py | 38 --- module/plugins/decrypter/RSLayerCom.py | 39 ---- module/plugins/decrypter/RelinkUs.py | 60 ----- module/plugins/decrypter/SecuredIn.py | 335 --------------------------- module/plugins/decrypter/SerienjunkiesOrg.py | 217 ----------------- module/plugins/decrypter/StealthTo.py | 47 ---- module/plugins/decrypter/YoutubeChannel.py | 54 ----- module/plugins/decrypter/__init__.py | 0 module/plugins/hooks/ClickAndLoad.py | 14 +- module/plugins/hooks/ContainerDownload.py | 14 +- module/plugins/hooks/ExternalScripts.py | 14 +- module/plugins/hooks/LinuxFileEvents.py | 11 +- module/plugins/hoster/DepositfilesCom.py | 22 +- module/plugins/hoster/DuckloadCom.py | 22 +- module/plugins/hoster/FilefactoryCom.py | 22 +- module/plugins/hoster/FilesmonsterCom.py | 24 +- module/plugins/hoster/FreakshareNet.py | 22 +- module/plugins/hoster/GigasizeCom.py | 22 +- module/plugins/hoster/HotfileCom.py | 22 +- module/plugins/hoster/MegauploadCom.py | 22 +- module/plugins/hoster/MegavideoCom.py | 23 +- module/plugins/hoster/MyvideoDe.py | 23 +- module/plugins/hoster/NetloadIn.py | 22 +- module/plugins/hoster/RapidshareCom.py | 22 +- module/plugins/hoster/ShareonlineBiz.py | 22 +- module/plugins/hoster/ShragleCom.py | 22 +- module/plugins/hoster/StorageTo.py | 21 +- module/plugins/hoster/UploadedTo.py | 22 +- module/plugins/hoster/XupIn.py | 22 +- module/plugins/hoster/YoupornCom.py | 22 +- module/plugins/hoster/YoutubeCom.py | 22 +- module/plugins/hoster/ZippyshareCom.py | 22 +- module/plugins/hoster/ZshareNet.py | 22 +- 57 files changed, 1322 insertions(+), 1317 deletions(-) create mode 100644 module/plugins/Container.py create mode 100644 module/plugins/Crypter.py create mode 100644 module/plugins/Hoster.py create mode 100644 module/plugins/crypter/DDLMusicOrg.py create mode 100644 module/plugins/crypter/FourChanOrg.py create mode 100644 module/plugins/crypter/HoerbuchIn.py create mode 100644 module/plugins/crypter/LixIn.py create mode 100644 module/plugins/crypter/OneKhDe.py create mode 100644 module/plugins/crypter/RSLayerCom.py create mode 100644 module/plugins/crypter/RelinkUs.py create mode 100644 module/plugins/crypter/SecuredIn.py create mode 100644 module/plugins/crypter/SerienjunkiesOrg.py create mode 100644 module/plugins/crypter/StealthTo.py create mode 100644 module/plugins/crypter/YoutubeChannel.py create mode 100644 module/plugins/crypter/__init__.py delete mode 100644 module/plugins/decrypter/DDLMusicOrg.py delete mode 100644 module/plugins/decrypter/FourChanOrg.py delete mode 100644 module/plugins/decrypter/HoerbuchIn.py delete mode 100644 module/plugins/decrypter/LixIn.py delete mode 100644 module/plugins/decrypter/OneKhDe.py delete mode 100644 module/plugins/decrypter/RSLayerCom.py delete mode 100644 module/plugins/decrypter/RelinkUs.py delete mode 100644 module/plugins/decrypter/SecuredIn.py delete mode 100644 module/plugins/decrypter/SerienjunkiesOrg.py delete mode 100644 module/plugins/decrypter/StealthTo.py delete mode 100644 module/plugins/decrypter/YoutubeChannel.py delete mode 100644 module/plugins/decrypter/__init__.py (limited to 'module/plugins') diff --git a/module/plugins/Container.py b/module/plugins/Container.py new file mode 100644 index 000000000..2a7196f14 --- /dev/null +++ b/module/plugins/Container.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay +""" + +from module.plugins.Plugin import Plugin + +class Container(Plugin): + __name__ = "Container" + __version__ = "0.1" + __pattern__ = None + __type__ = "container" + __description__ = """Base container plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py new file mode 100644 index 000000000..31ea43262 --- /dev/null +++ b/module/plugins/Crypter.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay +""" + +from module.plugins.Plugin import Plugin + +class Crypter(Plugin): + __version__ = "0.1" + __pattern__ = None + __type__ = "container" + __description__ = """Base crypter plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 4a385c417..81188c147 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -22,22 +22,22 @@ import logging class Hook(): + __name__ = "Hook" + __version__ = "0.2" + __type__ = "hook" + __description__ = """interface for hook""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") + def __init__(self, core): self.logger = logging.getLogger("log") self.configParser = core.parser_plugins self.config = {} - props = {} - props['name'] = "Hook" - props['version'] = "0.2" - props['description'] = """interface for hook""" - props['author_name'] = ("mkaay") - props['author_mail'] = ("mkaay@mkaay.de") - self.props = props self.core = core def readConfig(self): self.configParser.loadData() - section = self.props['name'] + section = self.__name__ try: self.config = self.configParser.getConfig()[section] except: diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py new file mode 100644 index 000000000..0ed528924 --- /dev/null +++ b/module/plugins/Hoster.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay +""" + +from module.plugins.Plugin import Plugin + +class Hoster(Plugin): + __name__ = "Hoster" + __version__ = "0.1" + __pattern__ = None + __type__ = "hoster" + __description__ = """Base hoster plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index c4ac8ee12..107c4f0ca 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -32,19 +32,17 @@ from os import makedirs from module.DownloadThread import CaptchaError class Plugin(): - + __name__ = "Plugin" + __version__ = "0.4" + __pattern__ = None + __type__ = "hoster" + __description__ = """Base Plugin""" + __author_name__ = ("RaNaN", "spoob", "mkaay") + __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") + def __init__(self, parent): self.configparser = parent.core.parser_plugins self.config = {} - props = {} - props['name'] = "BasePlugin" - props['version'] = "0.3" - props['pattern'] = None - props['type'] = "hoster" - props['description'] = """Base Plugin""" - props['author_name'] = ("RaNaN", "spoob", "mkaay") - props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") - self.props = props self.parent = parent self.req = Request() self.html = 0 @@ -115,20 +113,20 @@ class Plugin(): def set_config(self): for k, v in self.config.items(): - self.configparser.set(self.props['name'], {"option": k}, v) + self.configparser.set(self.__name__, {"option": k}, v) def remove_config(self, option): - self.configparser.remove(self.props['name'], option) + self.configparser.remove(self.__name__, option) def get_config(self, value, default=None): self.configparser.loadData() - return self.configparser.get(self.props['name'], value, default=default) + return self.configparser.get(self.__name__, value, default=default) def read_config(self): self.configparser.loadData() try: self.verify_config() - self.config = self.configparser.getConfig()[self.props['name']] + self.config = self.configparser.getConfig()[self.__name__] except: pass @@ -136,8 +134,7 @@ class Plugin(): pass def init_ocr(self): - modul = __import__("module.plugins.captcha." + self.props['name'], fromlist=['captcha']) - captchaClass = getattr(modul, self.props['name']) + captchaClass = self.core.pluginManager.getCaptchaPlugin(self.__name__) self.ocr = captchaClass() def __call__(self): diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index 9d7116900..1e25ef623 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -5,22 +5,19 @@ import re import tempfile import urllib2 -from module.plugins.Plugin import Plugin +from module.plugins.Container import Container from module.network.MultipartPostHandler import MultipartPostHandler -class CCF(Plugin): +class CCF(Container): + __name__ = "CCF" + __version__ = "0.1" + __pattern__ = r"(?!http://).*\.ccf" + __description__ = """CCF Container Convert Plugin""" + __author_name__ = ("Willnix") + __author_mail__ = ("Willnix@pyload.org") def __init__(self, parent): - Plugin.__init__(self, parent) - props = {} - props['name'] = "CCF" - props['type'] = "container" - props['pattern'] = r"(?!http://).*\.ccf" - props['version'] = "0.1" - props['description'] = """CCF Container Convert Plugin""" - props['author_name'] = ("Willnix") - props['author_mail'] = ("Willnix@pyload.org") - self.props = props + Container.__init__(self, parent) self.parent = parent self.multi_dl = True self.links = [] diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index b45ab83d0..cadf491a9 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -2,21 +2,18 @@ # -*- coding: utf-8 -*- -from module.plugins.Plugin import Plugin +from module.plugins.Container import Container -class LinkList(Plugin): +class LinkList(Container): + __name__ = "LinkList" + __version__ = "0.1" + __pattern__ = r"(?!http://).*\.txt" + __description__ = """Read Link Lists in txt format""" + __author_name__ = ("spoob") + __author_mail__ = ("spoob@pyload.org") def __init__(self, parent): - Plugin.__init__(self, parent) - props = {} - props['name'] = "LinkList" - props['type'] = "container" - props['pattern'] = r"(?!http://).*\.txt" - props['version'] = "0.1" - props['description'] = """Read Link Lists in txt format""" - props['author_name'] = ("Spoob") - props['author_mail'] = ("spoob@pyload.org") - self.props = props + Container.__init__(self, parent) self.parent = parent self.html = None self.read_config() diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py index 9604495fd..c906fe05a 100644 --- a/module/plugins/container/RSDF.py +++ b/module/plugins/container/RSDF.py @@ -4,21 +4,18 @@ import base64 import binascii -from module.plugins.Plugin import Plugin +from module.plugins.Container import Container -class RSDF(Plugin): +class RSDF(Container): + __name__ = "RSDF" + __version__ = "0.2" + __pattern__ = r"(?!http://).*\.rsdf" + __description__ = """RSDF Container Decode Plugin""" + __author_name__ = ("RaNaN", "spoob") + __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") def __init__(self, parent): - Plugin.__init__(self, parent) - props = {} - props['name'] = "RSDF" - props['type'] = "container" - props['pattern'] = r"(?!http://).*\.rsdf" - props['version'] = "0.2" - props['description'] = """RSDF Container Decode Plugin""" - props['author_name'] = ("RaNaN", "spoob") - props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org") - self.props = props + Container.__init__(self, parent) self.parent = parent self.multi_dl = True self.links = [] diff --git a/module/plugins/crypter/DDLMusicOrg.py b/module/plugins/crypter/DDLMusicOrg.py new file mode 100644 index 000000000..1c5632cda --- /dev/null +++ b/module/plugins/crypter/DDLMusicOrg.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import sleep + +from module.plugins.Crypter import Crypter + +class DDLMusicOrg(Crypter): + __name__ = "DDLMusicOrg" + __type__ = "container" + __pattern__ = r"http://[\w\.]*?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+" + __version__ = "0.1" + __description__ = """ddl-music.org Container Plugin""" + __author_name__ = ("mkaay") + __author_mail__ = ("mkaay@mkaay.de") + + def __init__(self, parent): + Crypter.__init__(self, parent) + self.parent = parent + self.html = None + self.multi_dl = False + + def download_html(self): + url = self.parent.url + self.html = self.req.load(url, cookies=True) + + def file_exists(self): + """ returns True or False + """ + if not self.html: + self.download_html() + if re.search(r"Wer dies nicht rechnen kann", self.html) != None: + return True + return False + + def proceed(self, url, location): + for i in range(5): + self.download_html() + posturl = re.search(r"id=\"captcha\" action=\"(/captcha/ddlm_cr\d\.php)\"", self.html).group(1) + math = re.search(r"(\d+) ([\+-]) (\d+) =\s+", htmlwithlink) + if m: + self.links = [m.group(1)] + return + self.links = False diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py new file mode 100644 index 000000000..cbcdd920c --- /dev/null +++ b/module/plugins/crypter/FourChanOrg.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class FourChanOrg(Crypter): + __name__ = "FourChanOrg" + __type__ = "container" + __pattern__ = r"http://(www\.)?(img\.)?(zip\.)?4chan.org/\w+/(res/|imgboard\.html)" + __version__ = "0.1" + __description__ = """4chan.org Thread Download Plugin""" + __author_name__ = ("Spoob") + __author_mail__ = ("Spoob@pyload.org") + + def __init__(self, parent): + Crypter.__init__(self, parent) + self.parent = parent + self.html = None + + def file_exists(self): + """ returns True or False + """ + return True + + def proceed(self, url, location): + url = self.parent.url + html = self.req.load(url) + link_pattern = "" + temp_links = [] + if "imagebord.html" in url: + link_pattern = '[Reply]' + temp_links = re.findall(link_pattern, html) + for link in re.findall(link_pattern, html): + temp_links.append(link) + else: + temp_links = re.findall('File : " + container + ":(.*?)
", self.html).group(1) + tmp = re.findall('
Part \d+', download_content) + if tmp == []: continue + for link in tmp: + link_html = self.req.load(link, cookies=True) + temp_links.append(re.search('