Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/opt/imh-python/bin/python2.7
- '''
- This script checks domains in /etc/trueuserdomains
- and looks for obvious fraud or phishing domains
- '''
- import smtplib
- from smtplib import SMTP
- __version__ = 'v0.1 Domain Checker'
- __author__ = 'Riley'
- def main():
- '''
- check for suspicious domain names
- '''
- # output basic program information and initialize.
- # TODO: Pass keywords from a possible json list rather than the code.
- print __version__
- match_found = False
- warning = ('WARNING! SUSPICIOUS DOMAINS FOUND!\n'
- 'Sending notification to str@imhadmin.net...')
- definitions = ['spam', 'bank', 'paypal']
- matches = []
- # open /etc/trueuserdomains and check every line
- # for any match in the definitions
- # add any match to the matches list
- with open("/etc/trueuserdomains", "r") as domains:
- for line in domains:
- for item in definitions:
- if item in line:
- match_text = 'Match: ' + line + 'contains' + item
- print match_text
- matches.append(match_text)
- match_found = True
- # If matches are found,send an str with the match_text via smtp
- if match_found:
- smtp = SMTP()
- smtp.connect('mail.imhadmin.net', 25)
- smtp.login('lamar@imhadmin.net', 'editedforpublic')
- from_email = 'no-reply@imhadmin.net'
- to_email = 'str@imhadmin.net'
- msg_text = 'Possible fraudulent or phishing domains found!'
- msg = 'Found suspicious domains on' + match_text
- smtp.sendmail(from_email, to_email, msg_text, msg)
- smtp.quit()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement