(self)
| 70 | return |
| 71 | |
| 72 | def handle_captcha(self): |
| 73 | url, inputs = self.parse_html_form('action="%s"' % self.pyfile.url) |
| 74 | if inputs is None: |
| 75 | return |
| 76 | |
| 77 | elif inputs['do'] == "captcha": |
| 78 | captcha_type = inputs['captcha_driver'] |
| 79 | |
| 80 | if captcha_type == "simplecaptcha": |
| 81 | self.log_debug("Internal captcha found") |
| 82 | |
| 83 | captcha_url = "https://cript.to/captcha/simplecaptcha" |
| 84 | captcha_code = self.captcha.decrypt(captcha_url, input_type="png") |
| 85 | inputs['simplecaptcha'] = captcha_code |
| 86 | |
| 87 | elif captcha_type == "circlecaptcha": |
| 88 | self.log_debug("Circle captcha found") |
| 89 | |
| 90 | captcha_url = "https://cript.to/captcha/circlecaptcha" |
| 91 | captcha_code = self.captcha.decrypt(captcha_url, input_type="png", output_type='positional') |
| 92 | inputs['button.x'] = captcha_code[0] |
| 93 | inputs['button.y'] = captcha_code[1] |
| 94 | |
| 95 | elif captcha_type == "solvemedia": |
| 96 | solvemedia = SolveMedia(self.pyfile) |
| 97 | captcha_key = solvemedia.detect_key() |
| 98 | |
| 99 | if captcha_key: |
| 100 | self.log_debug("Solvemedia captcha found") |
| 101 | |
| 102 | self.captcha = solvemedia |
| 103 | response, challenge = solvemedia.challenge(captcha_key) |
| 104 | |
| 105 | inputs['adcopy_challenge'] = challenge |
| 106 | inputs['adcopy_response'] = response |
| 107 | |
| 108 | else: |
| 109 | self.log_warning(_("Could not detect Solvemedia captcha key")) |
| 110 | self.retry_captcha() |
| 111 | |
| 112 | elif captcha_type == "recaptcha": |
| 113 | recaptcha = ReCaptcha(self.pyfile) |
| 114 | captcha_key = recaptcha.detect_key() |
| 115 | |
| 116 | if captcha_key: |
| 117 | self.log_debug("ReCaptcha captcha found") |
| 118 | |
| 119 | self.captcha = recaptcha |
| 120 | response, challenge = recaptcha.challenge(captcha_key) |
| 121 | |
| 122 | inputs['g-recaptcha-response'] = response |
| 123 | |
| 124 | else: |
| 125 | self.log_warning(_("Could not detect Solvemedia captcha key")) |
| 126 | self.retry_captcha() |
| 127 | |
| 128 | else: |
| 129 | self.log_warning(_("Captcha Not found")) |
no test coverage detected