Fix error to break the counter

This commit is contained in:
cubernetes 2023-04-14 08:49:49 +02:00
parent 9ba2db7aa1
commit ee0e95cfd0
2 changed files with 2 additions and 3 deletions

View File

@ -245,7 +245,6 @@ def cpdashy_startsim():
f.write(str(int(time.time()))) f.write(str(int(time.time())))
with open('./database/temp/sim_running.txt', 'w') as f: with open('./database/temp/sim_running.txt', 'w') as f:
f.write('True') f.write('True')
else: else:
clear_session_full() clear_session_full()
with open('./database/temp/sim_start.txt', 'w') as f: with open('./database/temp/sim_start.txt', 'w') as f:
@ -294,7 +293,7 @@ def api_red_logs():
temp_json_n['data'] = remote_addr + ': ' + temp_json_n['data'] temp_json_n['data'] = remote_addr + ': ' + temp_json_n['data']
if STARTED: if STARTED:
if temp_json_n['data'].lower() == 'start of attack': if 'start of attack' in temp_json_n['data'].lower():
with open('./database/temp/attack_start.txt', 'w') as f: with open('./database/temp/attack_start.txt', 'w') as f:
f.write(str(temp_json_n['timestamp'])) f.write(str(temp_json_n['timestamp']))

View File

@ -1609,7 +1609,7 @@
const iid = setInterval(() => { const iid = setInterval(() => {
let start = parseInt(document.getElementById("simstart").getAttribute("data-start")); let start = parseInt(document.getElementById("simstart").getAttribute("data-start"));
let end = ~~(Date.now()/1e3); let end = ~~(Date.now()/1e3);
if (start === -1 || document.getElementById('start_stop_sim_btn').innerHTML === 'Start Simulation' || document.getElementById("attackstart").getAttribute("data-start") === "-1") { if (start === -1 || document.getElementById('start_stop_sim_btn').innerHTML === 'Start Simulation') {
document.getElementById("simstart").innerHTML = "0"; document.getElementById("simstart").innerHTML = "0";
} else { } else {
document.getElementById("simstart").innerHTML = end - start; document.getElementById("simstart").innerHTML = end - start;