From 16b25b04b0daf7a0098a00c435c337dfeeac1312 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 20 Jun 2020 16:27:31 -0700 Subject: [PATCH] Start adding support for mid-stream AMTKVM recording. --- sample-config-advanced.json | 4 ++-- views/player.handlebars | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/sample-config-advanced.json b/sample-config-advanced.json index f0743ade..1154348e 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -169,8 +169,8 @@ "maxSingleUserSessions": 10 }, "_amtScanOptions": [ - "192.168.15.0/23", - "192.168.8.0/24" + "LabNetwork 192.168.15.0/23", + "SalesNetwork 192.168.8.0/24" ], "_amtAcmActivation": { "log": "amtactivation.log", diff --git a/views/player.handlebars b/views/player.handlebars index 8df587e6..e32d4733 100644 --- a/views/player.handlebars +++ b/views/player.handlebars @@ -217,8 +217,11 @@ else if (p == 2) { p = "MeshCentral Desktop"; } else if (p == 100) { p = "Intel® AMT WSMAN"; } else if (p == 101) { p = "Intel® AMT Redirection"; } + else if (p == 200) { p = "Intel® AMT KVM"; } x += addInfoNoEsc("Protocol", p); } + if (recFileMetadata.bpp == 1) { x += addInfoNoEsc("Color Quality", "256 colors"); } + if (recFileMetadata.bpp == 2) { x += addInfoNoEsc("Color Quality", "65536 colors"); } if (recFileMetadata.indexInterval) { recFileIndexBasePtr = recFilePtr; x += addInfoNoEsc("Seeking", format("Indexed every {0} seconds", recFileMetadata.indexInterval)); @@ -264,10 +267,27 @@ recFileStartTime = recFileLastTime = time; amtDesktop = CreateAmtRemoteDesktop('Desk'); amtDesktop.onScreenSizeChange = deskAdjust; + if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; } amtDesktop.State = 3; amtDesktop.Start(); deskAdjust(); } + else if (recFileMetadata.protocol == 200) { + // Intel AMT Midstream KVM + recFileProtocol = 200; + x += '

Press [space] to play/pause.'; + QE('PlayButton', true); + QE('PauseButton', false); + QE('RestartButton', false); + recFileStartTime = recFileLastTime = time; + amtDesktop = CreateAmtRemoteDesktop('Desk'); + amtDesktop.onScreenSizeChange = deskAdjust; + amtDesktop.State = 3; + amtDesktop.Start(); + if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; } + amtDesktop.state = 3; + deskAdjust(); + } QV('metadatadiv', true); QH('metadatadiv', x); QH('deskstatus', recFile.name); @@ -323,13 +343,21 @@ } } else if (recFileProtocol == 101) { // Intel AMT KVM + var view = new Uint8Array(data.length); + for (var i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); } + if ((readState == 0) && (rstr2hex(data) == '4100000000000000')) { // We are not authenticated, KVM data starts here. readState = 1; - if (data.length > 8) { amtDesktop.ProcessData(data.substring(8)); } + if (data.length > 8) { amtDesktop.ProcessBinaryData(view.slice(8).buffer); } } else if (readState == 1) { - amtDesktop.ProcessData(data); + amtDesktop.ProcessBinaryData(view.buffer); } + } else if (recFileProtocol == 200) { + // Intel AMT midstream KVM + var view = new Uint8Array(data.length); + for (var i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); } + amtDesktop.ProcessBinaryData(view.buffer); } } else if ((type == 2) && flagBinary && flagUser) { // User --> Device data @@ -516,6 +544,7 @@ amtDesktop.onScreenSizeChange = deskAdjust; amtDesktop.State = 3; amtDesktop.Start(); + if (recFileMetadata.protocol == 200) { if (recFileMetadata.bpp) { amtDesktop.bpp = recFileMetadata.bpp; } amtDesktop.state = 3; } } else if (agentTerminal) { agentTerminal = null; }