Skip to content

Commit d96ebce

Browse files
Updated dorking_processor.py to 0.9rc1
1 parent edd185b commit d96ebce

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

modules/dorking_processor.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import requests.exceptions
2-
from colorama import Fore, Style
3-
import mechanicalsoup
4-
import re
5-
import requests
1+
import sys
2+
3+
try:
4+
import requests.exceptions
5+
from colorama import Fore, Style
6+
import mechanicalsoup
7+
import re
8+
import requests
9+
except ImportError as e:
10+
print(Fore.RED + "Import error appeared. Reason: {}".format(e) + Style.RESET_ALL)
11+
sys.exit()
612

713
def get_dorking_query(short_domain):
814
print(Fore.GREEN + "Getting dorking query from config file")
@@ -34,8 +40,9 @@ def solid_google_dorking(query, pages=10):
3440
break
3541
del result_query[-2:]
3642
return result_query
37-
except requests.exceptions.ConnectionError:
38-
print(Fore.RED + "Error while establishing connection with domain. No results will appear" + Style.RESET_ALL)
43+
except requests.exceptions.ConnectionError as e:
44+
print(Fore.RED + "Error while establishing connection with domain. No results will appear. Reason: {}".format(e) + Style.RESET_ALL)
45+
return "Google Dorking results file was not created"
3946

4047
def save_results_to_txt(folderpath, queries, pages=10):
4148
txt_writepath = folderpath + '//04-dorking_results.txt'
@@ -51,4 +58,3 @@ def save_results_to_txt(folderpath, queries, pages=10):
5158
f.write("\n")
5259
print(Fore.GREEN + "Google Dorking results successfully saved in TXT file" + Style.RESET_ALL)
5360
return "File with gathered links was successfully created"
54-

0 commit comments

Comments
 (0)