-
Notifications
You must be signed in to change notification settings - Fork 8
/
dorks_search.py
52 lines (43 loc) · 1.41 KB
/
dorks_search.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
"""
Title: profiler
Author: Mădălin Dogaru
Discord: techblade.
Date: 25-03-2023
Version: v0.1
License: GPLv3
Description: A Red Teaming tool focused on profiling the target.
"""
import os
from serpapi import GoogleSearch
def read_dorks_from_file(file_path):
with open(file_path, 'r') as f:
dorks = [line.strip() for line in f]
return dorks
def google_dork(domain, dorks_file):
if not os.path.isfile(dorks_file):
print(f"\033[91mError: The file '{dorks_file}' does not exist. Please provide a valid file path.\033[0m")
return
dorks = read_dorks_from_file(dorks_file)
# Replace "your_api_key" with your SerpApi key
api_key = "your_api_key"
for dork in dorks:
dork_with_site = f"site:{domain} {dork}"
params = {
"q": dork_with_site,
"api_key": "your_api_key",
}
search = GoogleSearch(params)
results = search.get_dict()
found_links = set()
if 'organic_results' in results:
for link in results['organic_results']:
url = link['link']
if domain in url:
found_links.add(url)
if found_links:
print(f"\033[32m+++ RESULTS: {dork_with_site}\033[0m")
for link in found_links:
print(link)
print()
else:
print(f"\033[91m--- NO RESULTS FOR: {dork_with_site}\033[0m\n")