Move to single datastore dict, instead of list; add pdb.

master
josiah 4 years ago
parent 8679a9ee48
commit 2075d715ab

@ -8,6 +8,7 @@ import whois
import OpenSSL
import ssl
import time
import pdb
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %I:%M:%S %p',level=logging.INFO,filename='arke.log')
logger = logging.getLogger("arke")
@ -73,25 +74,20 @@ is_on = True
while is_on:
today = datetime.today()
datastore = {}
# make sure http targets are /up/
datastore = monitor_HttpTargets(arkevars.httpTargets)
json_string = json.dumps(datastore)
datastore['http'] = monitor_HttpTargets(arkevars.httpTargets)
# get SSL certs on http targets
cert_info = monitor_TlsExpiry(arkevars.tlsTargets)
cert_json = json.dumps(cert_info)
datastore['certs'] = monitor_TlsExpiry(arkevars.tlsTargets)
# get whois info on domain targets
domain_info = monitor_DomainExpiry(arkevars.domains_to_check)
domain_json = json.dumps(domain_info)
datastore['whois'] = monitor_DomainExpiry(arkevars.domains_to_check)
# write new results to file
file = open(this_round_file, "a+")
file.write(json_string)
file.write(cert_json)
file.write(domain_json)
file.close()
with open(this_round_file, "a+", encoding="utf-8") as outfile:
json.dump(datastore, outfile, ensure_ascii=False, sort_keys=True)
# track state
file = open(this_round_file, "r")

Loading…
Cancel
Save