├── LICENSE ├── README.md ├── audio ├── recaptcha666e.mp3 └── recaptcha666e.wav ├── chromedriver.exe ├── config.json ├── main.py ├── solve.py └── solved.PNG /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Pr0t0n 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Recaptcha-Solver Made by Pr0t0ns 2 | PLEASE STAR REPO (50 Stars and I will make Funcaptcha Solver Next) 3 | 4 | **Undetected Selenium Based Python Solver for Recaptcha** 5 | Run main.py 6 | 7 | Features 8 | * Solves in about 10-20 seconds 9 | * config.json let's you customize a few options such as headerless browser and console prints 10 | 11 | **Important** 12 | * You must have ffmpeg Installed and added to PATH (This is required because of file conversion .mp3 -> .wav) 13 | * You can edit the code so it solves on ur own custom url 14 | * If you have any good suggestions feel free to open a ticket and I will add it in 15 | * Feel free to create PR If they're good I will merge them 16 | 17 | In Progress 18 | * I am thinking about making some parts of the code requests based so they not everything is done via browser this will make the program much faster (Not sure if i will add this yet though) 19 | 20 | Additonal Notes 21 | * For Some reason if you enable headerless browser option it becomes slower at solving not exactly sure why 22 | * You may need to Customize some of the iframe XPATH's if your trying to solve on another website than the one it's using 23 | 24 | Script Example 25 | ![Screenshot of Solved Recaptcha using Script](https://raw.githubusercontent.com/Pr0t0ns/Recaptcha-Solver/main/solved.PNG?raw=true) 26 | -------------------------------------------------------------------------------- /audio/recaptcha666e.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pr0t0ns/Recaptcha-Solver/3e877e123e905d8e74f760a6d21aaf0cad8dd2f9/audio/recaptcha666e.mp3 -------------------------------------------------------------------------------- /audio/recaptcha666e.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pr0t0ns/Recaptcha-Solver/3e877e123e905d8e74f760a6d21aaf0cad8dd2f9/audio/recaptcha666e.wav -------------------------------------------------------------------------------- /chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pr0t0ns/Recaptcha-Solver/3e877e123e905d8e74f760a6d21aaf0cad8dd2f9/chromedriver.exe -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "headless": false, 3 | "Only_display_token": false 4 | } -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from solve import Recaptcha 2 | 3 | 4 | if __name__ == "__main__": 5 | Recaptcha = Recaptcha() 6 | token = Recaptcha.solve() -------------------------------------------------------------------------------- /solve.py: -------------------------------------------------------------------------------- 1 | import time, requests, random, string, json 2 | from selenium import webdriver 3 | from selenium.webdriver.chrome.options import Options 4 | from selenium.webdriver.common.by import By 5 | from selenium.webdriver.support.ui import WebDriverWait 6 | from selenium.webdriver.support import expected_conditions as EC 7 | from selenium.webdriver.common.keys import Keys 8 | import undetected_chromedriver as uc 9 | import speech_recognition as sr 10 | import subprocess 11 | class Log: 12 | def success(text): 13 | return print(f"[+]: {text}") 14 | def normal(text): 15 | return print(f"[=]: {text}") 16 | def error(text): 17 | return print(f"[-]: {text}") 18 | def warn(text): 19 | return print(f"[\]: {text}") 20 | class Recaptcha: 21 | def __init__(self) -> None: 22 | self.captchas_solved = 0 23 | self.errors = 0 24 | with open('config.json') as f: 25 | data = f.read() 26 | data = json.loads(data) 27 | self.headless = data['headless'] 28 | self.only_display_token = data['Only_display_token'] 29 | del data 30 | options = webdriver.ChromeOptions() 31 | if self.headless: 32 | options.add_argument('--headless') 33 | self.driver = uc.Chrome(options=options) 34 | def download_audio(self, url, file_name): 35 | bytes = requests.get(url).content 36 | with open(f"audio/{file_name}.mp3", "wb") as f: 37 | f.write(bytes) 38 | time.sleep(2) 39 | self.convert_mp3_to_wav(file_name) 40 | audio_text = self.speech_recognition(file_name) 41 | return audio_text 42 | def speech_recognition(self, file_name): 43 | r = sr.Recognizer() 44 | with sr.AudioFile(f"audio/{file_name}.wav") as source: 45 | audio = r.record(source) 46 | try: 47 | s = r.recognize_google(audio) 48 | return s 49 | except Exception as e: 50 | self.driver.quit() 51 | Log.error("Error Decoding Recaptcha Audio Challenge!") 52 | return 53 | def convert_mp3_to_wav(self, file_name=None): 54 | try: 55 | subprocess.call(['ffmpeg', '-i', f"audio/{file_name}.mp3", f"audio/{file_name}.wav"], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 56 | except Exception as err: 57 | self.driver.quit() 58 | Log.error("You need to install ffmpeg on this device in order to convert mp3 files to .wav files!") 59 | return 60 | return 61 | def solve(self): 62 | try: 63 | self.driver.get('https://www.google.com/recaptcha/api2/demo') 64 | self.driver.switch_to.frame(0) 65 | WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[2]/div[3]/div[1]/div/div/span/div[1]'))).click() 66 | if self.only_display_token == False: 67 | Log.normal("Fetched Recaptcha") 68 | self.driver.switch_to.default_content() 69 | except Exception: 70 | self.driver.quit() 71 | return Log.error("Error Getting Recaptcha!") 72 | try: 73 | self.driver.switch_to.frame(self.driver.find_elements(By.XPATH, "/html/body/div[2]/div[4]/iframe")[0]) 74 | WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div/div/div[3]/div[2]/div[1]/div[1]/div[2]/button'))).click() 75 | download_link = WebDriverWait(self.driver, 5).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div/div/div[7]/a'))).get_attribute('href') 76 | if self.only_display_token == False: 77 | Log.normal(f"Retrived Recaptcha Audio Challenge ({download_link})") 78 | except Exception: 79 | self.driver.quit() 80 | return Log.error("Recaptcha seems to be ratelimited on this IP!") 81 | try: 82 | audio_text = self.download_audio(download_link, f"recaptcha{random.randint(1, 500000)}{download_link[len(download_link)-15]}") 83 | if self.only_display_token == False: 84 | Log.normal(f"Solved Recaptcha Audio Challenge --> ({audio_text})") 85 | audio_input = WebDriverWait(self.driver, 5).until(EC.visibility_of_element_located((By.XPATH, '/html/body/div/div/div[6]/input'))).send_keys(audio_text) 86 | WebDriverWait(self.driver, 5).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div/div/div[8]/div[2]/div[1]/div[2]/button'))).click() 87 | self.driver.switch_to.default_content() 88 | try: 89 | self.driver.switch_to.frame(self.driver.find_elements(By.XPATH, "/html/body/div[1]/form/fieldset/ul/li[5]/div/div/div/div/iframe")[0]) 90 | except Exception: 91 | pass 92 | captcha_response = WebDriverWait(self.driver, 5).until(EC.presence_of_element_located((By.XPATH, '/html/body/input'))).get_attribute('value') 93 | Log.success(f"Solved Recaptcha --> ({captcha_response})") 94 | except Exception as err: 95 | return Log.error("Error Sumbitting Recaptcha Answer!") 96 | self.driver.quit() 97 | return captcha_response 98 | if __name__ == "__main__": 99 | Recaptcha = Recaptcha() 100 | -------------------------------------------------------------------------------- /solved.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pr0t0ns/Recaptcha-Solver/3e877e123e905d8e74f760a6d21aaf0cad8dd2f9/solved.PNG --------------------------------------------------------------------------------