summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-26 22:19:01 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-26 22:19:01 +0100
commit4a7f6177152d3c59c92291aa76fd7a36a1c8b044 (patch)
tree9796b6c6f4be98dd29dba0d9f92cc44756da8b3a /module
parentMerge branch 'stable' into 0.4.10 (diff)
parent[XFSHoster] Code improvements (diff)
downloadpyload-4a7f6177152d3c59c92291aa76fd7a36a1c8b044.tar.xz
Merge branch 'stable' into 0.4.10
Conflicts: module/PluginThread.py module/plugins/hoster/XFileSharingPro.py module/plugins/internal/CaptchaService.py pyload/api/__init__.py pyload/manager/AccountManager.py pyload/manager/AddonManager.py pyload/manager/CaptchaManager.py pyload/manager/PluginManager.py pyload/network/HTTPRequest.py pyload/network/XDCCRequest.py pyload/plugins/Plugin.py pyload/plugins/account/EasybytezCom.py pyload/plugins/crypter/C1neonCom.py pyload/plugins/crypter/CryptItCom.py pyload/plugins/crypter/DuploadOrg.py pyload/plugins/crypter/FilebeerInfo.py pyload/plugins/crypter/FilesonicCom.py pyload/plugins/crypter/FiredriveCom.py pyload/plugins/crypter/HotfileCom.py pyload/plugins/crypter/ILoadTo.py pyload/plugins/crypter/LofCc.py pyload/plugins/crypter/MBLinkInfo.py pyload/plugins/crypter/MegauploadCom.py pyload/plugins/crypter/Movie2kTo.py pyload/plugins/crypter/MultiuploadCom.py pyload/plugins/crypter/OronCom.py pyload/plugins/crypter/RSLayerCom.py pyload/plugins/crypter/SecuredIn.py pyload/plugins/crypter/SharingmatrixCom.py pyload/plugins/crypter/SpeedLoadOrg.py pyload/plugins/crypter/StealthTo.py pyload/plugins/crypter/TrailerzoneInfo.py pyload/plugins/crypter/WiiReloadedOrg.py pyload/plugins/crypter/WuploadCom.py pyload/plugins/internal/Account.py pyload/plugins/internal/Addon.py pyload/plugins/internal/BasePlugin.py pyload/plugins/internal/Container.py pyload/plugins/internal/Crypter.py pyload/plugins/internal/DeadCrypter.py pyload/plugins/internal/DeadHoster.py pyload/plugins/internal/Hoster.py pyload/plugins/internal/SimpleCrypter.py pyload/utils/__init__.py
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/XFileSharingPro.py57
-rw-r--r--module/plugins/hoster/ZShareNet.py19
-rw-r--r--module/plugins/internal/CaptchaService.py213
3 files changed, 289 insertions, 0 deletions
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
new file mode 100644
index 000000000..0acad3dba
--- /dev/null
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
+
+
+class XFileSharingPro(XFSHoster):
+ __name__ = "XFileSharingPro"
+ __type__ = "hoster"
+ __version__ = "0.43"
+
+ __pattern__ = r'^unmatchable$'
+
+ __description__ = """XFileSharingPro dummy hoster plugin for hook"""
+ __license__ = "GPLv3"
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+
+
+ URL_REPLACEMENTS = [("/embed-", "/")]
+
+
+ def _log(self, type, args):
+ msg = " | ".join([str(a).strip() for a in args if a])
+ logger = getattr(self.log, type)
+ logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
+
+
+ def init(self):
+ super(XFileSharingPro, self).init()
+
+ self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
+
+ self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower()
+ self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')])
+
+ account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME)
+
+ if account and account.canUse():
+ self.account = account
+ elif self.account:
+ self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN
+ else:
+ return
+
+ self.user, data = self.account.selectAccount()
+ self.req = self.account.getAccountRequest(self.user)
+ self.premium = self.account.isPremium(self.user)
+
+
+ def setup(self):
+ self.chunkLimit = 1
+ self.resumeDownload = self.premium
+ self.multiDL = True
+
+
+getInfo = create_getInfo(XFileSharingPro)
diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py
new file mode 100644
index 000000000..dc96facbe
--- /dev/null
+++ b/module/plugins/hoster/ZShareNet.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo
+
+
+class ZShareNet(DeadHoster):
+ __name__ = "ZShareNet"
+ __type__ = "hoster"
+ __version__ = "0.21"
+
+ __pattern__ = r'https?://(?:ww[2w]\.)?zshares?\.net/.+'
+
+ __description__ = """ZShare.net hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("espes", None),
+ ("Cptn Sandwich", None)]
+
+
+getInfo = create_getInfo(ZShareNet)
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
new file mode 100644
index 000000000..7009e6986
--- /dev/null
+++ b/module/plugins/internal/CaptchaService.py
@@ -0,0 +1,213 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from random import random
+
+
+class CaptchaService:
+ __name__ = "CaptchaService"
+ __version__ = "0.15"
+
+ __description__ = """Base captcha service plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
+
+
+ KEY_PATTERN = None
+
+ key = None #: last key detected
+
+
+ def __init__(self, plugin):
+ self.plugin = plugin
+
+
+ def detect_key(self, html=None):
+ if not html:
+ if hasattr(self.plugin, "html") and self.plugin.html:
+ html = self.plugin.html
+ else:
+ errmsg = _("%s html not found") % self.__name__
+ self.plugin.fail(errmsg) #@TODO: replace all plugin.fail(errmsg) with plugin.error(errmsg) in 0.4.10
+ raise TypeError(errmsg)
+
+ m = re.search(self.KEY_PATTERN, html)
+ if m:
+ self.key = m.group("KEY")
+ self.plugin.logDebug("%s key: %s" % (self.__name__, self.key))
+ return self.key
+ else:
+ self.plugin.logDebug("%s key not found" % self.__name__)
+ return None
+
+
+ def challenge(self, key=None):
+ raise NotImplementedError
+
+
+ def result(self, server, challenge):
+ raise NotImplementedError
+
+
+class ReCaptcha(CaptchaService):
+ __name__ = "ReCaptcha"
+ __version__ = "0.08"
+
+ __description__ = """ReCaptcha captcha service plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
+
+
+ KEY_PATTERN = r'recaptcha(/api|\.net)/(challenge|noscript)\?k=(?P<KEY>[\w-]+)'
+ KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\'](?P<KEY>[\w-]+)'
+
+
+ def detect_key(self, html=None):
+ if not html:
+ if hasattr(self.plugin, "html") and self.plugin.html:
+ html = self.plugin.html
+ else:
+ errmsg = _("ReCaptcha html not found")
+ self.plugin.fail(errmsg)
+ raise TypeError(errmsg)
+
+ m = re.search(self.KEY_PATTERN, html) or re.search(self.KEY_AJAX_PATTERN, html)
+ if m:
+ self.key = m.group("KEY")
+ self.plugin.logDebug("ReCaptcha key: %s" % self.key)
+ return self.key
+ else:
+ self.plugin.logDebug("ReCaptcha key not found")
+ return None
+
+
+ def challenge(self, key=None):
+ if not key:
+ if self.detect_key():
+ key = self.key
+ else:
+ errmsg = _("ReCaptcha key not found")
+ self.plugin.fail(errmsg)
+ raise TypeError(errmsg)
+
+ js = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key})
+ try:
+ challenge = re.search("challenge : '(.+?)',", js).group(1)
+ server = re.search("server : '(.+?)',", js).group(1)
+ except:
+ self.plugin.error("ReCaptcha challenge pattern not found")
+
+ result = self.result(server, challenge)
+
+ self.plugin.logDebug("ReCaptcha result: %s" % result, "challenge: %s" % challenge)
+
+ return challenge, result
+
+
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha("%simage" % server, get={'c': challenge},
+ cookies=True, forceUser=True, imgtype="jpg")
+
+
+class AdsCaptcha(CaptchaService):
+ __name__ = "AdsCaptcha"
+ __version__ = "0.05"
+
+ __description__ = """AdsCaptcha captcha service plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
+
+
+ ID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(?P<ID>\d+)'
+ KEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=(?P<KEY>[\w-]+)'
+
+
+ def detect_key(self, html=None):
+ if not html:
+ if hasattr(self.plugin, "html") and self.plugin.html:
+ html = self.plugin.html
+ else:
+ errmsg = _("AdsCaptcha html not found")
+ self.plugin.fail(errmsg)
+ raise TypeError(errmsg)
+
+ m = re.search(self.ID_PATTERN, html)
+ n = re.search(self.KEY_PATTERN, html)
+ if m and n:
+ self.key = (m.group("ID"), m.group("KEY"))
+ self.plugin.logDebug("AdsCaptcha id|key: %s | %s" % self.key)
+ return self.key
+ else:
+ self.plugin.logDebug("AdsCaptcha id or key not found")
+ return None
+
+
+ def challenge(self, key=None): #: key is a tuple(CaptchaId, PublicKey)
+ if not key:
+ if self.detect_key():
+ key = self.key
+ else:
+ errmsg = _("AdsCaptcha key not found")
+ self.plugin.fail(errmsg)
+ raise TypeError(errmsg)
+
+ CaptchaId, PublicKey = key
+
+ js = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey})
+ try:
+ challenge = re.search("challenge: '(.+?)',", js).group(1)
+ server = re.search("server: '(.+?)',", js).group(1)
+ except:
+ self.plugin.error("AdsCaptcha challenge pattern not found")
+
+ result = self.result(server, challenge)
+
+ self.plugin.logDebug("AdsCaptcha result: %s" % result, "challenge: %s" % challenge)
+
+ return challenge, result
+
+
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={'cid': challenge, 'dummy': random()},
+ cookies=True, imgtype="jpg")
+
+
+class SolveMedia(CaptchaService):
+ __name__ = "SolveMedia"
+ __version__ = "0.06"
+
+ __description__ = """SolveMedia captcha service plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("pyLoad Team", "admin@pyload.org")]
+
+
+ KEY_PATTERN = r'api\.solvemedia\.com/papi/challenge\.(no)?script\?k=(?P<KEY>.+?)["\']'
+
+
+ def challenge(self, key=None):
+ if not key:
+ if self.detect_key():
+ key = self.key
+ else:
+ errmsg = _("SolveMedia key not found")
+ self.plugin.fail(errmsg)
+ raise TypeError(errmsg)
+
+ html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key})
+ try:
+ challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">',
+ html).group(1)
+ server = "http://api.solvemedia.com/papi/media"
+ except:
+ self.plugin.error("SolveMedia challenge pattern not found")
+
+ result = self.result(server, challenge)
+
+ self.plugin.logDebug("SolveMedia result: %s" % result, "challenge: %s" % challenge)
+
+ return challenge, result
+
+
+ def result(self, server, challenge):
+ return self.plugin.decryptCaptcha(server, get={'c': challenge}, imgtype="gif")