■ ■ ■ ■ ■ ■
modules/RelatedDomains.py
| skipped 4 lines |
5 | 5 | | def RelatedDomains(mail,_verbose=None): |
6 | 6 | | if _verbose != None: |
7 | 7 | | try: |
8 | | - | u = "https://www.threatcrowd.org/searchApi/v2/email/report/?email="+mail |
9 | | - | response = requests.get(u) |
10 | | - | html = response.content |
11 | | - | lp = json.loads(html) |
12 | | - | print(f"{bcolors.BOLD}Related Domains:{bcolors.ENDC}") |
13 | | - | for x in lp['domains']: |
14 | | - | print(x) |
| 8 | + | res = requests.get(f"https://www.threatcrowd.org/searchApi/v2/email/report/?email={mail}").json() |
| 9 | + | domains = res.get('domains') or [] |
| 10 | + | if len(domains): |
| 11 | + | print(f"{bcolors.BOLD}Related Domains:{bcolors.ENDC}") |
| 12 | + | for domain in domains: |
| 13 | + | print(domain) |
| 14 | + | else: |
| 15 | + | print(f"{bcolors.FAIL}No related domains found!{bcolors.ENDC}") |
15 | 16 | | except: |
16 | | - | print(f"{bcolors.FAIL}Domain not found!{bcolors.ENDC}") |
| 17 | + | print(f"{bcolors.FAIL}Threatcrowd Error!{bcolors.ENDC}") |
17 | 18 | | |