|
22 | 22 | sys.exit() |
23 | 23 |
|
24 | 24 | def establishing_dork_db_connection(dorking_flag): |
25 | | - if dorking_flag == 'basic': |
26 | | - dorking_db_path = 'dorking//basic_dorking.db' |
27 | | - table = 'basic_dorks' |
28 | | - elif dorking_flag == 'iot': |
29 | | - dorking_db_path = 'dorking//iot_dorking.db' |
30 | | - table = 'iot_dorks' |
31 | | - elif dorking_flag == 'files': |
32 | | - dorking_db_path = 'dorking//files_dorking.db' |
33 | | - table = 'files_dorks' |
| 25 | + dorking_db_paths = { |
| 26 | + 'basic': 'dorking//basic_dorking.db', |
| 27 | + 'iot': 'dorking//iot_dorking.db', |
| 28 | + 'files': 'dorking//files_dorking.db', |
| 29 | + 'admins': 'dorking//adminpanels_dorking.db', |
| 30 | + 'web': 'dorking//webstructure_dorking.db', |
| 31 | + } |
| 32 | + dorking_tables = { |
| 33 | + 'basic': 'basic_dorks', |
| 34 | + 'iot': 'iot_dorks', |
| 35 | + 'files': 'files_dorks', |
| 36 | + 'admins': 'admins_dorks', |
| 37 | + 'web': 'web_dorks', |
| 38 | + } |
| 39 | + if dorking_flag in dorking_db_paths: |
| 40 | + dorking_db_path = dorking_db_paths[dorking_flag] |
| 41 | + table = dorking_tables[dorking_flag] |
| 42 | + elif dorking_flag.startswith('custom'): |
| 43 | + lst = dorking_flag.split('+') |
| 44 | + dorking_db_name = lst[1] |
| 45 | + dorking_db_path = 'dorking//' + dorking_db_name |
| 46 | + table = 'dorks' |
| 47 | + else: |
| 48 | + raise ValueError(f"Invalid dorking flag: {dorking_flag}") |
34 | 49 | return dorking_db_path, table |
35 | 50 |
|
36 | 51 | class DataProcessing(): |
37 | 52 | def report_preprocessing(self, short_domain, report_file_type): |
38 | 53 | report_ctime = datetime.now().strftime('%d-%m-%Y, %H:%M:%S') |
39 | 54 | files_ctime = datetime.now().strftime('(%d-%m-%Y, %Hh%Mm%Ss)') |
40 | 55 | files_body = short_domain.replace(".", "") + '_' + files_ctime |
41 | | - if report_file_type == 'pdf': |
42 | | - casename = files_body + '.pdf' |
43 | | - elif report_file_type == 'xlsx': |
44 | | - casename = files_body + '.xlsx' |
45 | | - elif report_file_type == 'html': |
46 | | - casename = files_body + '.html' |
| 56 | + casename = f"{files_body}.{report_file_type}" |
47 | 57 | foldername = files_body |
48 | 58 | db_casename = short_domain.replace(".", "") |
49 | 59 | now = datetime.now() |
50 | 60 | db_creation_date = str(now.year) + str(now.month) + str(now.day) |
51 | | - report_folder = "report_{}".format(foldername) |
52 | | - robots_filepath = report_folder + '//01-robots.txt' |
53 | | - sitemap_filepath = report_folder + '//02-sitemap.txt' |
54 | | - sitemap_links_filepath = report_folder + '//03-sitemap_links.txt' |
| 61 | + report_folder = f"report_{foldername}" |
| 62 | + robots_filepath = os.path.join(report_folder, '01-robots.txt') |
| 63 | + sitemap_filepath = os.path.join(report_folder, '02-sitemap.txt') |
| 64 | + sitemap_links_filepath = os.path.join(report_folder, '03-sitemap_links.txt') |
55 | 65 | os.makedirs(report_folder, exist_ok=True) |
56 | 66 | return casename, db_casename, db_creation_date, robots_filepath, sitemap_filepath, sitemap_links_filepath, report_file_type, report_folder, files_ctime, report_ctime |
57 | 67 |
|
@@ -129,20 +139,9 @@ def data_gathering(self, short_domain, url, report_file_type, pagesearch_flag, k |
129 | 139 | pass |
130 | 140 |
|
131 | 141 | if dorking_flag == 'none': |
132 | | - pass |
133 | 142 | dorking_status = 'Google Dorking mode was not selected for this scan' |
134 | 143 | dorking_file_path = 'Google Dorking mode was not selected for this scan' |
135 | | - elif dorking_flag == 'basic': |
136 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
137 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
138 | | - dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
139 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
140 | | - elif dorking_flag == 'iot': |
141 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
142 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
143 | | - dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
144 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
145 | | - elif dorking_flag == 'files': |
| 144 | + else: |
146 | 145 | dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
147 | 146 | print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
148 | 147 | dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
@@ -180,23 +179,12 @@ def data_gathering(self, short_domain, url, report_file_type, pagesearch_flag, k |
180 | 179 | pass |
181 | 180 |
|
182 | 181 | if dorking_flag == 'none': |
183 | | - pass |
184 | 182 | dorking_status = 'Google Dorking mode was not selected for this scan' |
185 | | - dorking_results = 'Google Dorking mode was not selected for this scan' |
186 | | - elif dorking_flag == 'basic': |
187 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
188 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
189 | | - dorking_status, dorking_results = dp.transfer_results_to_xlsx(table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
190 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
191 | | - elif dorking_flag == 'iot': |
192 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
193 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
194 | | - dorking_status, dorking_results = dp.transfer_results_to_xlsx(table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
195 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
196 | | - elif dorking_flag == 'files': |
| 183 | + dorking_file_path = 'Google Dorking mode was not selected for this scan' |
| 184 | + else: |
197 | 185 | dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
198 | 186 | print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
199 | | - dorking_status, dorking_results = dp.transfer_results_to_xlsx(table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
| 187 | + dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
200 | 188 | print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
201 | 189 |
|
202 | 190 | data_array = [ip, res, mails, subdomains, subdomains_amount, social_medias, subdomain_mails, sd_socials, |
@@ -234,20 +222,9 @@ def data_gathering(self, short_domain, url, report_file_type, pagesearch_flag, k |
234 | 222 | pass |
235 | 223 |
|
236 | 224 | if dorking_flag == 'none': |
237 | | - pass |
238 | 225 | dorking_status = 'Google Dorking mode was not selected for this scan' |
239 | 226 | dorking_file_path = 'Google Dorking mode was not selected for this scan' |
240 | | - elif dorking_flag == 'basic': |
241 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
242 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
243 | | - dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
244 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
245 | | - elif dorking_flag == 'iot': |
246 | | - dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
247 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
248 | | - dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
249 | | - print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN END: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
250 | | - elif dorking_flag == 'files': |
| 227 | + else: |
251 | 228 | dorking_db_path, table = establishing_dork_db_connection(dorking_flag.lower()) |
252 | 229 | print(Fore.LIGHTMAGENTA_EX + f"\n[EXTENDED SCAN START: {dorking_flag.upper()} DORKING]\n" + Style.RESET_ALL) |
253 | 230 | dorking_status, dorking_file_path = dp.save_results_to_txt(report_folder, table, dp.get_dorking_query(short_domain, dorking_db_path, table)) |
|
0 commit comments