From 00067a7c854c44f15dd17ca53a1af50ec4ed0153 Mon Sep 17 00:00:00 2001 From: cubernetes Date: Fri, 14 Apr 2023 08:36:17 +0200 Subject: [PATCH] Change text and recover main.py --- webserver/main.py | 39 +------------------ webserver/templates/main/dashboard_main1.html | 4 +- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/webserver/main.py b/webserver/main.py index c0ce366..5cc892a 100755 --- a/webserver/main.py +++ b/webserver/main.py @@ -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 = "True" - cpu_percentage = random.choice(["7%","8%","9%","10%","11%"]) - ram_percentage = random.choice(["7%","8%","9%","10%","11%"]) - ports_open = ["80","443"] - else: - reachable = "True" - 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) diff --git a/webserver/templates/main/dashboard_main1.html b/webserver/templates/main/dashboard_main1.html index 82cf4f0..9eed679 100644 --- a/webserver/templates/main/dashboard_main1.html +++ b/webserver/templates/main/dashboard_main1.html @@ -1303,7 +1303,7 @@