commit d3d5301dbe0b94565bd4ed58a9d0b1a515a42ed2 Author: Graham Helton Date: Mon Jan 2 18:13:57 2023 -0500 Initial Commit diff --git a/protonID.py b/protonID.py new file mode 100755 index 0000000..9978441 --- /dev/null +++ b/protonID.py @@ -0,0 +1,62 @@ +#!/usr/bin/python3 +import dns.resolver +import argparse +import sys +from colorama import Fore,Style +# Define colors and lists +domains = [] +reset = Style.RESET_ALL +green = Fore.GREEN +purple = Fore.MAGENTA +red = Fore.RED +sep = Fore.BLUE + "---------------------------" + reset +info = Fore.BLUE + "[" + Fore.GREEN + "+" + Fore.BLUE + "]"+ reset +info_bad = Fore.RED+ "[" + Fore.YELLOW+ "!" + Fore.RED+ "]"+ reset + +def parse_args(): + '''Gets arguments from command line''' + parser = argparse.ArgumentParser(usage="\n python3 protonID.py -e email@example.com \n python3 protonID.py -l emails.txt", + description="ProtonID: Check if an email address or domain uses protonmail.") + parser.add_argument('-e', '--email', action='store', help="Check a single email") + parser.add_argument('-l', '--list', action='store', help="Checks every domain in a list.") + print(parser.print_help()) + return parser.parse_args() + +args = parse_args() + +def split_email(email): + '''If arguments have an @ in them, remove text up to and including the @''' + if '@' in email: + email = email.split('@',1)[1] + domains.append(email) + return domains + +def dns_query(domains): + '''Queries MX records to check if protonmail exists in them''' + for x in dns.resolver.resolve(domains,'MX'): + if 'protonmail' in x.to_text(): + print(sep) + print(info,green,domains,"has proton mail MX records.",reset) + print(info," Printing proton MX record...") + print(info," ",purple,x.to_text()) + print(sep) + break + else: + print(info_bad,domains,"does not have proton mx records") + +if args.list: + try: + with open(args.list) as email_list: + lines = [line.rstrip() for line in email_list] + + for i in range(len(lines)): + split_email(lines[i]) + dns_query(domains[i]) + + except: + print(info_bad,"Error:",red,args.list,reset,"not found. Did you specify the correct file name?") + +if args.email: + split_email(args.email) + print(domains) + dns_query(domains[0])