diff --git a/webserver/database/logs/blue.json b/webserver/database/logs/blue.json index 95836ad..781a0e0 100644 --- a/webserver/database/logs/blue.json +++ b/webserver/database/logs/blue.json @@ -1 +1 @@ -[{"data": "archtosu@172.23.7.203: ./auto.sh", "timestamp": "1681451149"}, {"data": "Snort: Intrusion Detected!", "timestamp": "1681451149"}, {"data": "archtosu@172.23.7.203: mv auto.sh blueteam1.sh", "timestamp": "1681451169"}, {"data": "archtosu@172.23.7.203: git s", "timestamp": "1681451171"}, {"data": "archtosu@172.23.7.203: git status", "timestamp": "1681451173"}] \ No newline at end of file +[{"data": "archtosu@172.23.7.203: git status", "timestamp": "1681452893"}] \ No newline at end of file diff --git a/webserver/database/logs/red.json b/webserver/database/logs/red.json index 47f38c1..0637a08 100644 --- a/webserver/database/logs/red.json +++ b/webserver/database/logs/red.json @@ -1 +1 @@ -[{"data": "141.89.221.182: Start of post-exploitation", "timestamp": "1681451149"}] \ No newline at end of file +[] \ No newline at end of file diff --git a/webserver/database/temp/sim_start.txt b/webserver/database/temp/sim_start.txt index a0f9269..2117dc4 100644 --- a/webserver/database/temp/sim_start.txt +++ b/webserver/database/temp/sim_start.txt @@ -1 +1 @@ -1681451148 \ No newline at end of file +1681452887 \ No newline at end of file diff --git a/webserver/main.py b/webserver/main.py index 5f07dfb..c0ce366 100755 --- a/webserver/main.py +++ b/webserver/main.py @@ -328,7 +328,8 @@ def api_red_logs(): temp_json_n['data'] = remote_addr + ': ' + temp_json_n['data'] if STARTED: - if temp_json_n['data'].lower() == 'start of attack': + print(temp_json_n['data']) + if 'start of attack' in temp_json_n['data'].lower(): with open('./database/temp/attack_start.txt', 'w') as f: f.write(str(temp_json_n['timestamp'])) diff --git a/webserver/templates/main/dashboard_main1.html b/webserver/templates/main/dashboard_main1.html index 4dc3578..82cf4f0 100644 --- a/webserver/templates/main/dashboard_main1.html +++ b/webserver/templates/main/dashboard_main1.html @@ -1553,7 +1553,18 @@ return res; } + + function add_info(blue) { + blue.sort(timestamp_sort); + let blue_count = blue.length; + if (blue_count > 1 && document.getElementById('attackstart').getAttribute('data-start') !== '-1') { + let t = to_min_s(document.getElementById('attackstart').getAttribute('data-start'), blue[1].timestamp); + blue.splice(1, 0, {data: `Time to respond: ${t}`, timestamp: parseInt(blue[1].timestamp)}) + } + } + function populateTimeline(data) { + add_info(data.blue); data = flatten_dict(data); data.sort(timestamp_sort); let tl = document.getElementById('timeline'); @@ -1561,13 +1572,13 @@ data.forEach(data_entry => { entry_div = document.createElement('div'); container = document.createElement('div'); - timestamp_h2 = document.createElement('h2'); - data_tag = document.createElement('p'); + data_h2 = document.createElement('h2'); + timestamp_tag = document.createElement('p'); timestamp_txt = document.createTextNode(to_min_s(document.getElementById('simstart').getAttribute('data-start'), data_entry.timestamp)); - data_tag.innerHTML = data_entry.data; - timestamp_h2.appendChild(timestamp_txt); - container.appendChild(timestamp_h2); - container.appendChild(data_tag); + timestamp_tag.appendChild(timestamp_txt); + data_h2.innerHTML = data_entry.data; + container.appendChild(data_h2); + container.appendChild(timestamp_tag); container.classList.add("content_time"); container.setAttribute("style", 'box-sizing: border-box;'); entry_div.appendChild(container);