nachti
This commit is contained in:
parent
02fd033000
commit
4026797940
|
@ -170,12 +170,83 @@ def cpdashy_1_main():
|
|||
|
||||
blue_logs_list.reverse()
|
||||
red_logs_list.reverse()
|
||||
total_logs_list.reverse()
|
||||
# total_logs_list.reverse()
|
||||
|
||||
return render_template("main/dashboard_main1.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_class1","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("/d2", methods=['GET']) #logs
|
||||
def cpdashy_2_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/sim_running.txt"):
|
||||
sim_running = "False"
|
||||
else:
|
||||
with open("database/temp/sim_running.txt","r") as f:
|
||||
sim_running = f.read()
|
||||
|
||||
if not os.path.exists("database/temp/sim_start.txt"):
|
||||
sim_start_timestamp = "0"
|
||||
else:
|
||||
with open("database/temp/sim_start.txt","r") as f:
|
||||
sim_start_timestamp_stamp = int(f.read().split(".")[0])
|
||||
|
||||
min, sec = divmod(time.time() - int(sim_start_timestamp_stamp),60)
|
||||
sim_start_timestamp = str(int(min)) + "m " + str(int(round(sec,0))) + "s"
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
|
||||
|
||||
with open("database/logs/blue.json","r") as f:
|
||||
blue_logs_list_ori = json.load(f)
|
||||
blue_logs_list = []
|
||||
for blue_log_now in blue_logs_list_ori:
|
||||
min, sec = divmod(time.time() - int(blue_log_now["timestamp"]),60)
|
||||
blue_log_now["timestamp"] = str(int(min)) + "m " + str(int(round(sec,0))) + "s"
|
||||
blue_log_now["origin"] = "blue"
|
||||
blue_log_now["timeline_class"] = "container_time_right"
|
||||
blue_log_now["timeline_side"] = "right"
|
||||
blue_logs_list.append(blue_log_now)
|
||||
|
||||
with open("database/logs/red.json","r") as f:
|
||||
red_logs_list_ori = json.load(f)
|
||||
red_logs_list = []
|
||||
for red_log_now in red_logs_list_ori:
|
||||
min, sec = divmod(time.time() - int(red_log_now["timestamp"]),60)
|
||||
red_log_now["timestamp"] = str(int(min)) + "m " + str(int(round(sec,0))) + "s"
|
||||
red_log_now["origin"] = "red"
|
||||
red_log_now["timeline_class"] = "container_time"
|
||||
red_log_now["timeline_side"] = "left"
|
||||
red_logs_list.append(red_log_now)
|
||||
|
||||
total_logs_list = []
|
||||
total_logs_list.extend(blue_logs_list)
|
||||
total_logs_list.extend(red_logs_list)
|
||||
total_logs_list.sort(key=extract_time, reverse=True)
|
||||
|
||||
blue_logs_list.reverse()
|
||||
red_logs_list.reverse()
|
||||
total_logs_list.reverse()
|
||||
|
||||
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("/d1/startsim", methods=['GET']) #start and stop the sim
|
||||
def cpdashy_startsim():
|
||||
if current_user.is_authenticated:
|
||||
|
|
|
@ -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");
|
||||
|
@ -1240,6 +1240,8 @@
|
|||
</style>
|
||||
</head>
|
||||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="sidebar">
|
||||
|
@ -1332,53 +1334,13 @@
|
|||
|
||||
|
||||
<div class="main-header anim" style="--delay: 0.6s">Logs</div>
|
||||
<div class="videos">
|
||||
<div class="video anim" style="width: 203%;">
|
||||
<div style="text-decoration: none;color: #ff6666;">
|
||||
<div class="video-by">Attacker</div>
|
||||
<div class="video-name padding_stat_n">
|
||||
<table>
|
||||
{% for red_log_now in red_logs_list %}
|
||||
<tr>
|
||||
{% autoescape false %}
|
||||
<td>{{ red_log_now["timestamp"] }}</td>
|
||||
{% endautoescape %}
|
||||
<td style="color:white;font-size: 20px;">|</td>
|
||||
<td style="color: white;font-weight: 700;">{{ red_log_now["data"] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="video anim" style="width: 0;"></div>
|
||||
<div class="video anim" style="width: 203%;">
|
||||
<div style="text-decoration: none;color: #666eff;">
|
||||
<div class="video-by">Defender</div>
|
||||
<div class="video-name padding_stat_n" style="width: 99%;">
|
||||
<table>
|
||||
{% for blue_log_now in blue_logs_list %}
|
||||
<tr>
|
||||
{% autoescape false %}
|
||||
<td>{{ blue_log_now["timestamp"] }}</td>
|
||||
<td style="color:white;font-size: 20px;">|</td>
|
||||
<td style="color: white;font-weight: 700;word-break: break-all;">{{ blue_log_now["data"] }}</td>
|
||||
{% endautoescape %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><br>
|
||||
|
||||
<!-- timeline css -->
|
||||
<style>
|
||||
/* The actual timeline (the vertical ruler) */
|
||||
.timeline {
|
||||
position: relative;
|
||||
max-width: 1200px;
|
||||
max-width: 950px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
@ -1482,9 +1444,10 @@
|
|||
|
||||
/* The actual content */
|
||||
.content_time {
|
||||
padding: 20px 30px;
|
||||
padding: 1px 15px;
|
||||
background-color: #252936;
|
||||
position: relative;
|
||||
word-break: break-all;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
|
@ -1506,7 +1469,7 @@
|
|||
.container_time::before {
|
||||
left: 60px;
|
||||
border: medium solid #252936;
|
||||
border-width: 10px 10px 10px 0;
|
||||
border-width: 2px 2px 2px 0;
|
||||
border-color: transparent #252936 transparent transparent;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,6 +9,10 @@
|
|||
</svg>
|
||||
Main
|
||||
</a>
|
||||
<a class="sidebar-link discover active_state_class2" href="/d2">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="side-wrapper">
|
||||
|
@ -21,11 +25,6 @@
|
|||
Support
|
||||
</a>
|
||||
|
||||
<a class="sidebar-link active_state_class999" href="#" target="_blank">
|
||||
<svg class="svg-icon" viewBox="0 0 24 24" fill="currentColor"><path d="M10.13831,10.62982h-.00013a1.05288,1.05288,0,1,0,.00013,0Zm3.75427,0a1.14582,1.14582,0,1,0,1.04907,1.14166A1.09586,1.09586,0,0,0,13.89258,10.62982Zm4.99878-8.6297H5.10864A2.11364,2.11364,0,0,0,3,4.119V18.02527A2.11368,2.11368,0,0,0,5.10864,20.1441H16.77258l-.54516-1.90289,1.31653,1.224,1.24462,1.152L21,22.57153V4.119A2.11364,2.11364,0,0,0,18.89136,2.00012ZM14.92114,15.43323v.00006s-.37036-.44232-.67895-.83319a3.2459,3.2459,0,0,0,1.86181-1.224,5.87837,5.87837,0,0,1-1.18286.60681,6.76974,6.76974,0,0,1-1.49145.44232,7.206,7.206,0,0,1-2.66394-.01025,8.64456,8.64456,0,0,1-1.51209-.44226,6.03735,6.03735,0,0,1-.75085-.34973c-.03089-.02063-.06165-.03089-.09253-.05146a.14171.14171,0,0,1-.04114-.03082c-.18506-.10284-.28809-.17487-.28809-.17487A3.19975,3.19975,0,0,0,9.8811,14.57953c-.30847.39093-.68908.8537-.68908.8537a3.72892,3.72892,0,0,1-3.13709-1.56342A13.775,13.775,0,0,1,7.536,7.87323a5.08641,5.08641,0,0,1,2.89026-1.08l.10278.12348A6.93762,6.93762,0,0,0,7.824,8.2641s.22632-.12341.60682-.29828a7.722,7.722,0,0,1,2.335-.64795,1.00465,1.00465,0,0,1,.17492-.02063,8.702,8.702,0,0,1,2.07764-.02051,8.384,8.384,0,0,1,3.096.98737,6.84576,6.84576,0,0,0-2.561-1.30628l.14392-.16449a5.08575,5.08575,0,0,1,2.89026,1.08,13.77368,13.77368,0,0,1,1.4812,5.99652A3.75972,3.75972,0,0,1,14.92114,15.43323Z"/> </svg>
|
||||
Discord
|
||||
</a>
|
||||
|
||||
<a class="sidebar-link active_state_class6" href="https://asdatindustries.com" target="_blank">
|
||||
<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>
|
||||
Legal
|
||||
|
|
Loading…
Reference in New Issue