Last active
June 8, 2019 15:01
-
-
Save stefanocoding/547b7836d73009f3dbb1223cbbe97d07 to your computer and use it in GitHub Desktop.
Revisions
-
stefanocoding revised this gist
Feb 23, 2019 . No changes.There are no files selected for viewing
-
stefanocoding revised this gist
Feb 23, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ #!/usr/bin/python3 # Example usage: ./does_email_address_exist.py twitter.com jack import argparse from smtplib import SMTP import dns.resolver -
stefanocoding created this gist
Feb 23, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #!/usr/bin/python3 import argparse from smtplib import SMTP import dns.resolver parser = argparse.ArgumentParser() parser.add_argument('hostname') parser.add_argument('user') args = parser.parse_args() hostname = args.hostname user = args.user mx_records = dns.resolver.query(hostname, 'MX') server = str(mx_records[0].exchange) with SMTP(server, local_hostname=hostname) as smtp: smtp.helo() smtp.docmd('mail from: <[email protected]>') code, text = smtp.docmd('rcpt to: <'+user+'@'+hostname+'>') if code == 550: print('it does not') else: print('it does exist')