|
|
|
@ -90,24 +90,27 @@ while is_on:
|
|
|
|
|
json.dump(datastore, outfile, ensure_ascii=False, sort_keys=True)
|
|
|
|
|
|
|
|
|
|
# track state
|
|
|
|
|
file = open(this_round_file, "r")
|
|
|
|
|
if os.path.exists(last_round_file):
|
|
|
|
|
stateFile = open(last_round_file, "r")
|
|
|
|
|
else:
|
|
|
|
|
stateFile = open(last_round_file, "w+")
|
|
|
|
|
|
|
|
|
|
oldData = stateFile.read()
|
|
|
|
|
if oldData != file.read():
|
|
|
|
|
stateChanged = True
|
|
|
|
|
else:
|
|
|
|
|
stateChanged = False
|
|
|
|
|
with open(this_round_file, "a+", encoding="utf-8") as file:
|
|
|
|
|
if os.path.exists(last_round_file):
|
|
|
|
|
stateFile = open(last_round_file, "r")
|
|
|
|
|
else:
|
|
|
|
|
stateFile = open(last_round_file, "w+")
|
|
|
|
|
|
|
|
|
|
oldData = stateFile.read()
|
|
|
|
|
if oldData != file.read():
|
|
|
|
|
stateChanged = True
|
|
|
|
|
else:
|
|
|
|
|
stateChanged = False
|
|
|
|
|
|
|
|
|
|
stateFile.close()
|
|
|
|
|
|
|
|
|
|
# delete state.log so I can write to it cleanly
|
|
|
|
|
os.remove(last_round_file)
|
|
|
|
|
|
|
|
|
|
# queue up an alert if stateChanged = True
|
|
|
|
|
results = []
|
|
|
|
|
with open(this_round_file, "r") as json_File:
|
|
|
|
|
with open(this_round_file, "r+", encoding="utf-8") as json_File:
|
|
|
|
|
pdb.set_trace()
|
|
|
|
|
json_data = json.load(json_File)
|
|
|
|
|
for item in json_data:
|
|
|
|
|
results.append(item)
|
|
|
|
@ -119,10 +122,9 @@ while is_on:
|
|
|
|
|
errorFile.write(errorText)
|
|
|
|
|
|
|
|
|
|
# Copy current results to state.log file for next iteration
|
|
|
|
|
errorFile = open(last_round_file, "a+")
|
|
|
|
|
errorFile.write(json_string)
|
|
|
|
|
errorFile.write(cert_json)
|
|
|
|
|
errorFile.write(domain_json)
|
|
|
|
|
errorFile.close()
|
|
|
|
|
with open(last_round_file, "a+") as json_File:
|
|
|
|
|
json_datastore = json.dumps(datastore, ensure_ascii=False, sort_keys=True)
|
|
|
|
|
json_File.write(json_datastore)
|
|
|
|
|
|
|
|
|
|
os.remove(this_round_file)
|
|
|
|
|
time.sleep(60)
|
|
|
|
|