Change text and recover main.py
This commit is contained in:
parent
956e029729
commit
00067a7c85
|
@ -229,40 +229,6 @@ def cpdashy_2_main():
|
|||
return render_template('main/dashboard_main2.html', total_logs_list=total_logs_list, attack_start_timestamp=attack_start_timestamp, blue_logs_list=blue_logs_list, red_logs_list=red_logs_list, sim_running=sim_running, sim_start_timestamp=sim_start_timestamp, sidebar_html_insert=cpdash_get_sidebar().replace('active_state_class2', 'is-active'), profile_picture=user_data['picture'], profile_username=user_data['username'], profile_userid=user_data['userid'], profile_email=user_data['email'])
|
||||
else:
|
||||
return redirect('/login')
|
||||
|
||||
|
||||
@app.route("/d3", methods=['GET']) #victim specs
|
||||
def cpdashy_3_main():
|
||||
if current_user.is_authenticated:
|
||||
userid = str(current_user.name).replace("user","").replace("User","").replace("USER","")
|
||||
with open(f'database/users/{userid}/user.json','r') as f:
|
||||
user_data = json.load(f)
|
||||
|
||||
if not os.path.exists("database/temp/attack_start.txt"):
|
||||
attack_start_timestamp = "0"
|
||||
else:
|
||||
with open("database/temp/attack_start.txt","r") as f:
|
||||
attack_start_timestamp = int(f.read().split(".")[0])
|
||||
|
||||
min, sec = divmod(time.time() - int(attack_start_timestamp),60)
|
||||
attack_start_timestamp = str(int(min)) + "m " + str(int(round(sec,0))) + "s"
|
||||
|
||||
if attack_start_timestamp == "0":
|
||||
reachable = "<b style='color: green'>True</b>"
|
||||
cpu_percentage = random.choice(["7%","8%","9%","10%","11%"])
|
||||
ram_percentage = random.choice(["7%","8%","9%","10%","11%"])
|
||||
ports_open = ["80","443"]
|
||||
else:
|
||||
reachable = "<b style='color: green'>True</b>"
|
||||
cpu_percentage = random.choice(["67%","48%","90%","17%","81%"])
|
||||
ram_percentage = random.choice(["19%","8%","9%","10%","11%"])
|
||||
ports_open = ["80","443"]
|
||||
|
||||
|
||||
|
||||
return render_template("main/dashboard_main3.html",reachable=reachable,cpu_percentage=cpu_percentage,ram_percentage=ram_percentage,ports_open=ports_open,attack_start_timestamp=attack_start_timestamp,sidebar_html_insert=cpdash_get_sidebar().replace("active_state_class3","is-active"), profile_picture=user_data["picture"],profile_username=user_data["username"],profile_userid=user_data["userid"],profile_email=user_data["email"])
|
||||
else:
|
||||
return redirect('/login')
|
||||
|
||||
@app.route('/d1/startsim', methods=['GET']) #start and stop the sim
|
||||
def cpdashy_startsim():
|
||||
|
@ -328,8 +294,7 @@ def api_red_logs():
|
|||
temp_json_n['data'] = remote_addr + ': ' + temp_json_n['data']
|
||||
|
||||
if STARTED:
|
||||
print(temp_json_n['data'])
|
||||
if 'start of attack' in temp_json_n['data'].lower():
|
||||
if temp_json_n['data'].lower() == 'start of attack':
|
||||
with open('./database/temp/attack_start.txt', 'w') as f:
|
||||
f.write(str(temp_json_n['timestamp']))
|
||||
|
||||
|
@ -371,4 +336,4 @@ def custom_404(error):
|
|||
clear_session_full()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='185.78.255.231', threaded=True,use_reloader=True, port=443, ssl_context=('/etc/letsencrypt/live/network.kyudev.xyz/fullchain.pem', '/etc/letsencrypt/live/network.kyudev.xyz/privkey.pem'))
|
||||
app.run(host='0.0.0.0', threaded=True, use_reloader=True, port=8088)
|
||||
|
|
|
@ -1303,7 +1303,7 @@
|
|||
<div class="videos">
|
||||
<div class="video anim" style="--delay: .4s">
|
||||
<a href="#" style="text-decoration: none;color: #ff66d9;">
|
||||
<div class="video-by" title="Time elapsed since the Attack started">Time elapsed since start of attack</div>
|
||||
<div class="video-by" title="Time since the Attack started">Time elapsed since start of attack</div>
|
||||
{% autoescape false %}
|
||||
<div class="video-name padding_stat_n" id="attackstart" data-start="{{ attack_start_timestamp }}">0</div>
|
||||
{% endautoescape %}
|
||||
|
@ -1311,7 +1311,7 @@
|
|||
</div>
|
||||
<div class="video anim" style="--delay: .45s">
|
||||
<a href="#" style="text-decoration: none;color: #ff66d9;">
|
||||
<div class="video-by" title="Time since the sim started">Time elapsed since start of simulation</div>
|
||||
<div class="video-by" title="Time the sim started">Time elapsed since start of simulation</div>
|
||||
{% autoescape false %}
|
||||
<div class="video-name padding_stat_n" id="simstart" data-start="{{ sim_start_timestamp }}">0</div>
|
||||
{% endautoescape %}
|
||||
|
|
Loading…
Reference in New Issue