import string import smtplib import datetime import subprocess from copy import copy from base import itop_pull, healthcheckauth import xml.etree.ElementTree as ET today = datetime.datetime.today() email_to = "*****@*****.**" email_from = "*****@*****.**" email_subject = "Authenication Health Check Report: %s" % today email_relay_host = "relay.example.com" # pull list to check itop_pull("/root/commandcentral/serverlist/auth_health_check_serverlist") # check server status and return auth log file auth_filename = healthcheckauth("/root/commandcentral/serverlist/auth_health_check_serverlist") with open(auth_filename) as f: serverlist = f.read().splitlines() failures_list = [x for x in serverlist if "okay" not in x and "whitelisted" not in x] email_text = "The following servers have authenication issues: \n\n%s" % "\t\n".join(failures_list) email_body = string.join(( "From: %s" % email_from, "To: %s" % email_to, "Subject: %s" % email_subject, "",
#!/usr/bin/python from base import itop_pull itop_pull("/root/commandcentral/serverlist/serverlist") # Adding some stuff to open a PR. Forgive me Leon I'm lazy
import string import smtplib import datetime import subprocess from copy import copy from base import itop_pull import xml.etree.ElementTree as ET today = datetime.datetime.today() email_to = "*****@*****.**" email_from = "*****@*****.**" email_subject = "FTP Anon Report: %s" % today email_relay_host = "relay.example.com" # pull list to nmap itop_pull("/root/commandcentral/serverlist/ftp_anon_serverlist") # define devnull devnull = open(os.devnull, "w") # nmap those servers for telnet subprocess.call( [ "nmap", "-p21", "--script", "ftp-anon", "-oX", "/root/commandcentral/prod/nmap_xml/ftp_anon_output.xml", "-iL", "/root/commandcentral/serverlist/ftp_anon_serverlist",