├── README.md ├── UDork.exe ├── UDork.ico ├── UDork.py └── requirements.txt /README.md: -------------------------------------------------------------------------------- 1 | # UDork 2 | small and simple tool for generating a list and searching for Google Dork to identify leaked files and save the scan result 3 | ------------------------------- 4 | ###Guide to using the tool 5 | 6 | If you are a Windows user and want to use the executable file 7 | It is enough to download repository and open the **[UDork.exe]** extension file 8 | 9 | 10 | 11 | If you want to run the tool as an open source with Python compiler 12 | It is better to type the following commands and install the libraries through **requirements.txt** file before use 13 | 14 | 1) python3 -m pip install --upgrade pip 15 | 2) pip install -r requirements.txt 16 | 17 | 18 | You can see the tool usage guide saved on my YouTube channel. 19 | https://www.youtube.com/watch?v=ZekrFG0NlUY 20 | -------------------------------------------------------------------------------- /UDork.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omidsec/UDork/8591dd2b8037a9501b573917b507a98ef53bda1e/UDork.exe -------------------------------------------------------------------------------- /UDork.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omidsec/UDork/8591dd2b8037a9501b573917b507a98ef53bda1e/UDork.ico -------------------------------------------------------------------------------- /UDork.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | from bs4 import BeautifulSoup 4 | import urllib.parse 5 | import requests 6 | from requests.exceptions import ConnectionError 7 | import re 8 | import warnings 9 | import time 10 | 11 | warnings.filterwarnings('ignore') 12 | 13 | def update(): 14 | version = '1.0' 15 | server='https://omidnasiripouya.ir/MyTools/UDork/version.txt' 16 | update_request=requests 17 | orginal = update_request.get(server) 18 | answer = BeautifulSoup(orginal.content, 'html.parser') 19 | orginal_answer = answer.find_all('version') 20 | result = re.search('>(.*)<', str(orginal_answer)) 21 | latest_version = str(result.group(1)) 22 | if str(version) == latest_version: 23 | print ('\u001b[32mYour are using a Latest of version '+latest_version+'. thank you\u001b[37m') 24 | time.sleep(5) 25 | else: 26 | print('\u001b[31mYou are Using a out of date version of UDork tool.\u001b[37m') 27 | print('Your Current Version '+version+' and latest version '+str(result)) 28 | print('You can download new version of UDork with this links') 29 | print('\u001b[36mhttps://github.com/Noob2Pr0/UDork \u001b[37m') 30 | print('\u001b[36mhttps://omidnasiripouya.ir/MyTools/UDork/ \u001b[37m') 31 | time.sleep(5) 32 | 33 | 34 | def clsdis(): 35 | os.system("cls") 36 | 37 | def rules(): 38 | print('''\u001b[31m 39 | Any illegal use of this tool is your responsibility. 40 | \u001b[33m 41 | ------------------------------------------------- 42 | The results of this tool are influenced by Google captcha. 43 | Before working with the tool, solve the Google captcha several times 44 | and then run the software. 45 | You can also try it manually to be more sure of the results. 46 | -------------------------------------------------\u001b[36m 47 | If captcha is not involved in the scanning process 48 | this tool is able to extract up to 10 Google pages 49 | equivalent to 100 links at most. This restriction 50 | is also due to the prevention of expensive abuse 51 | -------------------------------------------------\u001b[37m 52 | ''') 53 | qu = input('Have you read the rules and do you agree with them? (y=yes): \u001b[37m') 54 | if 'y' in qu: 55 | banner() 56 | else: 57 | sys.exit() 58 | 59 | def banner(): 60 | os.system("cls") 61 | print(u"""\u001b[36m 62 | ___ _ 63 | /\ /\ / \___ _ __| | __ 64 | / / \ \/ /\ / _ \| '__| |/ / 65 | \ \_/ / /_// (_) | | | < 66 | \___/___,' \___/|_| |_|\_\\\u001b[34m v1.0 \u001b[37m 67 | Author: Omid Nasiri Pouya 68 | """) 69 | 70 | 71 | 72 | def menu(): 73 | global subm1,subm2 74 | print(''' 75 | 1. Simple Dorks 76 | 2. Advanced Dors 77 | ''') 78 | subm1= input('\u001b[36mEnter Menu Number: \u001b[37m') 79 | print(''' 80 | 1. Automatic Search 81 | 2. Manualy Search 82 | ''') 83 | subm2= input('\u001b[36mEnter Menu Number: \u001b[37m') 84 | 85 | def OSINT(): 86 | global default_intext,default_inurl,default_cached,default_intitle,date 87 | default_intext= '*' 88 | default_inurl='*' 89 | default_cached='cached='+url 90 | default_intitle='*' 91 | date='*' 92 | 93 | def s_end(): 94 | print('''This tool doesn't need your email but it needs your support.\nIf you don't want to support us, leave the field empty \n----------------------------------------------------''') 95 | email=input('\u001b[32mEnter Your Email: \u001b[37m') 96 | try: 97 | data2 = {"email": email} 98 | response2 = requests.post(Eurl, data=data2) 99 | except ConnectionError: 100 | print ('\u001b[31mConnection to the server fail.\u001b[37m') 101 | print('Please check you internet connection') 102 | sys.exit(141) 103 | if email==None: 104 | pass 105 | else: 106 | print('Creating Profile for You Please Wait a Sec') 107 | if response2.status_code==200: 108 | print ('\u001b[32mConnection to the server successfuly.\u001b[37m') 109 | profile = open( 'UDProfile.ini', 'w' ) 110 | profile.write(str(email)+'\n') 111 | profile.close() 112 | print ("""I created a profile for your email address\nso that you don't see this message again\nthe next time you open the software it won't bother you anymore.""") 113 | print("Thank you for supporing us \u001b[31m♥\u001b[37m") 114 | else: 115 | print ('\u001b[31mConnection to the server fail.\u001b[37m') 116 | print('Please check you internet connection') 117 | 118 | 119 | def collect(): 120 | global Eurl 121 | Eurl = 'https://omidnasiripouya.ir/MyTools/Log/Email.php' 122 | if os.path.exists("UDProfile.ini"): 123 | UR = open("UDProfile.ini", "r") 124 | URContent = UR.read() 125 | if '@' in str(URContent): 126 | cuser = os.getlogin() 127 | print('Welcome ',cuser) 128 | time.sleep(1) 129 | try: 130 | data = {"email": URContent} 131 | response = requests.post(Eurl, data=data) 132 | except ConnectionError: 133 | print ('\u001b[31mConnection to the server fail.\u001b[37m') 134 | print('Please check you internet connection') 135 | sys.exit(141) 136 | else: 137 | s_end() 138 | else: 139 | s_end() 140 | 141 | def getdorkinfo(): 142 | print('If you want to get better results, use your local language other than English') 143 | global filetype,intext,inurl,intitle 144 | print('Examples: xlsx xlsx db doc accdb docx zip rar 7z') 145 | filetype = input('\u001b[36mEnter the file extension: ') 146 | print('-------------------------------------------') 147 | print('Examples: @gmail.com @yahoo.com +1 +98 0912 password username email') 148 | intext = input('\u001b[36mEnter the desired text: ') 149 | print('-------------------------------------------') 150 | print('Examples: * .php .asp logs images books cv') 151 | inurl = input('\u001b[36mEnter the desired path: ') 152 | print('-------------------------------------------') 153 | print('Examples: cpanel panel login user welcome') 154 | intitle = input('\u001b[36mEnter the desired title: ') 155 | 156 | 157 | def RunScan(): 158 | clsdis() 159 | banner() 160 | ScanFile = UserInputScan 161 | global smartagent 162 | smartagent='python/3.7' 163 | filetypelist = ['xls','xlsx','doc','docx','log','conf','bak','rar','zip','7z','tar.gz','paa','mdb','accdb','txt','dbs','xml','tmp','git'] 164 | default_filetype= 'filetype:xls | filetype:xlsx | filetype:doc | filetype:docx | filetype:log | filetype:bak | filetype:conf | filetype:rar | filetype:zip | filetype:pass | filetype:mdb | filetype:accdb | filetype:sql | filetype:txt | filetype:dbs | filetype:xml' 165 | if '1' in subm1: 166 | if '2' in subm2: 167 | print('You have selected SIMPLE dork with manual scan.') 168 | print('You can open the following links in your browser with the control key + left click\u001b[37m') 169 | print('\u001b[32m----------[File Type All in One Dork]----------\u001b[37m') 170 | print('https://www.google.com/search?q=site:'+url+'%20filetype:'+urllib.parse.quote(default_filetype)) 171 | print('\u001b[32m..........[File Type Small Dork].........\u001b[37m') 172 | for x in range(len(filetypelist)): 173 | print('https://www.google.com/search?q=site:'+url+'%20filetype:'+urllib.parse.quote(filetypelist[x])) 174 | print('\u001b[32m----------[Cached Page Dork]----------\u001b[37m') 175 | print('https://www.google.com/search?q=cached:'+url) 176 | if '1' in subm2: 177 | if os.path.exists(ScanFile): 178 | os.remove(ScanFile) 179 | else: 180 | pass 181 | 182 | GOPage = 0 183 | while GOPage <= 100: 184 | headers = { 185 | 'User-Agent': str(smartagent) 186 | } 187 | response = requests.get("https://www.google.com/search?q=site:"+url+" filetype:"+default_filetype+"&start="+str(GOPage), headers=headers) 188 | soup = BeautifulSoup(response.content, 'html.parser') 189 | if 'Your client does not have permission' in str(soup): 190 | print('''\u001b[31mGoogle has completely blocked the request 191 | and it is not possible to continue scanning automatically.\u001b[37m''') 192 | sys.exit() 193 | if 'Our systems have detected unusual traffic from your computer' in str(soup): 194 | print('\u001b[31mGoogle detected the tool, this has an effect on the answers\u001b[37m') 195 | googlecaptcha = input('Do you want to continue? (y=Yes/n=No): ') 196 | if 'n' in googlecaptcha: 197 | sys.exit() 198 | else: 199 | #one day found a way to bypass google captcha 200 | pass 201 | if 'did not match any documents.' in str(soup): 202 | print('\u001b[32mScan Complete\u001b[37m') 203 | sys.exit() 204 | links = soup.find_all("a") 205 | for link in links: 206 | if link.string == None: 207 | if '://' in str(link.get("href")): 208 | answer=(link.get("href")) 209 | result = re.search('q=(.*)&sa=', answer) 210 | if result == None: 211 | print('I did not find any links') 212 | else: 213 | urldecode = urllib.parse.unquote(result.group(1)) 214 | print('\nLink: '+str(urldecode)) 215 | f = open(ScanFile, 'a' ) 216 | f.write('\nLink: '+str(urldecode)) 217 | f.close() 218 | GOPage += 10 219 | print('\u001b[32m-----------[Google Page '+str(GOPage/10),' END]----------\u001b[37m') 220 | if '2' in subm1: 221 | if '2' in subm2: 222 | getdorkinfo() 223 | print('You have selected Advance dork with manual scan.') 224 | print('You can open the following links in your browser with the control key + left click\u001b[37m') 225 | print('\u001b[32m----------[File Type All in One Dork]----------\u001b[37m') 226 | print('https://www.google.com/search?q=site:'+url+'%20filetype:'+filetype+'%20intext:'+intext+'%20inurl:'+inurl+'%20intitle:'+intitle) 227 | print('\u001b[32m..........[File Type Small Dork].........\u001b[37m') 228 | print('https://www.google.com/search?q=site:'+url+'%20filetype:'+filetype+'%20intext:'+intext) 229 | print('https://www.google.com/search?q=site:'+url+'%20filetype:'+filetype+'%20intext:password | intext:username | intext:email | intext:phone') 230 | print('https://www.google.com/search?q=site:'+url+'%20inurl:'+inurl) 231 | print('https://www.google.com/search?q=site:'+url+'%20inurl:'+inurl+'%20intext:'+intext) 232 | print('https://www.google.com/search?q=site:'+url+'%20inurl:'+inurl+'%20intitle:'+intitle) 233 | print('https://www.google.com/search?q=site:'+url+'%20inurl:'+filetype+'%20intext:'+intext) 234 | print('\u001b[32m----------[Cached Page Dork]----------\u001b[37m') 235 | print('https://www.google.com/search?q=cached:'+url) 236 | if '1' in subm2: 237 | getdorkinfo() 238 | Advance_loop = [url+' filetype:'+filetype, 239 | url+' filetype:'+filetype+' intext:'+intext, 240 | url+' filetype:'+filetype+' intitle:'+intitle, 241 | url+' filetype:'+filetype+' intext:'+intext+' intitle:'+intitle, 242 | url+' inurl:'+inurl, 243 | url+' inurl:'+inurl+' intext:'+intext, 244 | url+' inurl:'+inurl+' intext:'+intext+' intitle:'+intitle,] 245 | GOPage = 0 246 | while GOPage <= 100: 247 | headers = { 248 | 'User-Agent': str(smartagent) 249 | } 250 | for advloop in range(len(Advance_loop)): 251 | response = requests.get("https://www.google.com/search?q=site:"+str(Advance_loop[advloop])+"&start="+str(GOPage), headers=headers) 252 | soup = BeautifulSoup(response.content, 'html.parser') 253 | if 'Your client does not have permission' in str(soup): 254 | print('''\u001b[31mGoogle has completely blocked the request 255 | and it is not possible to continue scanning automatically.\u001b[37m''') 256 | sys.exit() 257 | if 'Our systems have detected unusual traffic from your computer' in str(soup): 258 | print('\u001b[31mGoogle detected the tool, this has an effect on the answers\u001b[37m') 259 | googlecaptcha = input('Do you want to continue? (y=Yes/n=No): ') 260 | if 'n' in googlecaptcha: 261 | sys.exit() 262 | else: 263 | #one day found a way to bypass google captcha 264 | pass 265 | if 'did not match any documents.' in str(soup): 266 | print('\u001b[32mNo link found with this dork: '+str(Advance_loop[advloop])+'\u001b[37m') 267 | pass 268 | links = soup.find_all("a") 269 | for link in links: 270 | if link.string == None: 271 | if '://' in str(link.get("href")): 272 | answer=(link.get("href")) 273 | result = re.search('q=(.*)&sa=', answer) 274 | if result == None: 275 | print('I did not find any links') 276 | else: 277 | urldecode = urllib.parse.unquote(result.group(1)) 278 | print('\n\u001b[36mLink: '+str(urldecode)) 279 | f = open(UserInputScan, 'a' ) 280 | f.write('\nLink: '+str(urldecode)) 281 | f.close() 282 | GOPage += 10 283 | print('\u001b[32m-----------[Google Page '+str(GOPage/10),' END]----------\u001b[37m') 284 | print('\u001b[32mScan Complete\u001b[37m') 285 | else: 286 | print('Wrong Number') 287 | sys.exit() 288 | 289 | 290 | clsdis() 291 | rules() 292 | collect() 293 | update() 294 | clsdis() 295 | banner() 296 | global url,UserInputScan 297 | print('Example: site.com mysite.com ac.ir edu.com') 298 | url = input('\u001b[36mEnter the site address: \u001b[37m') 299 | print('\nWARNING: If the name you entered already exists, the file will be overwritten.') 300 | print('Example: site.txt mysite.txt') 301 | UserInputScan = input('\u001b[36mEnter a name for Scan file: \u001b[37m') 302 | menu() 303 | RunScan() 304 | 305 | 306 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | BeautifulSoup 2 | urllib 3 | requests --------------------------------------------------------------------------------