| skipped 96 lines |
97 | 97 | | |
98 | 98 | | return False |
99 | 99 | | |
| 100 | + | |
100 | 101 | | def read_files(self): |
101 | 102 | | """ |
102 | 103 | | Method to read domain files |
| skipped 285 lines |
388 | 389 | | |
389 | 390 | | return self.list_domains |
390 | 391 | | |
| 392 | + | # Check if site is reachable. |
| 393 | + | # Returns a tuple -> (is_reachable: bool, description: str) |
| 394 | + | def is_site_reachable(self, domain): |
| 395 | + | output = (False, "Not reachable") |
| 396 | + | try: |
| 397 | + | response = requests.get(f"https://{domain}") |
| 398 | + | self.response = response |
| 399 | + | output = (True, f"Reachable ({response.status_code})") |
| 400 | + | print(Fore.GREEN + f"[+] https://{domain}/: Site reachable ({response.status_code})"+ Style.RESET_ALL) |
| 401 | + | except Exception as e: |
| 402 | + | output = (False, f"Not reachable: {e}") |
| 403 | + | print(Fore.YELLOW + f"[*] {e}" + Style.RESET_ALL) |
| 404 | + | return output |
| 405 | + | |
| 406 | + | def response_contains_keyword(self, keyword): |
| 407 | + | return keyword in self.response.text |
| 408 | + | |
391 | 409 | | def _process_doppelgagner_only(self, keyword, domain, domains): |
392 | 410 | | def print_info(_info): |
393 | 411 | | print( |
| skipped 7 lines |
401 | 419 | | doppelganger = self.domain_contains(keyword, domain) |
402 | 420 | | |
403 | 421 | | if doppelganger: |
| 422 | + | reachable = self.is_site_reachable(domains)[1] |
| 423 | + | if self.response_contains_keyword(keyword): |
| 424 | + | print_info(f"Site contains {self.text_to_search} !") |
404 | 425 | | if not ct.CRTSH.check_certificate(domains): |
405 | 426 | | print_info("suspicious certificate detected") |
406 | 427 | | else: |
| skipped 191 lines |