-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxsoar_cli_generator.html
254 lines (231 loc) · 8.56 KB
/
xsoar_cli_generator.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="color-scheme" content="dark">
<title>XSOAR CLI Generator</title>
<style>
body {
background-color: #000;
color: #00ff00;
font-family: 'Courier New', Courier, monospace;
margin: 20px;
text-align: center;
}
.form-container {
width: 50%;
max-width: 700px;
margin: auto;
text-align: left;
border: 2px solid #00ff00;
padding: 20px;
border-radius: 10px;
background-color: #111;
box-shadow: 0 0 15px #00ff00;
}
h1 {
text-shadow: 0 0 10px #00ff00;
}
.field-container {
margin: 10px 0;
}
label {
display: block;
margin-bottom: 5px;
}
select, input, textarea {
width: 100%;
padding: 8px;
background-color: #222;
color: #00ff00;
border: 1px solid #00ff00;
box-sizing: border-box;
}
textarea {
resize: vertical;
height: 40px;
}
input[type="datetime-local"] {
background-color: #222;
color: #00ff00;
border: 1px solid #00ff00;
padding: 8px;
box-sizing: border-box;
}
.button-container {
display: flex;
justify-content: space-between;
}
button {
flex: 1;
padding: 10px;
margin: 10px;
background-color: #000;
color: #00ff00;
border: 2px solid #00ff00;
cursor: pointer;
font-weight: bold;
}
button:hover {
background-color: #111;
}
#cli-output {
margin-top: 20px;
padding: 10px;
background-color: #111;
color: #00ff00;
border: 2px solid #00ff00;
white-space: pre-wrap;
word-wrap: break-word;
min-height: 50px;
}
#copy-button {
margin-top: 10px;
background-color: #000;
color: #00ff00;
border: 2px solid #00ff00;
cursor: pointer;
font-weight: bold;
padding: 10px;
width: 40%;
display: block;
margin-left: auto;
margin-right: auto;
}
#copy-button:hover {
background-color: #111;
}
.footer {
margin-top: 20px;
font-size: 14px;
color: #00ff00;
}
</style>
</head>
<body>
<h1>XSOAR CLI Generator</h1>
<div class="form-container">
<form id="xsoar-cli-form">
<div class="field-container">
<label for="occurred-time">Occurred Time (UTC)</label>
<input type="datetime-local" id="occurred-time">
</div>
<div class="field-container">
<label for="majorincident">Major Incident</label>
<select id="majorincident">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>
</div>
<div class="field-container">
<label for="falsepositive">False Positive</label>
<select id="falsepositive">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>
</div>
<div class="field-container">
<label for="falsepositivenotes">False Positive Notes</label>
<textarea id="falsepositivenotes">N/A</textarea>
</div>
<div class="field-container">
<label for="classification">Classification</label>
<select id="classification">
<option value="Hacking">Hacking</option>
<option value="Malware">Malware</option>
<option value="Phishing">Phishing</option>
</select>
</div>
<div class="field-container">
<label for="escalationto">Escalation To</label>
<select id="escalationto">
<option value="N/A">N/A</option>
</select>
</div>
<div class="field-container">
<label for="attackvector">Attack Vector</label>
<select id="attackvector">
<option value="Other">Other</option>
</select>
</div>
<div class="field-container">
<label for="detectionsource">Detection Source</label>
<select id="detectionsource">
<option value="Custom Alert">Custom Alert</option>
</select>
</div>
<div class="field-container">
<label for="impact">Impact</label>
<select id="impact">
<option value="Not Malicious">Not Malicious</option>
</select>
</div>
<div class="field-container">
<label for="repeatoffendername">Repeat Offender Name</label>
<textarea id="repeatoffendername">N/A</textarea>
</div>
<div class="field-container">
<label for="signatureupdate">Signature Update</label>
<textarea id="signatureupdate">N/A</textarea>
</div>
<div class="button-container">
<button type="button" onclick="generateCLI()">Generate</button>
<button type="reset">Reset</button>
</div>
</form>
<div id="cli-output"></div>
<button id="copy-button" onclick="copyToClipboard()">Copy</button>
</div>
<div class="footer">
Made with 💚 by Jeff Morris | Hack The Planet 🌎
</div>
<script>
function convertUTCToLocal(utcDateStr) {
const utcDate = new Date(utcDateStr + "Z");
const localDate = new Date(utcDate.getTime());
const pad = (num) => num.toString().padStart(2, '0');
const year = localDate.getFullYear();
const month = pad(localDate.getMonth() + 1);
const day = pad(localDate.getDate());
const hours = pad(localDate.getHours());
const minutes = pad(localDate.getMinutes());
const seconds = pad(localDate.getSeconds());
const offsetMinutes = localDate.getTimezoneOffset();
const offsetHours = Math.abs(offsetMinutes / 60);
const offsetSign = offsetMinutes > 0 ? "-" : "+";
const offsetFormatted = `${offsetSign}${pad(offsetHours)}:${pad(offsetMinutes % 60)}`;
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}${offsetFormatted}`;
}
function generateCLI() {
const occurredTimeInput = document.getElementById('occurred-time').value;
let params = {
majorincident: "no",
falsepositive: "no",
falsepositivenotes: document.getElementById('falsepositivenotes').value,
classification: document.getElementById('classification').value,
escalationto: document.getElementById('escalationto').value,
attackvector: document.getElementById('attackvector').value,
detectionsource: document.getElementById('detectionsource').value,
impact: document.getElementById('impact').value,
repeatoffendername: document.getElementById('repeatoffendername').value,
signatureupdate: document.getElementById('signatureupdate').value
};
if (occurredTimeInput) {
params["remediationtime"] = convertUTCToLocal(occurredTimeInput);
params["containmenttime"] = params["remediationtime"];
}
const cliCommand = "!setIncident " + Object.entries(params)
.map(([key, value]) => `${key}="${value}"`)
.join(' ');
document.getElementById('cli-output').textContent = cliCommand;
}
function copyToClipboard() {
const output = document.getElementById('cli-output').textContent;
navigator.clipboard.writeText(output).then(() => {
alert("CLI Command Copied!");
});
}
</script>
</body>
</html>