Start adding support for mid-stream AMTKVM recording.

Ylian Saint-Hilaire committed Jun 20, 2020 at 16:27 UTC 16b25b04b0daf7a0098a00c435c337dfeeac1312
2 files changed +33 -4
sample-config-advanced.json
+2 -2
@@ -169,8 +169,8 @@
169 "maxSingleUserSessions": 10
170 },
171 "_amtScanOptions": [
172 - "192.168.15.0/23",
173 - "192.168.8.0/24"
172 + "LabNetwork 192.168.15.0/23",
173 + "SalesNetwork 192.168.8.0/24"
174 ],
175 "_amtAcmActivation": {
176 "log": "amtactivation.log",
views/player.handlebars
+31 -2
@@ -217,8 +217,11 @@
217 else if (p == 2) { p = "MeshCentral Desktop"; }
218 else if (p == 100) { p = "Intel® AMT WSMAN"; }
219 else if (p == 101) { p = "Intel® AMT Redirection"; }
220 + else if (p == 200) { p = "Intel® AMT KVM"; }
221 x += addInfoNoEsc("Protocol", p);
222 }
223 + if (recFileMetadata.bpp == 1) { x += addInfoNoEsc("Color Quality", "256 colors"); }
224 + if (recFileMetadata.bpp == 2) { x += addInfoNoEsc("Color Quality", "65536 colors"); }
225 if (recFileMetadata.indexInterval) {
226 recFileIndexBasePtr = recFilePtr;
227 x += addInfoNoEsc("Seeking", format("Indexed every {0} seconds", recFileMetadata.indexInterval));
@@ -264,10 +267,27 @@
267 recFileStartTime = recFileLastTime = time;
268 amtDesktop = CreateAmtRemoteDesktop('Desk');
269 amtDesktop.onScreenSizeChange = deskAdjust;
270 + if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; }
271 amtDesktop.State = 3;
272 amtDesktop.Start();
273 deskAdjust();
274 }
275 + else if (recFileMetadata.protocol == 200) {
276 + // Intel AMT Midstream KVM
277 + recFileProtocol = 200;
278 + x += '<br /><br /><span style=color:gray>Press [space] to play/pause.</span>';
279 + QE('PlayButton', true);
280 + QE('PauseButton', false);
281 + QE('RestartButton', false);
282 + recFileStartTime = recFileLastTime = time;
283 + amtDesktop = CreateAmtRemoteDesktop('Desk');
284 + amtDesktop.onScreenSizeChange = deskAdjust;
285 + amtDesktop.State = 3;
286 + amtDesktop.Start();
287 + if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; }
288 + amtDesktop.state = 3;
289 + deskAdjust();
290 + }
291 QV('metadatadiv', true);
292 QH('metadatadiv', x);
293 QH('deskstatus', recFile.name);
@@ -323,13 +343,21 @@
343 }
344 } else if (recFileProtocol == 101) {
345 // Intel AMT KVM
346 + var view = new Uint8Array(data.length);
347 + for (var i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); }
348 +
349 if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) {
350 // We are not authenticated, KVM data starts here.
351 readState = 1;
329 - if (data.length > 8) { amtDesktop.ProcessData(data.substring(8)); }
352 + if (data.length > 8) { amtDesktop.ProcessBinaryData(view.slice(8).buffer); }
353 } else if (readState == 1) {
331 - amtDesktop.ProcessData(data);
354 + amtDesktop.ProcessBinaryData(view.buffer);
355 }
356 + } else if (recFileProtocol == 200) {
357 + // Intel AMT midstream KVM
358 + var view = new Uint8Array(data.length);
359 + for (var i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); }
360 + amtDesktop.ProcessBinaryData(view.buffer);
361 }
362 } else if ((type == 2) && flagBinary && flagUser) {
363 // User --> Device data
@@ -516,6 +544,7 @@
544 amtDesktop.onScreenSizeChange = deskAdjust;
545 amtDesktop.State = 3;
546 amtDesktop.Start();
547 + if (recFileMetadata.protocol == 200) { if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; } amtDesktop.state = 3; }
548 } else if (agentTerminal) {
549 agentTerminal = null;
550 }