-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtier2.html
More file actions
784 lines (741 loc) · 36.4 KB
/
tier2.html
File metadata and controls
784 lines (741 loc) · 36.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SOC Tier-2 Incident Response Workbench</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
colors: {
neutral: {
50: '#fafaf9',
100: '#f5f5f4',
200: '#e7e5e4',
300: '#d6d3d1',
400: '#a8a29e',
500: '#78716c',
600: '#57534e',
700: '#44403c',
800: '#292524',
900: '#1c1917',
},
primary: {
light: '#e0f2fe',
DEFAULT: '#0ea5e9', // Sky 500
dark: '#0284c7',
},
severity: {
high: '#ef4444',
medium: '#f97316',
low: '#22c55e'
}
}
}
}
}
</script>
<style>
body {
background-color: #f5f5f4; /* Stone 100 */
color: #44403c; /* Stone 700 */
}
.chart-container {
position: relative;
width: 100%;
max-width: 600px;
margin-left: auto;
margin-right: auto;
height: 300px;
max-height: 400px;
}
.sidebar-link {
transition: all 0.2s;
}
.sidebar-link:hover, .sidebar-link.active {
background-color: #e7e5e4; /* Stone 200 */
color: #1c1917; /* Stone 900 */
border-right: 4px solid #0ea5e9;
}
.phase-tab {
cursor: pointer;
border-bottom: 2px solid transparent;
transition: all 0.2s;
}
.phase-tab:hover {
color: #0ea5e9;
}
.phase-tab.active {
border-bottom-color: #0ea5e9;
color: #0ea5e9;
font-weight: 600;
}
/* Custom scrollbar for checklist area */
.custom-scroll::-webkit-scrollbar {
width: 6px;
}
.custom-scroll::-webkit-scrollbar-track {
background: #f5f5f4;
}
.custom-scroll::-webkit-scrollbar-thumb {
background-color: #d6d3d1;
border-radius: 20px;
}
</style>
</head>
<body class="h-screen flex overflow-hidden antialiased">
<aside class="w-64 bg-white border-r border-neutral-200 flex flex-col shadow-sm z-10">
<div class="p-6 border-b border-neutral-200">
<h1 class="text-xl font-bold text-neutral-800 tracking-tight">SOC <span class="text-primary">Response</span></h1>
<p class="text-xs text-neutral-500 mt-1">Tier-2 Analyst Workbench</p>
</div>
<nav class="flex-1 overflow-y-auto py-4">
<ul class="space-y-1" id="nav-list">
</ul>
</nav>
<div class="p-4 border-t border-neutral-200 bg-neutral-50">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-full bg-neutral-300 flex items-center justify-center text-white font-bold text-xs">A2</div>
<div>
<p class="text-sm font-medium text-neutral-900">Analyst Session</p>
<p class="text-xs text-green-600">● Active</p>
</div>
</div>
</div>
</aside>
<main class="flex-1 flex flex-col overflow-hidden relative">
<header class="bg-white h-16 border-b border-neutral-200 flex items-center justify-between px-8 shadow-sm shrink-0">
<h2 id="page-title" class="text-lg font-semibold text-neutral-800">Dashboard Overview</h2>
<div class="flex items-center space-x-4">
<nav class="hidden md:flex items-center space-x-4 mr-2">
<a href="index.html" class="text-sm font-bold text-neutral-600 hover:text-primary transition">Home</a>
<a href="tier1.html" class="text-sm font-bold text-neutral-600 hover:text-primary transition">Tier-1 Console</a>
</nav>
<div class="hidden md:block h-4 w-px bg-neutral-300"></div>
<button onclick="resetView()" class="text-sm text-neutral-500 hover:text-primary transition">Reset View</button>
<div class="h-4 w-px bg-neutral-300"></div>
<span id="current-date" class="text-sm text-neutral-500 font-mono"></span>
</div>
</header>
<div id="content-area" class="flex-1 overflow-y-auto p-8 bg-neutral-100">
</div>
</main>
<script>
// --- Data Model ---
const incidentData = [
{
id: 'apt',
title: 'APT / Targeted Malware',
shortTitle: 'APT / Malware',
severity: 'High',
severityColor: 'bg-red-500',
description: 'Persistent malware on critical servers, C2 communication, and potential lateral movement.',
trigger: [
'EDR Alert: Anomalous process/service',
'NIDS/IPS: C2 communication detected',
'SIEM: Failed logins then success from unusual location',
'Threat Intel: IOC match'
],
phases: {
triage: [
'Verify alert source and context',
'Confirm affected asset (IP, Host, User)',
'Isolate affected host (Network ACL/Port shutdown)',
'Gather initial logs (EDR, Firewall)',
'Escalate to Tier-2'
],
analysis: [
{ text: 'Gather Context: Review SIEM/EDR, identify point of compromise.', type: 'action' },
{ text: 'Host Analysis (EDR): Check process trees, outbound connections, file changes, registry keys.', type: 'action' },
{ text: 'Network Analysis: Check Firewall/Proxy for bad IPs, large transfers.', type: 'action' },
{ text: 'Threat Intel: Check IOCs in VirusTotal/AlienVault.', type: 'action' },
{ text: 'Scope Assessment: Identify all affected systems and timeline.', type: 'critical' }
],
containment: [
'Network Isolation: VLAN segmentation',
'Account Disablement: Reset passwords, enable MFA',
'Policy Enforcement: Block hashes/IPs globally',
'Block Lateral Movement: Monitor adjacent systems'
],
eradication: [
'Remove Malware: Delete executables & artifacts',
'Patch Vulnerabilities: Fix entry point',
'Clean Up Backdoors: Remove persistent access',
'Re-image Systems: If deep compromise'
],
recovery: [
'Restore Systems: From clean backups',
'Verify Functionality: Ensure services run',
'Re-enable Network: Gradual restoration',
'Monitor: Enhanced 72h monitoring'
],
post: [
'Documentation: Timeline, findings, IOCs',
'Lessons Learned Meeting',
'Proactive: Update policies, training'
]
},
chartType: 'doughnut',
chartLabel: 'Compromise Indicators',
chartData: [40, 30, 20, 10], // Files, Network, Registry, User
chartLabels: ['File Changes', 'Network C2', 'Registry Keys', 'User Activity']
},
{
id: 'phishing',
title: 'Successful Phishing Attack',
shortTitle: 'Phishing',
severity: 'Medium',
severityColor: 'bg-orange-500',
description: 'Credential compromise via malicious email links or attachments leading to unauthorized access.',
trigger: [
'User Report: Suspicious link clicked',
'Gateway Alert: Malicious email detected post-delivery',
'IdP Logs: Unusual login/MFA failure',
'SIEM: Login from suspicious IP'
],
phases: {
triage: [
'Confirm user report & get headers',
'Check gateway for other recipients',
'Immediate password reset',
'Escalate to Tier-2'
],
analysis: [
{ text: 'Verify Compromise: Check IdP logs post-incident.', type: 'critical' },
{ text: 'Email Analysis: Headers (SPF/DKIM), Sandbox links/attachments.', type: 'action' },
{ text: 'Recipient Analysis: Identify who else clicked/opened.', type: 'action' },
{ text: 'Lateral Movement Check: Cloud storage access, forwarding rules.', type: 'action' }
],
containment: [
'Password Reset & MFA Re-enrollment',
'Block Domains/IPs at Firewall/Proxy',
'Quarantine/Delete Email from all mailboxes',
'Invalidate IdP Sessions'
],
eradication: [
'Remove Persistent Access: Check forwarding rules/apps',
'Scan Workstation: Full malware scan',
'Re-image: If attachment executed payload'
],
recovery: [
'Restore Mailbox items',
'User Re-onboarding & Training',
'Monitor Account Activity'
],
post: [
'Documentation: Campaign details',
'Proactive: Enhance Gateway rules (DMARC)',
'Simulations: Conduct training'
]
},
chartType: 'bar',
chartLabel: 'Phishing Vector Analysis',
chartData: [65, 25, 10],
chartLabels: ['Credential Harvest Link', 'Malicious Attachment', 'Social Engineering (Reply)']
},
{
id: 'bruteforce',
title: 'Unauthorized Access / Brute Force',
shortTitle: 'Brute Force',
severity: 'Medium',
severityColor: 'bg-orange-500',
description: 'High volume login attempts targeting external services like VPN, SSH, or OWA.',
trigger: [
'SIEM: High volume failed logins',
'App Logs: Repetitive failures',
'Cloud Logs: Geo-improbable logins'
],
phases: {
triage: [
'Identify source IP & target service',
'Check IP reputation',
'Confirm if any success occurred',
'Escalate if sustained or successful'
],
analysis: [
{ text: 'Verify Attack Type: Spraying vs Stuffing.', type: 'action' },
{ text: 'Source Analysis: Botnet? Geo-location?', type: 'action' },
{ text: 'Target Analysis: Determine access level if compromised.', type: 'critical' },
{ text: 'Check Account Lockouts' }
],
containment: [
'Block Attacker IPs at Firewall/WAF',
'Lockout/Disable compromised accounts',
'Geo-blocking implementation',
'Rate Limiting application'
],
eradication: [
'Patch Vulnerabilities (Weak Auth)',
'Remove Backdoors (if success)',
'Reset Accounts with Strong Passwords'
],
recovery: [
'Verify Service Availability',
'Monitor Auth Logs',
'Unlock Legitimate Accounts'
],
post: [
'Documentation: Source IPs, targets',
'Proactive: CAPTCHA, MFA enforcement',
'SIEM Tuning'
]
},
chartType: 'line',
chartLabel: 'Login Attempts (Last 1h)',
chartData: [5, 12, 45, 120, 340, 50], // Simulated spike
chartLabels: ['T-60', 'T-50', 'T-40', 'T-30', 'T-20', 'T-10']
},
{
id: 'exfil',
title: 'Data Exfiltration Attempt',
shortTitle: 'Data Exfiltration',
severity: 'High',
severityColor: 'bg-red-500',
description: 'Sensitive data (PII, source code) leaving the network via unauthorized channels.',
trigger: [
'DLP Alert: Sensitive data egress',
'NetFlow: Large outbound volume',
'Proxy: Upload to cloud storage',
'EDR: Large archive creation'
],
phases: {
triage: [
'Verify source, dest, volume',
'Identify user/process',
'Determine sensitivity (DLP tags)',
'Escalate if sensitive'
],
analysis: [
{ text: 'Verify Intent: Biz justification or Malicious?', type: 'critical' },
{ text: 'Data ID: What was taken?', type: 'action' },
{ text: 'Source/Dest Analysis: Check tools (rsync, curl).', type: 'action' },
{ text: 'User Behavior Review: Past anomalies.' }
],
containment: [
'Block Outbound Connections to Dest',
'Isolate Source Host',
'Suspend User Account',
'Disable USB/External Media'
],
eradication: [
'Remove Malicious Tools',
'Patch Vulnerability (if exploited)',
'Attempt Data Recovery (Contact cloud provider)'
],
recovery: [
'Validate Data Integrity',
'Restore Access after cleaning',
'Heightened Monitoring'
],
post: [
'Documentation: Data impact assessment',
'Root Cause Analysis',
'Proactive: Encryption, Segmentation'
]
},
chartType: 'bar',
chartLabel: 'Exfiltration Channels (GB)',
chartData: [0.2, 4.5, 0.1, 0.5],
chartLabels: ['Email', 'Cloud Storage', 'USB', 'Web Upload']
},
{
id: 'ddos',
title: 'Distributed Denial-of-Service (DDoS)',
shortTitle: 'DDoS Attack',
severity: 'High',
severityColor: 'bg-red-500',
description: 'Service unavailability caused by volumetric or protocol floods.',
trigger: [
'Network Monitoring: Inbound traffic spike',
'APM: Latency/Errors',
'CDN Alert',
'User Reports: Downtime'
],
phases: {
triage: [
'Confirm unavailability',
'Identify target IP/Service',
'Gather metrics (Volume, Type)',
'Escalate to Network Team'
],
analysis: [
{ text: 'Confirm DDoS: Volumetric vs App Layer?', type: 'critical' },
{ text: 'Identify Sources: Botnet characteristics.', type: 'action' },
{ text: 'Impact Assessment: Revenue/Ops impact.', type: 'action' }
],
containment: [
'Activate Cloud Mitigation (Scrubbing)',
'Rate Limiting at Edge',
'Network Segmentation',
'Blackholing (Last Resort)'
],
eradication: [
'Block Persistent Attackers',
'Tweak Mitigation Rules',
'Upstream Provider Blocking'
],
recovery: [
'Monitor Service Health',
'Verify Accessibility',
'Re-establish Traffic Baseline'
],
post: [
'Documentation: Volume, Duration, Cost',
'Proactive: Architecture review, Capacity planning'
]
},
chartType: 'line',
chartLabel: 'Traffic Volume (Gbps)',
chartData: [2, 2.5, 3, 15, 45, 38, 10], // Simulated attack curve
chartLabels: ['10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30']
},
{
id: 'insider',
title: 'Insider Threat (Data Leakage)',
shortTitle: 'Insider Threat',
severity: 'Medium',
severityColor: 'bg-orange-500',
description: 'Accidental or malicious sharing of sensitive documents by an employee.',
trigger: [
'DLP Alert: Confidential doc to external',
'CASB Alert: Personal cloud upload',
'UBA: Unusual access/download',
'External Report'
],
phases: {
triage: [
'Identify user & data',
'Assess sensitivity',
'Determine intent (context)',
'Escalate if public leak'
],
analysis: [
{ text: 'Verify Leakage: Accessible externally?', type: 'critical' },
{ text: 'Identify Intent: Interview/Chat logs review.', type: 'action' },
{ text: 'Data Scope: Regulatory impact?', type: 'action' },
{ text: 'Timeline Analysis' }
],
containment: [
'Revoke Access / Suspend Account',
'Data Takedown (DMCA/Admin contact)',
'Block Destination Service',
'Preserve Evidence'
],
eradication: [
'Ensure External Removal',
'Remove Local Residual Copies',
'Secure Internal Gaps'
],
recovery: [
'Legal/Regulatory Assessment',
'Restore Trust (Training or Discipline)',
'Reputation Management'
],
post: [
'Documentation: HR/Legal involvement',
'Proactive: Strengthen DLP/CASB, Off-boarding process'
]
},
chartType: 'pie',
chartLabel: 'Leakage Method',
chartData: [40, 30, 20, 10],
chartLabels: ['Personal Email', 'Cloud Drive', 'USB', 'Print']
}
];
// --- State ---
let state = {
currentView: 'dashboard',
activePlaybookId: null,
activePhase: 'analysis'
};
// --- DOM Elements ---
const navList = document.getElementById('nav-list');
const contentArea = document.getElementById('content-area');
const pageTitle = document.getElementById('page-title');
const dateEl = document.getElementById('current-date');
// --- Initialization ---
function init() {
renderNav();
dateEl.textContent = new Date().toLocaleDateString();
renderDashboard();
}
function resetView() {
state.currentView = 'dashboard';
state.activePlaybookId = null;
renderNav();
renderDashboard();
}
// --- Navigation Rendering ---
function renderNav() {
navList.innerHTML = `
<li>
<button onclick="resetView()" class="sidebar-link w-full text-left px-6 py-3 text-sm font-medium ${state.currentView === 'dashboard' ? 'active bg-neutral-200 text-neutral-900 border-r-4 border-sky-500' : 'text-neutral-600 hover:bg-neutral-50'}">
Dashboard Overview
</button>
</li>
<li class="px-6 py-2 text-xs font-semibold text-neutral-400 uppercase tracking-wider mt-4">Playbooks</li>
`;
incidentData.forEach(incident => {
const isActive = state.currentView === 'playbook' && state.activePlaybookId === incident.id;
const li = document.createElement('li');
li.innerHTML = `
<button onclick="loadPlaybook('${incident.id}')" class="sidebar-link w-full text-left px-6 py-3 text-sm font-medium flex items-center justify-between ${isActive ? 'active bg-neutral-200 text-neutral-900 border-r-4 border-sky-500' : 'text-neutral-600 hover:bg-neutral-50'}">
<span>${incident.shortTitle}</span>
<span class="w-2 h-2 rounded-full ${incident.severityColor}"></span>
</button>
`;
navList.appendChild(li);
});
}
// --- Dashboard Rendering ---
function renderDashboard() {
pageTitle.textContent = "Incident Response Dashboard";
// Generate Dashboard HTML
contentArea.innerHTML = `
<div class="max-w-5xl mx-auto space-y-8">
<div class="bg-white rounded-lg shadow-sm p-8 border border-neutral-200">
<h2 class="text-2xl font-bold text-neutral-800 mb-2">Welcome, Analyst.</h2>
<p class="text-neutral-600">This workbench provides centralized access to Tier-2 incident response playbooks. Select a scenario from the sidebar to begin an investigation, or review the threat matrix below.</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<p class="text-sm text-neutral-500 font-medium">Total Playbooks</p>
<p class="text-3xl font-bold text-neutral-800 mt-2">6</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<p class="text-sm text-neutral-500 font-medium">High Severity Scenarios</p>
<p class="text-3xl font-bold text-red-500 mt-2">3</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<p class="text-sm text-neutral-500 font-medium">Active Monitoring</p>
<p class="text-3xl font-bold text-sky-500 mt-2">24/7</p>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<div class="flex items-center justify-between mb-6">
<h3 class="text-lg font-semibold text-neutral-800">Incident Severity & Complexity Matrix</h3>
<span class="text-xs text-neutral-400 bg-neutral-100 px-2 py-1 rounded">Interactive Visualization</span>
</div>
<div class="chart-container">
<canvas id="dashboardChart"></canvas>
</div>
</div>
</div>
`;
// Render Dashboard Chart
const ctx = document.getElementById('dashboardChart').getContext('2d');
new Chart(ctx, {
type: 'bubble',
data: {
datasets: [{
label: 'Incidents',
data: [
{ x: 9, y: 9, r: 15, label: 'APT' },
{ x: 4, y: 8, r: 12, label: 'DDoS' },
{ x: 5, y: 6, r: 10, label: 'Phishing' },
{ x: 2, y: 4, r: 8, label: 'Brute Force' },
{ x: 7, y: 9, r: 12, label: 'Exfiltration' },
{ x: 8, y: 7, r: 10, label: 'Insider' }
],
backgroundColor: function(context) {
const val = context.raw?.y;
return val >= 8 ? '#ef4444' : (val >= 5 ? '#f97316' : '#22c55e');
}
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
title: { display: true, text: 'Investigation Complexity (Low -> High)' },
min: 0, max: 10
},
y: {
title: { display: true, text: 'Business Impact (Low -> High)' },
min: 0, max: 10
}
},
plugins: {
tooltip: {
callbacks: {
label: function(context) {
return context.raw.label;
}
}
},
legend: { display: false }
}
}
});
}
// --- Playbook Rendering ---
function loadPlaybook(id) {
state.currentView = 'playbook';
state.activePlaybookId = id;
// Default to 'triage' when opening a playbook, or keep state? Let's default to triage.
state.activePhase = 'triage';
renderNav();
const data = incidentData.find(i => i.id === id);
pageTitle.textContent = data.title;
// Template
contentArea.innerHTML = `
<div class="max-w-6xl mx-auto flex flex-col lg:flex-row gap-8">
<div class="flex-1 space-y-6">
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200 border-l-4 ${data.severityColor.replace('bg-', 'border-')}">
<div class="flex justify-between items-start">
<div>
<span class="inline-block px-2 py-1 rounded text-xs font-bold text-white mb-2 ${data.severityColor}">${data.severity.toUpperCase()}</span>
<p class="text-neutral-700">${data.description}</p>
</div>
</div>
<div class="mt-4 p-4 bg-neutral-50 rounded border border-neutral-200">
<h4 class="text-xs font-bold text-neutral-500 uppercase mb-2">Triggers & Detection</h4>
<ul class="list-disc list-inside text-sm text-neutral-600 space-y-1">
${data.trigger.map(t => `<li>${t}</li>`).join('')}
</ul>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm border border-neutral-200 overflow-hidden">
<div class="flex border-b border-neutral-200 overflow-x-auto">
${['triage', 'analysis', 'containment', 'eradication', 'recovery', 'post'].map(phase => `
<button onclick="changePhase('${phase}')"
class="phase-tab px-4 py-3 text-sm font-medium capitalize whitespace-nowrap ${state.activePhase === phase ? 'active bg-sky-50' : 'text-neutral-500 hover:bg-neutral-50'}">
${phase}
</button>
`).join('')}
</div>
<div class="p-6 min-h-[400px]" id="phase-content">
</div>
</div>
</div>
<div class="w-full lg:w-80 space-y-6">
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<h4 class="text-sm font-bold text-neutral-800 mb-4">Live Metrics (Simulated)</h4>
<div class="chart-container" style="height: 200px;">
<canvas id="playbookChart"></canvas>
</div>
<p class="text-xs text-neutral-400 mt-2 text-center">Data source: SIEM Aggregation</p>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm border border-neutral-200">
<h4 class="text-sm font-bold text-neutral-800 mb-4">Analyst Notepad</h4>
<textarea class="w-full h-32 p-3 text-sm border border-neutral-300 rounded focus:ring-2 focus:ring-sky-500 focus:border-sky-500 outline-none resize-none" placeholder="Record IOCs, timestamps, or observations here..."></textarea>
<button class="w-full mt-3 bg-neutral-800 text-white py-2 rounded text-sm hover:bg-neutral-700 transition">Save Log Entry</button>
</div>
</div>
</div>
`;
renderPhaseContent();
renderPlaybookChart(data);
}
function changePhase(phase) {
state.activePhase = phase;
// Re-render just the phase content and tabs status
const tabs = document.querySelectorAll('.phase-tab');
tabs.forEach(tab => {
if (tab.textContent.trim().toLowerCase().includes(phase)) {
tab.classList.add('active', 'bg-sky-50');
tab.classList.remove('text-neutral-500', 'hover:bg-neutral-50');
} else {
tab.classList.remove('active', 'bg-sky-50');
tab.classList.add('text-neutral-500', 'hover:bg-neutral-50');
}
});
renderPhaseContent();
}
function renderPhaseContent() {
const data = incidentData.find(i => i.id === state.activePlaybookId);
const content = data.phases[state.activePhase];
const container = document.getElementById('phase-content');
let title = state.activePhase.charAt(0).toUpperCase() + state.activePhase.slice(1);
if(title === 'Post') title = 'Post-Incident Activities';
let listHTML = '';
content.forEach((item, index) => {
const text = typeof item === 'string' ? item : item.text;
const isCritical = typeof item === 'object' && item.type === 'critical';
listHTML += `
<div class="flex items-start space-x-3 mb-4 p-3 rounded hover:bg-neutral-50 transition border border-transparent hover:border-neutral-100">
<input type="checkbox" id="step-${index}" class="mt-1 w-4 h-4 text-sky-600 rounded border-gray-300 focus:ring-sky-500 cursor-pointer">
<label for="step-${index}" class="flex-1 text-neutral-700 text-sm cursor-pointer select-none leading-relaxed">
${isCritical ? '<span class="text-red-500 font-bold mr-1">[CRITICAL]</span>' : ''}
${text}
</label>
</div>
`;
});
container.innerHTML = `
<div class="animate-fade-in">
<h3 class="text-lg font-bold text-neutral-800 mb-1">${title}</h3>
<p class="text-xs text-neutral-500 mb-6 uppercase tracking-wider">Checklist Protocol</p>
<div class="custom-scroll max-h-[500px] overflow-y-auto pr-2">
${listHTML}
</div>
</div>
`;
}
function renderPlaybookChart(data) {
const ctx = document.getElementById('playbookChart').getContext('2d');
// Handle label wrapping for 16 char limit
const labels = data.chartLabels.map(label => {
if (label.length > 16) {
return label.match(/.{1,16}/g) || [label];
}
return label;
});
new Chart(ctx, {
type: data.chartType,
data: {
labels: labels,
datasets: [{
label: data.chartLabel,
data: data.chartData,
backgroundColor: [
'#0ea5e9', '#f97316', '#ef4444', '#14b8a6', '#8b5cf6'
],
borderColor: '#ffffff',
borderWidth: 2,
tension: 0.4 // Smooth lines for line charts
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: data.chartType !== 'bar' && data.chartType !== 'line',
position: 'bottom',
labels: { boxWidth: 10, font: { size: 10 } }
},
tooltip: {
callbacks: {
title: function(tooltipItems) {
const item = tooltipItems[0];
let label = item.chart.data.labels[item.dataIndex];
if (Array.isArray(label)) {
return label.join(' ');
} else {
return label;
}
}
}
}
},
scales: (data.chartType === 'bar' || data.chartType === 'line') ? {
y: { beginAtZero: true, grid: { display: true, drawBorder: false } },
x: { grid: { display: false } }
} : {}
}
});
}
// Run
init();
</script>
</body>
</html>