Projects STRLCPY opensquat Commits 9cf39d8e
🤬
  • ■ ■ ■ ■ ■ ■
    opensquat/app.py
    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 + def is_site_reachable(self, domain):
     393 + """
     394 + Check if site is reachable in HTTPS
     395 + 
     396 + Args:
     397 + domain name: domain name to search
     398 + 
     399 + Returns 2-length tuple:
     400 + Site reachable -> bool
     401 + Error string -> str
     402 + """
     403 + try:
     404 + response = requests.get(f"https://{domain}")
     405 + self.response = response
     406 + output = (True, f"Reachable ({response.status_code})")
     407 + print(Fore.GREEN + f"[+] https://{domain}/: Site reachable ({response.status_code})"+ Style.RESET_ALL)
     408 + except Exception as e:
     409 + output = (False, f"Not reachable: {e}")
     410 + print(Fore.YELLOW + f"[*] {e}" + Style.RESET_ALL)
     411 + return output
     412 + 
     413 + def response_contains_keyword(self, keyword):
     414 + """
     415 + Check if response contains a specific keyword in response
     416 + 
     417 + Args:
     418 + keyword: keyword to search
     419 + 
     420 + Returns:
     421 + bool
     422 + """
     423 + return keyword in self.response.text
     424 + 
    391 425   def _process_doppelgagner_only(self, keyword, domain, domains):
    392 426   def print_info(_info):
    393 427   print(
    skipped 7 lines
    401 435   doppelganger = self.domain_contains(keyword, domain)
    402 436   
    403 437   if doppelganger:
     438 + reachable = self.is_site_reachable(domains)[0]
     439 + if self.response_contains_keyword(keyword):
     440 + print_info(f"Site contains {keyword} !")
    404 441   if not ct.CRTSH.check_certificate(domains):
    405 442   print_info("suspicious certificate detected")
    406 443   else:
    skipped 191 lines
Please wait...
Page is in error, reload to recover