From c25be987a3a8d536b8323455828b83f66870d81d Mon Sep 17 00:00:00 2001 From: godofdream Date: Mon, 6 Aug 2012 17:48:55 +0200 Subject: update Freakshare, IcyFiles, Zippyshare, C1neon, FshareVn-Ac, Filefactory-Ac Added BypassCaptcha - closed #647, #615, #639, #644, #562, #586, #642 --- module/plugins/accounts/FilefactoryCom.py | 6 +- module/plugins/accounts/FshareVn.py | 10 +- module/plugins/crypter/C1neonCom.py | 9 +- module/plugins/hooks/BypassCaptcha.py | 167 ++++++++++++++++++++++++++++++ module/plugins/hoster/FreakshareCom.py | 10 +- module/plugins/hoster/IcyFilesCom.py | 4 +- module/plugins/hoster/ZippyshareCom.py | 29 +++++- 7 files changed, 215 insertions(+), 20 deletions(-) create mode 100644 module/plugins/hooks/BypassCaptcha.py (limited to 'module') diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 73431b546..356c5d22a 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -23,13 +23,13 @@ from time import mktime, strptime class FilefactoryCom(Account): __name__ = "FilefactoryCom" - __version__ = "0.11" + __version__ = "0.12" __type__ = "account" __description__ = """filefactory.com account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - ACCOUNT_INFO_PATTERN = r'"greenText">Premium member until<.*?datetime="(.*?)"' + ACCOUNT_INFO_PATTERN = r'.*?datetime="(.*?)"' def loadAccountInfo(self, user, req): html = req.load("http://www.filefactory.com/member/") @@ -51,4 +51,4 @@ class FilefactoryCom(Account): "redirect": "/"}) if '/member/login.php?err=1' in req.http.header: - self.wrongPassword() \ No newline at end of file + self.wrongPassword() diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 46d2d5166..e51009f50 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -24,7 +24,7 @@ import re class FshareVn(Account): __name__ = "FshareVn" - __version__ = "0.01" + __version__ = "0.02" __type__ = "account" __description__ = """fshare.vn account plugin""" __author_name__ = ("zoidberg") @@ -47,13 +47,13 @@ class FshareVn(Account): return {"validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://www.fshare.vn/login.php") + req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - html = req.load('http://www.fshare.vn/login.php', post = { + html = req.load('https://www.fshare.vn/login.php', post = { "login_password" : data['password'], "login_useremail" : user, - "url_refe" : "http://www.fshare.vn/login.php" + "url_refe" : "https://www.fshare.vn/login.php" }, referer = True, decode = True) if not 'VIP. + + @author: RaNaN +""" + +import base64 + +try: + from json import loads +except ImportError: + from simplejson import loads + +from thread import start_new_thread +from pycurl import FORM_FILE, LOW_SPEED_TIME + +from module.network.RequestFactory import getURL, getRequest +from module.network.HTTPRequest import BadHeader + +from module.plugins.Addon import Addon + +class BypassCaptchaException(Exception): + def __init__(self, err): + self.err = err + + def getCode(self): + return self.err + + def __str__(self): + return "" % self.err + + def __repr__(self): + return "" % self.err + +class BypassCaptcha(Addon): + __name__ = "BypassCaptcha" + __version__ = "0.01" + __description__ = """send captchas to bypasscaptcha.com""" + __config__ = [("activated", "bool", "Activated", True), + ("key", "str", "Key", ""), + ("force", "bool", "Force CT even if client is connected", False), + __author_name__ = ("RaNaN") + __author_mail__ = ("RaNaN@pyload.org") + + SUBMIT_URL = "http://bypasscaptcha.com/upload.php" + RESPOND_URL = "http://bypasscaptcha.com/check_value.php" + GETCREDITS_URL = "http://bypasscaptcha.com/ex_left.php" + + def setup(self): + self.info = {} + + def getCredits(self): + json = getURL(BypassCaptcha.GETCREDITS_URL % {"key": self.getConfig("key")}) + response = loads(json) + if response[0] < 0: + raise BypassCaptchaException(response[1]) + else: + self.logInfo(_("%s credits left") % response['Left']) + self.info["credits"] = response['Left'] + return response['Left'] + + def submit(self, captcha, captchaType="file", match=None): + #if type(captcha) == str and captchaType == "file": + # raise BypassCaptchaException("Invalid Type") + assert captchaType in ("file", "url-jpg", "url-jpeg", "url-png", "url-bmp") + + self.logInfo(_("submitting %s, type %s") % (captcha, captchaType)) + + req = getRequest() + + #raise timeout threshold + req.c.setopt(LOW_SPEED_TIME, 80) + + try: + img = Image.open(captcha) + self.logDebug("CAPTCHA IMAGE", img, img.format) + output = StringIO.StringIO() + img.save(output, "JPEG") + data = base64.b64encode(output.getvalue()) + output.close() + except Exception, e: + raise BypassCaptchaException("Reading or converting captcha image failed: %s" % e) + + try: + json = req.load(BypassCaptcha.SUBMIT_URL, post={"key": self.getConfig("key"), + "password": self.getConfig("passkey"), + "file": data, + "submit": "Submit", + "gen_task_id": 1, + "base64_code": 1}) + finally: + req.close() + + response = loads(json) + if response[0] < 0: + raise BypassCaptchaException(response[1]) + + ticket = response['TaskId'] + result = response['Value'] + self.logDebug("result %s : %s" % (ticket,result)) + + return ticket, result + + def respond(self, ticket, success): + try: + json = getURL(BypassCaptcha.RESPOND_URL, post={ "key": self.getConfig("key"), + "task_id": ticket, + "cv": 1 if success else 0, + "submit": "Submit" }) + + response = loads(json) + if response[0] < 0: + raise BypassCaptchaException(response[1]) + + except BadHeader, e: + self.logError(_("Could not send response."), str(e)) + + def newCaptchaTask(self, task): + if not task.isTextual(): + return False + + if not self.getConfig("key"): + return False + + if self.core.isClientConnected() and not self.getConfig("force"): + return False + + if self.getCredits() > 0: + task.handler.append(self) + task.setWaiting(100) + start_new_thread(self.processCaptcha, (task,)) + + else: + self.logInfo(_("Your BypassCaptcha Account has not enough credits")) + + def captchaCorrect(self, task): + if "TaskId" in task.data: + ticket = task.data["TaskId"] + self.respond(ticket, True) + + def captchaInvalid(self, task): + if "TaskId" in task.data: + ticket = task.data["TaskId"] + self.respond(ticket, False) + + def processCaptcha(self, task): + c = task.captchaFile + try: + ticket, result = self.submit(c) + except BypassCaptchaException, e: + task.error = e.getCode() + return + + task.data["ticket"] = ticket + task.setResult(result) \ No newline at end of file diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 29a0bda8f..56e02cbdc 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -9,7 +9,7 @@ class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/" - __version__ = "0.36" + __version__ = "0.37" __description__ = """Freakshare.com Download Hoster""" __author_name__ = ("sitacuisses","spoob","mkaay", "Toilal") __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de", "toilal.dev@gmail.com") @@ -39,7 +39,8 @@ class FreakshareCom(Hoster): check = self.checkDownload({"bad": "bad try", "paralell": "> Sorry, you cant download more then 1 files at time. <", - "empty": "Warning: Unknown: Filename cannot be empty"}) + "empty": "Warning: Unknown: Filename cannot be empty", + "wrong_captcha": "Wrong Captcha!"}) if check == "bad": self.fail("Bad Try.") @@ -48,7 +49,10 @@ class FreakshareCom(Hoster): self.wait() self.retry() if check == "empty": - self.fail("File not downloadable") + self.fail("File not downloadable") + if check == "wrong_captcha": + self.invalidCaptcha() + self.retry() def prepare(self): pyfile = self.pyfile diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 73dd5f7c9..09458732e 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -33,7 +33,7 @@ def getInfo(urls): size = re.search(IcyFilesCom.SIZE_PATTERN, html) if name is not None: name = name.group(1) - size = (size.group(1) * 1000000) + size = (int(size.group(1)) * 1000000) result.append((name, size, 2, url)) yield result @@ -42,7 +42,7 @@ class IcyFilesCom(Hoster): __name__ = "IcyFilesCom" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?icyfiles\.com/.*" - __version__ = "0.02" + __version__ = "0.03" __description__ = """IcyFiles.com plugin - free only""" __author_name__ = ("godofdream") __author_mail__ = ("soilfiction@gmail.com") diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 0dde85e2c..001e2b296 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -10,7 +10,7 @@ class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" __pattern__ = r"(?Phttp://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P\d+)" - __version__ = "0.33" + __version__ = "0.35" __description__ = """Zippyshare.com Download Hoster""" __author_name__ = ("spoob", "zoidberg") __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz") @@ -100,8 +100,29 @@ class ZippyshareCom(SimpleHoster): try: swf_data = self.load(swf_url) os.write(fd, swf_data) - - p = subprocess.Popen(['swfdump', '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + # used for detecting if swfdump is instelled + def is_exe(ppath): + return os.path.isfile(ppath) and os.access(ppath, os.X_OK) + + program = 'swfdump' + swfdump = None + ppath, pname = os.path.split(program) + if ppath: + if is_exe(program): + swfdump = program + else: + for ppath in os.environ["PATH"].split(os.pathsep): + exe_file = os.path.join(ppath, program) + if is_exe(exe_file): + swfdump = exe_file + if swfdump is None: + self.fail("swfdump missing - install swftools") + # ok swfdump is installed move on... + + + + p = subprocess.Popen([swfdump, '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() if err: @@ -151,4 +172,4 @@ class ZippyshareCom(SimpleHoster): return url -getInfo = create_getInfo(ZippyshareCom) \ No newline at end of file +getInfo = create_getInfo(ZippyshareCom) -- cgit v1.2.3