-
Notifications
You must be signed in to change notification settings - Fork 0
/
dork.py
72 lines (63 loc) · 2.55 KB
/
dork.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#hope it works :)
import requests
import time
from tqdm import tqdm
# Function to check if URL is working
def check_url(url):
try:
response = requests.get(url)
return response.status_code == 200
except requests.exceptions.RequestException:
return False
# Function to load dorks from a file and generate URLs
def load_dorks(filename, prefix, suffix=''):
with open(filename) as wordlist:
return [prefix.format(website, line, suffix) for line in wordlist]
# Prompt user for website
website = input("Enter Website: ")
# Prompt user for dork selection
print("Dork Selection:")
print("1. GitHub")
print("2. Google")
print("3. Both")
selection = input("Enter your choice (1, 2, or 3): ")
# Load dorks based on user selection
if selection == '1':
print("======GITHUB DORKS STARTING======")
github_urls = load_dorks('githubdorks.txt', "https://github.com/search?q={}{line}{}",
"&s=indexed&type=Code")
urls = github_urls
elif selection == '2':
print("======GOOGLE DORKS STARTING======")
google_urls = load_dorks('googledorks.txt', "https://www.google.com/search?q=site:{}{}")
urls = google_urls
else:
print("======GITHUB DORKS STARTING======")
github_urls = load_dorks('githubdorks.txt', "https://github.com/search?q={}{line}{}",
"&s=indexed&type=Code")
print("======GOOGLE DORKS STARTING======")
google_urls = load_dorks('googledorks.txt', "https://www.google.com/search?q=site:{}{}")
urls = github_urls + google_urls
# Check URLs and save results
results = []
# Check URLs with loading animation
print("\nChecking URLs...")
with tqdm(total=len(urls), unit='URL', ncols=80, dynamic_ncols=True) as pbar:
start_time = time.time()
for i, url in enumerate(urls):
if check_url(url):
results.append(url)
time.sleep(0.1) # Add a small delay for smoother animation
pbar.update(1)
progress_percentage = (i + 1) / len(urls) * 100
if progress_percentage % 5 == 0:
# Save the results to result.txt every 5%
with open('result.txt', 'w') as file:
file.write('\n'.join(results))
elapsed_time = time.time() - start_time
remaining_time = (elapsed_time / (i + 1) * (len(urls) - (i + 1))) - elapsed_time
pbar.set_postfix({'Elapsed Time': f'{elapsed_time:.1f}s', 'Remaining Time': f'{remaining_time:.1f}s'})
# Save the final results to result.txt
with open('result.txt', 'w') as file:
file.write('\n'.join(results))
print("\n======DORKS CHECKING ENDED======")