├── README.md └── main.py /README.md: -------------------------------------------------------------------------------- 1 | # reCAPTCHA-bypass 2 | This python script lets you to bypass I'm not a robot captcha(reCAPTCHA) by means of computer vision and system automation. 3 | 4 | Required external modules : 5 | 1. cv2 6 | 2. numpy 7 | 3. matplotlib 8 | 4. pyautogui 9 | 5. pyscreenshot 10 | 11 | Additional files : 12 | 1. https://i.imgur.com/9lsZPfy.jpg download this image for performing template matching technique and paste it on the same folder of the script 13 | 14 | 15 | Open the page which is to be bypassed and run the script main.py 16 | NB. reCAPTCHA box must be visible to the user during execution of script 17 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | from matplotlib import pyplot as plt 4 | import pyautogui 5 | import time 6 | import pyscreenshot as ImageGrab 7 | 8 | time.sleep(1) 9 | coords = [] 10 | print ('-> Locating coordinates of reCAPTCHA...') 11 | 12 | pic = pyautogui.screenshot() #taking screenshot 13 | pic.save('main.jpg') #saving screenshot 14 | 15 | img_rgb = cv2.imread('main.jpg') 16 | img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) ###beginning template matching### 17 | template = cv2.imread('sub.jpg',0) # 18 | w, h = template.shape[::-1] # 19 | 20 | res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED) 21 | threshold = 0.8 22 | loc = np.where( res >= threshold) 23 | 24 | for pt in zip(*loc[::-1]): 25 | coords.append(pt[0]) #storing upper left coordinates of reCAPTCHA box 26 | coords.append(pt[1]) 27 | 28 | 29 | if len(coords)!= 0 : 30 | 31 | print ('-> Location found reCAPTCHA at :',coords) 32 | 33 | reCAPTCHA_box_x_bias = 10 34 | reCAPTCHA_box_y_bias = 20 35 | 36 | coords[0] = coords[0] + reCAPTCHA_box_x_bias 37 | coords[1] = coords[1] + reCAPTCHA_box_y_bias 38 | 39 | print ('-> Moving cursor to (1, 1)') 40 | pyautogui.moveTo(1, 1, duration = 0) 41 | 42 | print ('-> Moving cursor towards reCAPTCHA') 43 | pyautogui.moveTo(coords[0], coords[1], duration = 0.12) 44 | 45 | print ('-> Performing click action on reCAPTCHA') 46 | pyautogui.click() 47 | 48 | time.sleep(4) 49 | 50 | Submit_button_x_bias = 0 51 | Submit_button_y_bias = 75 52 | 53 | coords[0] = coords[0] + Submit_button_x_bias 54 | coords[1] = coords[1] + Submit_button_y_bias 55 | 56 | pyautogui.moveTo(coords[0], coords[1], duration = 0.14) 57 | 58 | print ('-> Performing click action on Submit') 59 | pyautogui.click() 60 | 61 | else : 62 | print ('-> reCAPTCHA box not found!') 63 | 64 | --------------------------------------------------------------------------------