1
+ import random , urllib , os , threading , configparser , datetime , time , requests , re , static_ffmpeg
2
+ from bs4 import BeautifulSoup
3
+ from ctypes import windll
4
+ from colorama import Fore , init
5
+ from tkinter import filedialog
6
+ from urllib .parse import urlparse , parse_qs , unquote
7
+ from selenium_recaptcha_solver import RecaptchaSolver
8
+ from selenium .webdriver .common .by import By
9
+ from selenium import webdriver
10
+ from selenium .webdriver .chrome .options import Options
11
+ from selenium .webdriver .support .ui import WebDriverWait
12
+ from selenium .webdriver .support import expected_conditions as EC
13
+ from PIL import Image
14
+ from pytesseract import *
15
+ e = datetime .datetime .now ()
16
+ current_date = e .strftime ("%Y-%m-%d-%H-%M-%S" )
17
+ bypass , bypasscook , imgurl = "" , "" , ""
18
+ page , dupe , valid , line , parsed , ppm , ppm1 , linkes , error , tries , ink , num , errors , upm , upm1 = 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
19
+ dorks , results = [], []
20
+ blacklist = ['bing.com' ,'php.net' ,'wikipedia.org' ,'stackoverflow.com' ,'amazon.com' ,'microsoft.com' ,'youtube.com' ,'reddit.com' ,'quora.com' ,'telegram.org' ,'facebook.com' ,'apple.com' ,'twitter.com' ,'instagram.com' ,'cracked.io' ,'nulled.to' ,'yahoo.com' ,'github.com' ,'books.google' ,'books.google.nl' ,'google.nl' ]
21
+ init ()
22
+ reset = Fore .RESET
23
+ black = Fore .BLACK
24
+ blue = Fore .BLUE
25
+ cyan = Fore .CYAN
26
+ green = Fore .GREEN
27
+ gray = Fore .LIGHTBLACK_EX
28
+ lightblue = Fore .LIGHTBLUE_EX
29
+ lightcyan = Fore .LIGHTCYAN_EX
30
+ orange = Fore .LIGHTGREEN_EX
31
+ pink = Fore .LIGHTMAGENTA_EX
32
+ lightred = Fore .LIGHTRED_EX
33
+ lightwhite = Fore .LIGHTWHITE_EX
34
+ lightyellow = Fore .LIGHTYELLOW_EX
35
+ magenta = Fore .MAGENTA
36
+ red = Fore .RED
37
+ white = Fore .WHITE
38
+ yellow = Fore .YELLOW
39
+ logo = f'''
40
+ { green } ▄████▄ ██ ██████ █████ ██▀███▄
41
+ ██▀ ▀█ ██ ██ ██ █ ▀ ██ ██
42
+ ██ ▄ ██ ██ ██{ orange } ▓{ green } ███ ██ ▄█{ orange } ▒{ green }
43
+ ██▄ ▄██ ██ ██▄█{ orange } ▓▒{ green } █ ▄ ██▀▀█▄
44
+ { orange } ▒{ green } ████▀ ██ ██{ orange } ▒ ░ { green } █████ ██ { orange } ▒{ green } ██
45
+ { orange } ░░▒ ▒ ▓ ▓▒░ ░ ░ ▒░ ▒▓ ▒▓
46
+ ░ ▒ ▒ ▒ ░ ░ ░ ░▒ ▒
47
+ ▒ ░ ░ ░░ ░
48
+ ░ ░ ░{ green } \n '''
49
+ headerz = [{'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:77.0) Gecko/20190101 Firefox/77.0' },
50
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:77.0) Gecko/20100101 Firefox/77.0' },
51
+ {'User-Agent' : 'Mozilla/5.0 (X11; Linux ppc64le; rv:75.0) Gecko/20100101 Firefox/75.0' },
52
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/75.0' },
53
+ {'User-Agent' : 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:75.0) Gecko/20100101 Firefox/75.0' },
54
+ {'User-Agent' : 'Mozilla/5.0 (X11; Linux; rv:74.0) Gecko/20100101 Firefox/74.0' },
55
+ {'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/73.0' },
56
+ {'User-Agent' : 'Mozilla/5.0 (X11; OpenBSD i386; rv:72.0) Gecko/20100101 Firefox/72.0' },
57
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:71.0) Gecko/20100101 Firefox/71.0' },
58
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:70.0) Gecko/20191022 Firefox/70.0' },
59
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:70.0) Gecko/20190101 Firefox/70.0' },
60
+ {'User-Agent' : 'Mozilla/5.0 (Windows; U; Windows NT 9.1; en-US; rv:12.9.1.11) Gecko/20100821 Firefox/70' },
61
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:69.2.1) Gecko/20100101 Firefox/69.2' },
62
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; rv:68.7) Gecko/20100101 Firefox/68.7' },
63
+ {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0' },
64
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582' },
65
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19577' },
66
+ {'User-Agent' : 'Mozilla/5.0 (X11) AppleWebKit/62.41 (KHTML, like Gecko) Edge/17.10859 Safari/452.6' },
67
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14931' },
68
+ {'User-Agent' : 'Chrome (AppleWebKit/537.1; Chrome50.0; Windows NT 6.3) AppleWebKit/537.36 (KHTML like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393' },
69
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.9200' },
70
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' },
71
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246' },
72
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' },
73
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' },
74
+ {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' },
75
+ {'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_3_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' },
76
+ {'User-Agent' : 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' }]
77
+
78
+ def filter (link ):
79
+ try :
80
+ o = urlparse (link , 'http' )
81
+ if o .netloc and 'google' not in o .netloc : return link
82
+ if o .netloc and o .path .startswith ('/url' ):
83
+ try :
84
+ link = parse_qs (o .query )['url' ][0 ]
85
+ o = urlparse (link , 'http' )
86
+ if o .netloc and 'google' not in o .netloc : return link
87
+ except KeyError : pass
88
+ if link .startswith ('/url?' ):
89
+ try :
90
+ link = parse_qs (o .query )['q' ][0 ]
91
+ o = urlparse (link , 'http' )
92
+ if o .netloc and 'google' not in o .netloc : return link
93
+ except KeyError :
94
+ link = parse_qs (o .query )['url' ][0 ]
95
+ o = urlparse (link , 'http' )
96
+ if o .netloc and 'google' not in o .netloc : return link
97
+ except Exception : pass
98
+ return None
99
+
100
+ def tokenextract (driver ):
101
+ try :
102
+ token = driver .get_cookie ('GOOGLE_ABUSE_EXEMPTION' )['value' ]
103
+ print (token )
104
+ bypass = token
105
+ except :
106
+ pars = str (urlparse (url ))
107
+ print (pars )
108
+ token = str (re .findall ("(?<=GOOGLE_ABUSE_EXEMPTION=).+?(?=; path=/;)" , str (pars )))
109
+ print (token )
110
+ token = token .replace ("['" , "" ).replace ("']" , "" )
111
+ print (token )
112
+ bypass = token
113
+ return bypass
114
+
115
+ def imagesolve (driver ):
116
+ try :
117
+ parent_element = driver .find_element (By .ID , "captcha-form" )
118
+ element = parent_element .find_element (By .TAG_NAME , "img" )
119
+ element .screenshot ('captcha.png' )
120
+ image = Image .open ('captcha.png' )
121
+ text = pytesseract .image_to_string (image )
122
+ os .remove ('captcha.png' )
123
+ print (text )
124
+ driver .find_element (By .XPATH , "//input[@id='captcha']" ).send_keys (text )
125
+ time .sleep (0.5 )
126
+ driver .find_element (By .NAME , "btn-submit" ).click ()
127
+ except Exception as e :
128
+ print (e )
129
+
130
+ def solver (url ):
131
+ global bypass
132
+ chrome_options = Options ()
133
+ #chrome_options.add_argument("--headless")
134
+ chrome_options .add_argument ('--no-sandbox' )
135
+ chrome_options .add_experimental_option ("excludeSwitches" , ["enable-logging" ])
136
+ driver = webdriver .Chrome (options = chrome_options )
137
+ driver .get (url )
138
+ time .sleep (3 )
139
+ #if "To continue, please type the characters below:" in driver.find_element(By.XPATH, "/html/body").text:
140
+ #imagesolve(driver)
141
+ #WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, 'logo')))
142
+ #time.sleep(1)
143
+ #bypass = tokenextract(driver)
144
+ #this was coded to bypass the other type of captcha google will give when too many requests
145
+ try :
146
+ recaptcha_iframe = driver .find_element (By .XPATH , '//iframe[@title="reCAPTCHA"]' )
147
+ solver = RecaptchaSolver (driver = driver )
148
+ solver .click_recaptcha_v2 (iframe = recaptcha_iframe )
149
+ try :
150
+ WebDriverWait (driver , 10 ).until (EC .presence_of_element_located ((By .ID , 'logo' )))
151
+ time .sleep (1 )
152
+ bypass = tokenextract (driver )
153
+ except :
154
+ if "Your computer or network may be sending automated queries. To protect our users, we can't process your request right now. For more details visit" in driver .find_element (By .XPATH , "/html/body" ).text :
155
+ print ("ip banned" )
156
+ time .sleep (10 )
157
+ except :
158
+ print ("no captcha to solve" )
159
+ driver .close ()
160
+ driver .quit ()
161
+
162
+ def parser (dork ):
163
+ global page , ppm , errors , url , bypass , parsed , valid , dupe , ink , upm , linkes
164
+ if bypass == "" :
165
+ url = f'https://www.google.com/search?q={ urllib .parse .quote (dork )} &start={ page * 10 } '
166
+ else :
167
+ url = f'https://www.google.com/search?q={ urllib .parse .quote (dork )} &google_abuse=GOOGLE_ABUSE_EXEMPTION={ bypass } &start={ page * 10 } '
168
+ try :
169
+ cookie = {'GOOGLE_ABUSE_EXEMPTION' :bypass , 'CONSENT' :'YES+' }
170
+ req = requests .get (url = url , headers = random .choice (headerz ), cookies = cookie )
171
+ soup = BeautifulSoup (req .text , 'html.parser' )
172
+ if "Our systems have detected unusual traffic from your computer network." in req .text :
173
+ if f"Your search - { dork } - did not match any documents." in req .text :
174
+ pass
175
+ elif "sorry/index?continue=" in req .url :
176
+ print (cyan + "Grabbing Token! (Please Wait Around 10-20 Seconds.)" )
177
+ solver (req .url )
178
+ parser (dork )
179
+ else :
180
+ for d in soup .find_all ("div" , class_ = "yuRUbf" ):
181
+ for a in d .find_all ('a' ):
182
+ link = a ['href' ]
183
+ upm += 1
184
+ linkes += 1
185
+ filter (link )
186
+ link = unquote (link )
187
+ if "translate.google.com" in link : link = link .split ("&u=" )[1 ]
188
+ if link not in results :
189
+ results .append (link )
190
+ domain = urlparse (link ).netloc
191
+ try : domain = domain .replace ("www." ,"" )
192
+ except : pass
193
+ if domain not in blacklist :
194
+ if '=' in link :
195
+ valid += 1
196
+ ink += 1
197
+ with open (r'results/Parser/' + current_date + r'/Filtered.txt' , 'a' ) as File : File .write (link ) + File .write ('\n ' )
198
+ if mode == "log" : print (green + link )
199
+ else :
200
+ with open (r'results/Parser/' + current_date + r'/Unfiltered.txt' , 'a' ) as File : File .write (link ) + File .write ('\n ' )
201
+ if mode == "log" : print (red + link )
202
+ else : dupe += 1
203
+ if ink == 0 or page >= pages :
204
+ page = 0
205
+ parsed += 1
206
+ dorkstart ()
207
+ else :
208
+ ink = 0
209
+ page += 1
210
+ parser (dork )
211
+ except :
212
+ errors += 1
213
+ page = 0
214
+ parser (dork )
215
+
216
+ def dorkstart ():
217
+ global ext , line , dork
218
+ dork = ext [line ].strip ()
219
+ line += 1
220
+ threading .Thread (parser (dork )).start ()
221
+
222
+ def loadconfig ():
223
+ global pages , mode , tries , threads
224
+ if not os .path .exists ('results/Parser/' + current_date ):
225
+ os .makedirs ('results/Parser/' + current_date )
226
+ if not os .path .isfile ("config.ini" ):
227
+ config = configparser .ConfigParser (allow_no_value = True )
228
+ config ['ParserSettings' ] = {'; cli/log' : None , 'Mode' : 'log' , 'MaxPages' : '10' }
229
+ with open ('config.ini' , 'w' ) as configfile :
230
+ config .write (configfile )
231
+ read_file = configparser .ConfigParser ()
232
+ read_file .read ('config.ini' )
233
+ pages = int (read_file ['ParserSettings' ]['MaxPages' ])
234
+ mode = str (read_file ['ParserSettings' ]['Mode' ])
235
+
236
+ def cliscreen ():
237
+ global parsed , ext , linkes , dupe , upm , upm1 , error , valid , sqls , MySQL , MsSQL , PostGRES , Oracle , MariaDB , none , errorr
238
+ upm1 = upm
239
+ upm = 0
240
+ os .system ('cls' )
241
+ windll .kernel32 .SetConsoleTitleW (f"Ciper Parser By KillinMachine | Parsed: { parsed } /{ len (ext )} | Links: { linkes } | Duplicates: { dupe } | Valid: { valid } | Errors: { error } | UPM: { upm1 * 60 } " )
242
+ print (logo )
243
+ print (f''' { orange } Parsing{ green }
244
+ Parsed: { yellow } { parsed } /{ len (ext )} { green }
245
+ Links: { yellow } { linkes } { green }
246
+ Duplicates: { yellow } { dupe } { green }
247
+ Valid: { yellow } { valid } { green }
248
+ Error's: { yellow } { error } { green }
249
+ UPM: { yellow } { upm1 * 60 } { green } ''' )
250
+ time .sleep (1 )
251
+ threading .Thread (target = cliscreen , args = ()).start ()
252
+
253
+ def logscreen ():
254
+ global parsed , ext , linkes , dupe , upm , upm1 , error , valid
255
+ upm1 = upm
256
+ upm = 0
257
+ windll .kernel32 .SetConsoleTitleW (f"Ciper Parser By KillinMachine | Parsed: { parsed } /{ len (ext )} | Links: { linkes } | Duplicates: { dupe } | Valid: { valid } | Errors: { error } | UPM: { upm1 * 60 } " )
258
+ time .sleep (1 )
259
+ threading .Thread (target = logscreen , args = ()).start ()
260
+
261
+ def main ():
262
+ global ext , threads , num
263
+ static_ffmpeg .add_paths ()
264
+ os .system ('cls' )
265
+ loadconfig ()
266
+ print (logo )
267
+ windll .kernel32 .SetConsoleTitleW ("Ciper Parser By KillinMachine" )
268
+ print (" Select your Dork's. " )
269
+ file_path = filedialog .askopenfilename ()
270
+ file = open (file_path , 'r+' , encoding = 'utf-8' , errors = 'ignore' )
271
+ with file as e : ext = e .readlines ()
272
+ print (f" Loaded [{ len (ext )} ] Dorks." )
273
+ if mode == "log" :
274
+ logscreen ()
275
+ else :
276
+ cliscreen ()
277
+ if len (ext ) > num :
278
+ num += 1
279
+ dorkstart ()
280
+ else :
281
+ print ("Finished Parsing!" )
282
+ main ()
0 commit comments