mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 15:35:06 +03:00
1 line
14 KiB
HTML
1 line
14 KiB
HTML
<!doctypehtml><html dir=ltr xmlns=http://www.w3.org/1999/xhtml><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8"http-equiv=Content-Type><meta name=viewport content="user-scalable=1,initial-scale=1,minimum-scale=1,maximum-scale=1"><meta name=apple-mobile-web-app-capable content=yes><meta name=format-detection content="telephone=no"><link type=text/css href=styles/style.css media=screen rel=stylesheet title=CSS><script src=scripts/common-0.0.1.js></script><script src=scripts/agent-desktop-0.0.2.js></script><script src=scripts/amt-desktop-0.0.2.js></script><script src=scripts/amt-terminal-0.0.2.js></script><script src=scripts/zlib.js></script><script src=scripts/zlib-inflate.js></script><script src=scripts/zlib-adler32.js></script><script src=scripts/zlib-crc32.js></script><body style=overflow:hidden;background-color:#000><div id=p11 class=noselect style=overflow:hidden><div id=deskarea0><div id=deskarea1 class=areaHead><div class=toright2><div class=deskareaicon title="Toggle View Mode"onclick=toggleAspectRatio(1)>⇲</div></div><div><input id=OpenFileButton type=button value="Open File..."onclick=openfile()> <span id=deskstatus></span></div></div><div id=deskarea2><div class=areaProgress><div id=progressbar></div></div></div><div id=deskarea3x style="max-height:calc(100vh - 54px);height:calc(100vh - 54px)"onclick=togglePause()><div id=bigok style="display:none;left:calc((100vh / 2))"><b>✓</b></div><div id=bigfail style="display:none;left:calc((100vh / 2))"><b>✗</b></div><div id=metadatadiv style=padding:20px;color:#d3d3d3;text-align:left;display:none></div><div id=DeskParent><canvas id=Desk width=640 height=480></canvas></div><div id=TermParent style=display:none><pre id=Term></pre></div><div id=p11DeskConsoleMsg style=display:none;cursor:pointer;position:absolute;left:30px;top:17px;color:#ff0;background-color:rgba(0,0,0,.6);padding:10px;border-radius:5px onclick=clearConsoleMsg()></div></div><div id=deskarea4 class=areaFoot><div class=toright2><div id=timespan style=padding-top:4px;padding-right:4px>00:00:00</div></div><div> <input id=PlayButton type=button value=Play disabled onclick=play()> <input id=PauseButton type=button value=Pause disabled onclick=pause()> <input id=RestartButton type=button value=Restart disabled onclick=restart()> <select id=PlaySpeed onchange=this.blur()><option value=4>1/4 Speed<option value=2>1/2 Speed<option value=1 selected>Normal Speed<option value=0.5>2x Speed<option value=0.25>4x Speed<option value=0.1>10x Speed</select></div></div></div><div id=dialog class=noselect style=display:none><div id=dialogHeader><div tabindex=0 id=id_dialogclose onclick=setDialogMode() onkeypress='"Enter"==event.key&&setDialogMode()'>✖</div><div id=id_dialogtitle></div></div><div id=dialogBody><div id=dialog1><div id=id_dialogMessage></div></div><div id=dialog2><div id=id_dialogOptions></div></div></div><div id=idx_dlgButtonBar><input id=idx_dlgCancelButton type=button value=Cancel onclick=dialogclose(0)> <input id=idx_dlgOkButton type=button value=OK onclick=dialogclose(1)><div><input id=idx_dlgDeleteButton type=button value=Delete style=display:none onclick=dialogclose(2)></div></div></div></div><script>var recFile=null,recFilePtr=0,recFileStartTime=0,recFileLastTime=0,recFileEndTime=0,recFileMetadata=null,recFileProtocol=0,agentDesktop=null,amtDesktop=null,playing=!1,readState=0,waitTimer=null,waitTimerArgs=null,deskAspectRatio=0,currentDeltaTimeTotalSec=0;function start(){window.onresize=deskAdjust,document.ondrop=ondrop,document.ondragover=ondragover,document.ondragleave=ondragleave,document.onkeypress=onkeypress,Q("PlaySpeed").value=1,cleanup()}function readNextBlock(l){if(recFilePtr+16>recFile.size)QS("progressbar").width="100%",l(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);if(recFilePtr+16+a>recFile.size)QS("progressbar").width="100%",l(-1);else{var i=new FileReader;i.onload=function(){recFilePtr+=16+a,QS("progressbar").width=0==recFileEndTime?Math.floor(recFilePtr/recFile.size*100)+"%":Math.floor((recFileLastTime-recFileStartTime)/(recFileEndTime-recFileStartTime)*100)+"%",l(e,t,r,this.result)},i.readAsBinaryString(recFile.slice(recFilePtr+16,recFilePtr+16+a))}},e.readAsBinaryString(recFile.slice(recFilePtr,recFilePtr+16))}}function readLastBlock(i){if(recFile.size<32)i(-1);else{var e=new FileReader;e.onload=function(){var e=ReadShort(this.result,0),t=ReadShort(this.result,2),a=ReadInt(this.result,4),r=(ReadInt(this.result,8)<<32)+ReadInt(this.result,12);3==e&&16==a&&"MeshCentralMCREC"==this.result.substring(16,32)?i(e,t,r):i(-1)},e.readAsBinaryString(recFile.slice(recFile.size-32,recFile.size))}}function addInfo(e,t){return null==t?"":addInfoNoEsc(e,EscapeHtml(t))}function addInfoNoEsc(e,t){return null==t?"":"<span style=color:gray>"+EscapeHtml(e)+"</span>: <span style=font-size:20px>"+t+"</span><br/>"}function processFirstBlock(e,t,a,r){if(recFileProtocol=0,1==e&&0==t){try{recFileMetadata=JSON.parse(r)}catch(e){return void cleanup()}if(null!=recFileMetadata&&"MeshCentralRelaySession"==recFileMetadata.magic&&1==recFileMetadata.ver){var i="";if(i+=addInfo("Time",recFileMetadata.time),0!=recFileEndTime){var l=Math.floor((recFileEndTime-a)/1e3);i+=addInfo("Duration",format("{0} second{1}",l,1<l?"s":""))}if(i+=addInfo("Username",recFileMetadata.username),i+=addInfo("UserID",recFileMetadata.userid),i+=addInfo("SessionID",recFileMetadata.sessionid),recFileMetadata.ipaddr1&&recFileMetadata.ipaddr2&&(i+=addInfo("Addresses",format("{0} to {1}",recFileMetadata.ipaddr1,recFileMetadata.ipaddr2))),recFileMetadata.devicename&&(i+=addInfo("DeviceName",recFileMetadata.devicename)),i+=addInfo("NodeID",recFileMetadata.nodeid),recFileMetadata.protocol){var n=recFileMetadata.protocol;1==n?n="MeshCentral Terminal":2==n?n="MeshCentral Desktop":100==n?n="Intel® AMT WSMAN":101==n&&(n="Intel® AMT Redirection"),i+=addInfoNoEsc("Protocol",n)}QV("DeskParent",!0),QV("TermParent",!1),1==recFileMetadata.protocol?(recFileProtocol=1,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a):2==recFileMetadata.protocol?(recFileProtocol=2,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(agentDesktop=CreateAgentRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,agentDesktop.State=3,deskAdjust()):101==recFileMetadata.protocol&&(recFileProtocol=101,i+="<br /><br /><span style=color:gray>Press [space] to play/pause.</span>",QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),recFileStartTime=recFileLastTime=a,(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start(),deskAdjust()),QV("metadatadiv",!0),QH("metadatadiv",i),QH("deskstatus",recFile.name)}else cleanup()}else cleanup()}function processBlock(e,t,a,r){if(e<0)pause();else{var i=Math.round((a-recFileLastTime)*parseFloat(Q("PlaySpeed").value));i<5?processBlockEx(e,t,a,r):(waitTimerArgs=[e,t,a,r],waitTimer=setTimeout(function(){waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3])},i))}}function processBlockEx(e,t,a,r){if(0!=playing){var i=0!=(1&t),l=0!=(2&t),n=Math.floor((a-recFileStartTime)/1e3);if(currentDeltaTimeTotalSec!=n){currentDeltaTimeTotalSec=n;var o=Math.floor(n/3600);n-=3600*o;var s=Math.floor(n/60);n-=60*o;var c=Math.floor(n);QH("timespan",pad2(o)+":"+pad2(s)+":"+pad2(c))}2==e&&i&&!l?1==recFileProtocol?agentTerminal.ProcessData(r):2==recFileProtocol?agentDesktop.ProcessData(r):101==recFileProtocol&&(0==readState&&"4100000000000000"==rstr2hex(r)?(readState=1,8<r.length&&amtDesktop.ProcessData(r.substring(8))):1==readState&&amtDesktop.ProcessData(r)):2==e&&i&&l&&101==recFileProtocol&&"0000000008080001000700070003050200000000"==rstr2hex(r)&&(amtDesktop.bpp=1),recFileLastTime=a,playing&&readNextBlock(processBlock)}}function cleanup(){recFilePtr=0,playing=!1,(recFileMetadata=recFile=null)!=agentDesktop&&(agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height),agentDesktop=null),null!=amtDesktop&&(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),amtDesktop=null),recFileEndTime=currentDeltaTimeTotalSec=readState=0,(agentTerminal=waitTimerArgs=null)!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null),QH("deskstatus",""),QE("PlayButton",!1),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("metadatadiv",!0),QH("metadatadiv",'<span style="font-family:Arial,Helvetica Neue,Helvetica,sans-serif;font-size:28px">MeshCentral Session Player</span><br /><br /><span style=color:gray>Drag & drop a .mcrec file or click "Open File..."</span>'),QV("DeskParent",!0),QV("TermParent",!1)}function ondrop(e){if(haltEvent(e),QV("bigfail",!1),QV("bigok",!1),null!=e.dataTransfer){var t=[];for(var a in e.dataTransfer.files)null!=e.dataTransfer.files[a].type&&null!=e.dataTransfer.files[a].size&&0!=e.dataTransfer.files[a].size&&e.dataTransfer.files[a].name.endsWith(".mcrec")&&t.push(e.dataTransfer.files[a]);0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}))}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag,dragtimer=null;function ondragover(e){haltEvent(e),null!=dragtimer&&(clearTimeout(dragtimer),dragtimer=null);QV("bigok",!0),QV("bigfail",!1)}function ondragleave(e){haltEvent(e),dragtimer=setTimeout(function(){QV("bigfail",!1),QV("bigok",!1),dragtimer=null},10)}function onkeypress(e){xxdialogMode||(" "==e.key&&(togglePause(),haltEvent(e)),"1"==e.key&&(Q("PlaySpeed").value=4,haltEvent(e)),"2"==e.key&&(Q("PlaySpeed").value=2,haltEvent(e)),"3"==e.key&&(Q("PlaySpeed").value=1,haltEvent(e)),"4"==e.key&&(Q("PlaySpeed").value=.5,haltEvent(e)),"5"==e.key&&(Q("PlaySpeed").value=.25,haltEvent(e)),"6"==e.key&&(Q("PlaySpeed").value=.1,haltEvent(e)),"0"==e.key&&(pause(),restart(),haltEvent(e)))}function openfile(){setDialogMode(2,"Open File...",3,openfileEx,'<input type=file name=files id=p2fileinput style=width:100% accept=".mcrec" onchange="openfileChanged()" />'),QE("idx_dlgOkButton",!1)}function openfileEx(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}0!=t.length&&(cleanup(),recFile=t[0],recFilePtr=0,readNextBlock(processFirstBlock),readLastBlock(function(e,t,a){recFileEndTime=3==e?a:0}),Q("OpenFileButton").blur())}function openfileChanged(){var e=Q("p2fileinput").files;if(null!=e){var t=[];for(var a in e)null!=e[a].type&&null!=e[a].size&&0!=e[a].size&&e[a].name.endsWith(".mcrec")&&t.push(e[a])}QE("idx_dlgOkButton",1==t.length)}function togglePause(){return null!=recFile&&(1==playing?pause():recFilePtr!=recFile.size&&play()),!1}function play(){Q("PlayButton").blur(),1!=playing&&0!=recFileProtocol&&(playing=!0,QV("metadatadiv",!1),QE("PlayButton",!1),QE("PauseButton",!0),QE("RestartButton",!1),1==recFileProtocol&&null==agentTerminal&&(QV("DeskParent",!1),QV("TermParent",!0),agentTerminal=CreateAmtRemoteTerminal("Term",{}),agentTerminal.State=3),readNextBlock(processBlock))}function pause(){Q("PauseButton").blur(),0!=playing&&(playing=!1,QE("PlayButton",recFilePtr!=recFile.size),QE("PauseButton",!1),QE("RestartButton",0!=recFilePtr),null!=waitTimer&&(clearTimeout(waitTimer),waitTimer=null,processBlockEx(waitTimerArgs[0],waitTimerArgs[1],waitTimerArgs[2],waitTimerArgs[3]),waitTimerArgs=null))}function restart(){Q("RestartButton").blur(),1!=playing&&(currentDeltaTimeTotalSec=readState=recFilePtr=0,QV("metadatadiv",!0),QE("PlayButton",!0),QE("PauseButton",!1),QE("RestartButton",!1),QS("progressbar").width="0px",QH("timespan","00:00:00"),QV("DeskParent",!0),QV("TermParent",!1),agentDesktop?agentDesktop.Canvas.clearRect(0,0,agentDesktop.CanvasId.width,agentDesktop.CanvasId.height):amtDesktop?(amtDesktop.canvas.clearRect(0,0,amtDesktop.CanvasId.width,amtDesktop.CanvasId.height),(amtDesktop=CreateAmtRemoteDesktop("Desk")).onScreenSizeChange=deskAdjust,amtDesktop.State=3,amtDesktop.Start()):agentTerminal=agentTerminal&&null)}function clearConsoleMsg(){QH("p11DeskConsoleMsg","")}function toggleAspectRatio(e){1===e&&(deskAspectRatio=(deskAspectRatio+1)%3),deskAdjust()}function deskAdjust(){var e=Q("DeskParent").clientHeight,t=Q("DeskParent").clientWidth,a=Q("Desk").height,r=Q("Desk").width;if(2==deskAspectRatio)QS("Desk")["margin-top"]=null,QS("Desk").height="100%",QS("Desk").width="100%",QS("DeskParent").overflow="hidden";else if(1==deskAspectRatio)QS("Desk")["margin-top"]="0px",QS("Desk").height=a+"px",QS("Desk").width=r+"px",QS("DeskParent").overflow="scroll";else{if(a/r<e/t){var i=a*t/r+"px";QS("Desk").height=i,QS("Desk").width="100%"}else{var l=r*e/a+"px";QS("Desk").height="100%",QS("Desk").width=l}QS("Desk")["margin-top"]=null,QS("DeskParent").overflow="hidden"}}var xxcurrentView=-1;function setDialogMode(e,t,a,r,i,l){xxdialogMode=e,xxdialogFunc=r,xxdialogButtons=a,xxdialogTag=l,QE("idx_dlgOkButton",!0),QV("idx_dlgOkButton",1&a),QV("idx_dlgCancelButton",2&a),QV("id_dialogclose",2&a||8&a),QV("idx_dlgDeleteButton",4&a),QV("idx_dlgButtonBar",7&a),t&&QH("id_dialogtitle",t);for(var n=1;n<3;n++)QV("dialog"+n,n==e);QV("dialog",e),i&&(2==e?QH("id_dialogOptions",i):QH("id_dialogMessage",i))}function dialogclose(e){var t=xxdialogFunc,a=xxdialogButtons,r=xxdialogTag;setDialogMode(),(8&a||e)&&t&&t(e,r)}function messagebox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e,1)}function statusbox(e,t){setSessionActivity(),QH("id_dialogMessage",t),setDialogMode(1,e)}function haltEvent(e){return e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),!1}function pad2(e){var t="00"+e;return t.substr(t.length-2)}function format(e){var a=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,t){return void 0!==a[t]?a[t]:e})}start()</script> |