예제 #1
0
    def handle_captcha(self):
        solvemedia  = SolveMedia(self.pyfile)
        captcha_key = solvemedia.detect_key()

        if captcha_key:
            self.captcha = solvemedia
            response, challenge = solvemedia.challenge(captcha_key)
            self.data = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'],
                                  post={'adcopy_challenge': challenge,
                                        'adcopy_response' : response})
            return

        recaptcha   = ReCaptcha(self.pyfile)
        captcha_key = recaptcha.detect_key()

        if captcha_key:
            url, inputs = self.parse_html_form('name="form_captcha"')
            self.log_debug(("form_captcha url:%s inputs:%s") % (url, inputs))

            if url:
                self.captcha = recaptcha
                response, challenge = recaptcha.challenge(captcha_key)

                inputs['g-recaptcha-response'] = response
                self.data = self.load(self.fixurl(url), post=inputs)

            else:
                self.fail("ReCaptcha form not found")
예제 #2
0
    def handle_free(self, pyfile):
        self.html = self.load(pyfile.url, post={'gateway_result': "1"})

        self.check_errors()

        m = re.search(r"var fid = '(\w+)';", self.html)
        if m is None:
            self.retry(wait_time=5)
        params = {'fid': m.group(1)}
        self.log_debug("FID: %s" % params['fid'])

        self.check_errors()

        recaptcha = ReCaptcha(self)
        captcha_key = recaptcha.detect_key()
        if captcha_key is None:
            return

        self.html = self.load("https://dfiles.eu/get_file.php", get=params)

        if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
            params['response'], params['challenge'] = recaptcha.challenge(captcha_key)
            self.html = self.load("https://dfiles.eu/get_file.php", get=params)

        m = re.search(self.LINK_FREE_PATTERN, self.html)
        if m:
            self.link = urllib.unquote(m.group(1))
예제 #3
0
    def handle_free(self, pyfile):
        data = {'ukey': self.info['pattern']['ID']}

        m = re.search(self.AB1_PATTERN, self.data)
        if m is None:
            self.error(_("__AB1"))
        data['__ab1'] = m.group(1)

        recaptcha = ReCaptcha(self)

        m = re.search(self.RECAPTCHA_PATTERN, self.data)
        captcha_key = m.group(1) if m else recaptcha.detect_key()

        if captcha_key is None:
            self.error(_("ReCaptcha key not found"))

        response, challenge = recaptcha.challenge(captcha_key)
        self.account.form_data = {'recaptcha_challenge_field': challenge,
                                  'recaptcha_response_field' : response}
        self.account.relogin()
        self.retry(2)

        json_url = "http://filecloud.io/download-request.json"
        res = self.load(json_url, post=data)
        self.log_debug(res)
        res = json.loads(res)

        if "error" in res and res['error']:
            self.fail(res)

        self.log_debug(res)
        if res['captcha']:
            data['ctype'] = "recaptcha"
            data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key)

            json_url = "http://filecloud.io/download-request.json"
            res = self.load(json_url, post=data)
            self.log_debug(res)
            res = json.loads(res)

            if "retry" in res and res['retry']:
                self.retry_captcha()
            else:
                self.captcha.correct()


        if res['dl']:
            self.data = self.load('http://filecloud.io/download.html')

            m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.data)
            if m is None:
                self.error(_("LINK_FREE_PATTERN not found"))

            if "size" in self.info and self.info['size']:
                self.check_data = {'size': int(self.info['size'])}

            self.link = m.group(1)
        else:
            self.fail(_("Unexpected server response"))
    def handle_free(self, pyfile):
        recaptcha   = ReCaptcha(self)
        captcha_key = recaptcha.detect_key()

        if captcha_key:
            try:
                self.link = re.search(self.LINK_PREMIUM_PATTERN, self.data)
                recaptcha.challenge()

            except Exception, e:
                self.error(e)
예제 #5
0
파일: XFSHoster.py 프로젝트: EikeKre/pyload
    def handle_captcha(self, inputs):
        m = re.search(self.CAPTCHA_PATTERN, self.data)
        if m is not None:
            captcha_url = m.group(1)
            inputs['code'] = self.captcha.decrypt(captcha_url)
            return

        m = re.search(self.CAPTCHA_BLOCK_PATTERN, self.data, re.S)
        if m is not None:
            captcha_div = m.group(1)
            numerals    = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))

            self.log_debug(captcha_div)

            inputs['code'] = "".join(a[1] for a in sorted(numerals, key=operator.itemgetter(0)))

            self.log_debug("Captcha code: %s" % inputs['code'], numerals)
            return

        recaptcha = ReCaptcha(self.pyfile)
        try:
            captcha_key = re.search(self.RECAPTCHA_PATTERN, self.data).group(1)

        except Exception:
            captcha_key = recaptcha.detect_key()

        else:
            self.log_debug("ReCaptcha key: %s" % captcha_key)

        if captcha_key:
            self.captcha = recaptcha
            inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key)
            return

        solvemedia = SolveMedia(self.pyfile)
        try:
            captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.data).group(1)

        except Exception:
            captcha_key = solvemedia.detect_key()

        else:
            self.log_debug("SolveMedia key: %s" % captcha_key)

        if captcha_key:
            self.captcha = solvemedia
            inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key)
예제 #6
0
    def handle_captcha(self):
        solvemedia  = SolveMedia(self)
        captcha_key = solvemedia.detect_key()

        if captcha_key:
            response, challenge = solvemedia.challenge(captcha_key)
            self.html = self.load("http://www.mediafire.com/?" + self.info['pattern']['ID'],
                                  post={'adcopy_challenge': challenge,
                                        'adcopy_response' : response})
            return

        recaptcha   = ReCaptcha(self)
        captcha_key = recaptcha.detect_key()

        if captcha_key:
            response, challenge = recaptcha.challenge(captcha_key)
            self.html = self.load(self.pyfile.url,
                                  post={'g-recaptcha-response': response})
예제 #7
0
    def handle_captcha(self):
        m  = re.search(self.CAPTCHA_PATTERN, self.html)
        m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)

        if m:  #: Normal captcha
            self.log_debug("Captcha-URL: %s" % m.group(1))

            captcha_code = self.captcha.decrypt(urlparse.urljoin(self.base_url, m.group(1)),
                                                input_type="gif")

            self.site_with_links = self.load(self.pyfile.url,
                                           post={'recaptcha_response_field': captcha_code})
        elif m2:  #: Circle captcha
            self.log_debug("Captcha-URL: %s" % m2.group(1))

            captcha_code = self.captcha.decrypt('%s%s?c=abc' %(self.base_url, m2.group(1)),
                                               output_type='positional')

            self.site_with_links = self.load(self.pyfile.url,
                                           post={'button.x': captcha_code[0], 'button.y': captcha_code[1]})

        else:
            recaptcha   = ReCaptcha(self)
            captcha_key = recaptcha.detect_key()

            if captcha_key:
                response, challenge = recaptcha.challenge(captcha_key)
                self.site_with_links  = self.load(self.pyfile.url,
                                                post={'g-recaptcha-response': response})
            else:
                self.log_info(_("No captcha found"))
                self.site_with_links = self.html

        if "recaptcha_image" in self.site_with_links or "data-sitekey" in self.site_with_links:
            self.captcha.invalid()
            self.retry()
예제 #8
0
    def handle_captcha(self):
        if re.search(self.CAPTCHA_PATTERN, self.data):
            m1  = re.search(self.INTERNAL_CAPTCHA_PATTERN, self.data)
            m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.data)
            m3 = re.search(self.SOLVE_MEDIA_PATTERN, self.data)
            m4 = re.search(self.KEY_CAPTCHA_PATTERN, self.data)

            if m1:  #: Normal captcha
                self.log_debug("Internal Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m1.group(1)))

                captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m1.group(1)),
                                                    ref=True, input_type="gif")

                self.site_with_links = self.load(self.pyfile.url,
                                                 post={'recaptcha_response_field': captcha_code})

            elif m2:  #: Circle captcha
                self.log_debug("Circle Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m2.group(1)))

                captcha_code = self.captcha.decrypt(urlparse.urljoin(self.pyfile.url, m2.group(1)),
                                                    input_type="png", output_type='positional')

                self.site_with_links = self.load(self.pyfile.url,
                                                 post={'button.x': captcha_code[0],
                                                       'button.y': captcha_code[1]})

            elif m3:  #: Solvemedia captcha
                self.log_debug("Solvemedia Captcha URL: %s" % urlparse.urljoin(self.pyfile.url, m3.group(1)))

                solvemedia  = SolveMedia(self)
                captcha_key = solvemedia.detect_key()

                if captcha_key:
                    response, challenge = solvemedia.challenge(captcha_key)
                    self.site_with_links  = self.load(self.pyfile.url,
                                                      post={'adcopy_response'  : response,
                                                            'adcopy_challenge' : challenge})

            elif m4:  #: Keycaptcha captcha
                self.log_debug("Keycaptcha Captcha URL: %s unsupported, retrying" % m4.group(1))
                self.retry()

            else:
                recaptcha   = ReCaptcha(self)
                captcha_key = recaptcha.detect_key()

                if captcha_key:
                    try:
                        response, challenge = recaptcha.challenge(captcha_key)

                    except Exception:
                        self.retry_captcha()

                    self.site_with_links  = self.load(self.pyfile.url,
                                                      post={'g-recaptcha-response': response})
                else:
                    self.log_info(_("Unknown captcha found, retrying"))
                    self.retry()

            if re.search(self.CAPTCHA_PATTERN, self.site_with_links):
                self.retry_captcha()

        else:
            self.log_info(_("No captcha found"))
            self.site_with_links = self.data
예제 #9
0
class DepositfilesCom(SimpleHoster):
    __name__    = "DepositfilesCom"
    __type__    = "hoster"
    __version__ = "0.61"
    __status__  = "testing"

    __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)'
    __config__  = [("activated"   , "bool", "Activated"                                        , True),
                   ("use_premium" , "bool", "Use premium account if available"                 , True),
                   ("fallback"    , "bool", "Fallback to free download if premium fails"       , True),
                   ("chk_filesize", "bool", "Check file size"                                  , True),
                   ("max_wait"    , "int" , "Reconnect if waiting time is greater than minutes", 10  )]

    __description__ = """Depositfiles.com hoster plugin"""
    __license__     = "GPLv3"
    __authors__     = [("spoob", "*****@*****.**"),
                       ("zoidberg", "*****@*****.**"),
                       ("Walter Purcaro", "*****@*****.**")]


    NAME_PATTERN    = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
    SIZE_PATTERN    = r': <b>(?P<S>[\d.,]+)&nbsp;(?P<U>[\w^_]+)</b>'
    OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'

    NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
                         (r'.*<b title="(?P<N>.+?)".*', "\g<N>")]
    URL_REPLACEMENTS  = [(__pattern__ + ".*", "https://dfiles.eu/files/\g<ID>")]

    COOKIES = [("dfiles.eu", "lang_current", "en")]

    WAIT_PATTERN = r'(?:download_waiter_remain">|html_download_api-limit_interval">|>Please wait|>Try in).+'
    ERROR_PATTER = r'File is checked, please try again in a minute'

    LINK_FREE_PATTERN    = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
    LINK_PREMIUM_PATTERN = r'class="repeat"><a href="(.+?)"'
    LINK_MIRROR_PATTERN  = r'class="repeat_mirror"><a href="(.+?)"'


    def handle_free(self, pyfile):
        self.data = self.load(pyfile.url, post={'gateway_result': "1"})

        self.check_errors()

        m = re.search(r"var fid = '(\w+)';", self.data)
        if m is None:
            self.retry(wait=5)
        params = {'fid': m.group(1)}
        self.log_debug("FID: %s" % params['fid'])

        self.check_errors()

        self.captcha = ReCaptcha(pyfile)
        captcha_key = self.captcha.detect_key()
        if captcha_key is None:
            return

        self.data = self.load("https://dfiles.eu/get_file.php", get=params)

        if '<input type=button value="Continue" onclick="check_recaptcha' in self.data:
            params['response'], params['challenge'] = self.captcha.challenge(captcha_key)
            self.data = self.load("https://dfiles.eu/get_file.php", get=params)

        m = re.search(self.LINK_FREE_PATTERN, self.data)
        if m is not None:
            self.link = urllib.unquote(m.group(1))


    def handle_premium(self, pyfile):
        if '<span class="html_download_api-gold_traffic_limit">' in self.data:
            self.log_warning(_("Download limit reached"))
            self.retry(25, 60 * 60, "Download limit reached")

        elif 'onClick="show_gold_offer' in self.data:
            self.account.relogin()
            self.retry()

        else:
            link   = re.search(self.LINK_PREMIUM_PATTERN, self.data)
            mirror = re.search(self.LINK_MIRROR_PATTERN, self.data)

            if link:
                self.link = link.group(1)

            elif mirror:
                self.link = mirror.group(1)