Skip to content

Commit bf84ae4

Browse files
authored
Merge pull request #83 from TaroballzChen/master
solve the SSL cert verify failed issue
2 parents 3fa6cfb + 8c5ac08 commit bf84ae4

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

ghdb_scraper.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Standard Python libraries.
44
import argparse
55
import json
6+
import urllib3
67

78
# Third party Python libraries.
89
from bs4 import BeautifulSoup
@@ -11,7 +12,7 @@
1112
# Custom Python libraries.
1213

1314

14-
__version__ = "1.0.0"
15+
__version__ = "1.1.0"
1516

1617
"""
1718
Dork dictionary example:
@@ -63,7 +64,21 @@ def retrieve_google_dorks(
6364
}
6465

6566
print(f"[+] Requesting URL: {url}")
66-
response = requests.get(url, headers=headers, timeout=10)
67+
try:
68+
response = requests.get(
69+
url,
70+
headers=headers,
71+
timeout=10,
72+
)
73+
except requests.exceptions.SSLError:
74+
requests.packages.urllib3.disable_warnings()
75+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
76+
response = requests.get(
77+
url,
78+
headers=headers,
79+
timeout=10,
80+
verify=False,
81+
)
6782

6883
if response.status_code != 200:
6984
print(f"[-] Error retrieving google dorks from: {url}")
@@ -84,7 +99,6 @@ def retrieve_google_dorks(
8499

85100
# Loop through dorks, collecting and organizing them.
86101
for dork in json_dorks:
87-
88102
# Extract dork from <a href> using BeautifulSoup.
89103
# "<a href=\"/ghdb/5052\">inurl:_cpanel/forgotpwd</a>"
90104
soup = BeautifulSoup(dork["url_title"], "html.parser")
@@ -99,7 +113,6 @@ def retrieve_google_dorks(
99113

100114
# Create an empty list for each category if it doesn't already exist.
101115
if numeric_category_id not in category_dict:
102-
103116
category_dict[numeric_category_id] = {"category_name": category_name, "dorks": []}
104117

105118
# Some of the URL titles have trailing tabs, use replace() to remove it in place. The strip() method cannot be
@@ -110,12 +123,10 @@ def retrieve_google_dorks(
110123

111124
# If requested, break up dorks into individual files based off category.
112125
if save_individual_categories_to_files:
113-
114126
# Sort category_dict based off the numeric keys.
115127
category_dict = dict(sorted(category_dict.items()))
116128

117129
for key, value in category_dict.items():
118-
119130
# Provide some category metrics.
120131
print(f"[*] Category {key} ('{value['category_name']}') has {len(value['dorks'])} dorks")
121132

@@ -163,7 +174,6 @@ def retrieve_google_dorks(
163174

164175

165176
if __name__ == "__main__":
166-
167177
categories = {
168178
1: "Footholds",
169179
2: "File Containing Usernames",

pagodo.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ def go(self):
154154
}
155155

156156
for dork in self.google_dorks:
157-
158157
self.pagodo_results_dict["dorks"][dork] = {
159158
"urls_size": 0,
160159
"urls": [],
@@ -237,7 +236,6 @@ def go(self):
237236

238237
# Google dork results found.
239238
if dork_urls_list:
240-
241239
self.log.info(f"Results: {dork_urls_list_size} URLs found for Google dork: {dork}")
242240

243241
dork_urls_list_as_string = "\n".join(dork_urls_list)
@@ -307,7 +305,6 @@ def _split_lines(self, text, width):
307305

308306

309307
if __name__ == "__main__":
310-
311308
parser = argparse.ArgumentParser(
312309
description=f"pagodo - Passive Google Dork v{__version__}",
313310
formatter_class=SmartFormatter,

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
beautifulsoup4==4.11.1
2-
requests==2.28.2
3-
yagooglesearch==1.6.1
1+
beautifulsoup4==4.12.2
2+
requests==2.31.0
3+
yagooglesearch==1.7.0

0 commit comments

Comments
 (0)