Victim stats

This commit is contained in:
KyuDev 2023-04-14 07:56:51 +02:00
parent 4026797940
commit da11198fdc
4 changed files with 1374 additions and 1 deletions

View File

@ -246,6 +246,40 @@ 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():

View File

@ -8,7 +8,7 @@
<meta name="title" content="CyberRange">
<meta name="description" content="Teach and Test you employee about cyber attacks">
<!-- <meta http-equiv="refresh" content="3"> -->
<meta http-equiv="refresh" content="3">
<style>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap");

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,12 @@
<svg class="svg-icon" viewBox="0 0 20 20" fill="currentColor"><path d="M16 17a3 3 0 01-3 3H3a3 3 0 01-3-3v-1.5A1.5 1.5 0 011.5 14H3V4a3 3 0 013-3h11a3 3 0 110 6h-1v10zM5 4a1 1 0 011-1h8.17c-.11.313-.17.65-.17 1v13a1 1 0 11-2 0v-3H5V4zm12-1a1 1 0 00-1 1v1h1a1 1 0 100-2zm-7 14c0 .35.06.687.17 1H3a1 1 0 01-1-1v-1h8v1z"/> </svg>
Logs
</a>
<a class="sidebar-link discover active_state_class3" href="/d3">
<svg class="svg-icon" viewBox="0 0 32 32" fill="currentColor"><path class="linesandangles_een" d="M6,4v12.82c0,3.788,2.14,7.25,5.528,8.944L16,28l4.472-2.236C23.86,24.07,26,20.607,26,16.82V4
H6z M24,14h-7V6h7V14z M15,6v8H8V6H15z M8,16.82V16h7v9.264l-2.578-1.289C9.695,22.611,8,19.869,8,16.82z M19.578,23.975L17,25.264
V16h7v0.82C24,19.869,22.305,22.611,19.578,23.975z"/> </svg>
Victim
</a>
</div>
</div>
<div class="side-wrapper">