Ejemplo n.º 1
0
    def handleFree(self, pyfile):
        self.html = self.load(pyfile.url, post={'gateway_result': "1"})

        self.checkErrors()

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

        self.checkErrors()

        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))
Ejemplo n.º 2
0
    def handleFree(self, pyfile):
        recaptcha   = ReCaptcha(self)
        captcha_key = recaptcha.detect_key()

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

            except Exception, e:
                self.error(e)
Ejemplo n.º 3
0
    def handleCaptcha(self, inputs):
        m = re.search(self.CAPTCHA_PATTERN, self.html)
        if m:
            captcha_url = m.group(1)
            inputs['code'] = self.decryptCaptcha(captcha_url)
            return

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

            self.logDebug(captcha_div)

            inputs['code'] = "".join(
                a[1] for a in sorted(numerals, key=lambda num: int(num[0])))

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

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

        except Exception:
            captcha_key = recaptcha.detect_key()

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

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

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

        except Exception:
            captcha_key = solvemedia.detect_key()

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

        if captcha_key:
            inputs['adcopy_response'], inputs[
                'adcopy_challenge'] = solvemedia.challenge(captcha_key)
Ejemplo n.º 4
0
    def handleCaptcha(self):
        m = re.search(self.CAPTCHA_PATTERN, self.html)
        m2 = re.search(self.CIRCLE_CAPTCHA_PATTERN, self.html)

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

            captcha_code = self.decryptCaptcha(urlparse.urljoin(
                self.base_url, m.group(1)),
                                               forceUser=True,
                                               imgtype="gif")

            self.siteWithLinks = self.load(
                self.pyfile.url,
                post={'recaptcha_response_field': captcha_code},
                decode=True)
        elif m2:  #: circle captcha
            self.logDebug("Captcha-URL: %s" % m2.group(1))

            captcha_code = self.decryptCaptcha('%s%s?c=abc' %
                                               (self.base_url, m2.group(1)),
                                               result_type='positional')

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

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

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

        if "recaptcha_image" in self.siteWithLinks or "data-sitekey" in self.siteWithLinks:
            self.invalidCaptcha()
            self.retry()
Ejemplo n.º 5
0
    def handleCaptcha(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
                                  },
                                  decode=True)
            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},
                                  decode=True)
Ejemplo n.º 6
0
    def handleFree(self, pyfile):
        data = {"ukey": self.info['pattern']['ID']}

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

        recaptcha = ReCaptcha(self)

        m = re.search(self.RECAPTCHA_PATTERN, self.html)
        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.user)
        self.retry(2)

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

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

        self.logDebug(res)
        if res['captcha']:
            data['ctype'] = "recaptcha"

            for _i in xrange(5):
                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.logDebug(res)
                res = json_loads(res)

                if "retry" in res and res['retry']:
                    self.invalidCaptcha()
                else:
                    self.correctCaptcha()
                    break
            else:
                self.fail(_("Incorrect captcha"))

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

            m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'],
                          self.html)
            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"))