From cd5d1bdcfc04c5baf9cc3c69aad952c90199f157 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 5 May 2022 17:50:12 -0700 Subject: [PATCH] Version 1.0.18 --- package.json | 2 +- public/scripts/agent-rdp-0.0.1-min.js | 2 +- public/scripts/agent-redir-ws-0.1.1-min.js | 2 +- translate/translate.json | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 176bd8c3..19b97be4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "1.0.17", + "version": "1.0.18", "keywords": [ "Remote Device Management", "Remote Device Monitoring", diff --git a/public/scripts/agent-rdp-0.0.1-min.js b/public/scripts/agent-rdp-0.0.1-min.js index 2a25b9f5..5dbb0e99 100644 --- a/public/scripts/agent-rdp-0.0.1-min.js +++ b/public/scripts/agent-rdp-0.0.1-min.js @@ -1 +1 @@ -var CreateRDPDesktop=function(e){var s={};function a(e){return(!0===s.m.SwapMouse?[2,0,1,0,0]:[1,0,2,0,0])[e]}function i(e){s.State!=e&&(s.State=e,null!=s.onStateChanged&&s.onStateChanged(s,s.State))}function n(e){var t=s.Canvas.canvas.height/s.CanvasId.clientHeight,a=s.Canvas.canvas.width/s.CanvasId.clientWidth,n=function(e){var t=Array(2);for(t[0]=t[1]=0;e;)t[0]+=e.offsetLeft,t[1]+=e.offsetTop,e=e.offsetParent;return t}(s.Canvas.canvas),a=(e.pageX-n[0])*a,t=(e.pageY-n[1])*t;return e.addx&&(a+=e.addx),e.addy&&(t+=e.addy),{x:a,y:t}}return s.m={},s.State=0,s.canvas=Q(e),"string"==typeof(s.CanvasId=e)&&(s.CanvasId=Q(e)),s.Canvas=s.CanvasId.getContext("2d"),s.ScreenWidth=s.width=1280,s.ScreenHeight=s.height=1024,s.Start=function(e,t,a){i(1),s.nodeid=e,s.port=t;var n={savepass:(s.credentials=a).savecred,useServerCreds:a.servercred,width:a.width,height:a.height,flags:a.flags};a.width&&a.height&&(n.width=s.ScreenWidth=s.width=a.width,n.height=s.ScreenHeight=s.height=a.height,delete a.width,delete a.height),s.render=new Mstsc.Canvas.create(s.canvas),s.socket=new WebSocket("wss://"+window.location.host+"/mstscrelay.ashx"),s.socket.binaryType="arraybuffer",s.socket.onopen=function(){i(2),s.socket.send(JSON.stringify(["infos",{ip:s.nodeid,port:s.port,screen:{width:s.width,height:s.height},domain:a.domain,username:a.username,password:a.password,options:n,locale:Mstsc.locale()}]))},s.socket.onmessage=function(e){if("string"==typeof e.data){var t=JSON.parse(e.data);switch(t[0]){case"rdp-connect":i(3),s.rotation=0,s.Canvas.setTransform(1,0,0,1,0,0),s.Canvas.canvas.width=s.ScreenWidth,s.Canvas.canvas.height=s.ScreenHeight,s.Canvas.fillRect(0,0,s.ScreenWidth,s.ScreenHeight),null!=s.m.onScreenSizeChange&&s.m.onScreenSizeChange(s,s.ScreenWidth,s.ScreenHeight,s.CanvasId);break;case"rdp-bitmap":if(null==s.bitmapData)break;var a=t[1];a.data=s.bitmapData,delete s.bitmapData,s.render.update(a);break;case"rdp-close":s.Stop();break;case"rdp-error":a=t[1];console.log("[mstsc.js] error : "+a.code+"("+a.message+")"),s.Stop()}}else s.bitmapData=e.data},s.socket.onclose=function(){i(0)},i(1)},s.Stop=function(){s.Canvas.fillRect(0,0,s.ScreenWidth,s.ScreenHeight),s.socket&&s.socket.close()},s.m.mousemove=function(e){if(s.socket&&3==s.State){var t=n(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return s.mouseNagleData=["mouse",t.x,t.y,0,!1],null==s.mouseNagleTimer&&(s.mouseNagleTimer=setTimeout(function(){s.socket.send(JSON.stringify(s.mouseNagleData)),s.mouseNagleTimer=null},50)),e.preventDefault(),!1}},s.m.mouseup=function(e){if(s.socket&&3==s.State){var t=n(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return null!=s.mouseNagleTimer&&(clearTimeout(s.mouseNagleTimer),s.mouseNagleTimer=null),s.socket.send(JSON.stringify(["mouse",t.x,t.y,a(e.button),!1])),e.preventDefault(),!1}},s.m.mousedown=function(e){if(s.socket&&3==s.State){var t=n(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return null!=s.mouseNagleTimer&&(clearTimeout(s.mouseNagleTimer),s.mouseNagleTimer=null),s.socket.send(JSON.stringify(["mouse",t.x,t.y,a(e.button),!0])),e.preventDefault(),!1}},s.m.handleKeyUp=function(e){if(s.socket&&3==s.State)return s.socket.send(JSON.stringify(["scancode",Mstsc.scancode(e),!1])),e.preventDefault(),!1},s.m.handleKeyDown=function(e){if(s.socket&&3==s.State)return s.socket.send(JSON.stringify(["scancode",Mstsc.scancode(e),!0])),e.preventDefault(),!1},s.m.mousedblclick=function(){},s.m.handleKeyPress=function(){},s.m.setRotation=function(){},s} \ No newline at end of file +var CreateRDPDesktop=function(e){var s={};function n(e){return(!0===s.m.SwapMouse?[2,0,1,0,0]:[1,0,2,0,0])[e]}function i(e){s.State!=e&&(s.State=e,null!=s.onStateChanged&&s.onStateChanged(s,s.State))}function a(e){var t=s.Canvas.canvas.height/s.CanvasId.clientHeight,n=s.Canvas.canvas.width/s.CanvasId.clientWidth,a=function(e){var t=Array(2);for(t[0]=t[1]=0;e;)t[0]+=e.offsetLeft,t[1]+=e.offsetTop,e=e.offsetParent;return t}(s.Canvas.canvas),n=(e.pageX-a[0])*n,t=(e.pageY-a[1])*t;return e.addx&&(n+=e.addx),e.addy&&(t+=e.addy),{x:n,y:t}}return s.m={},s.State=0,s.canvas=Q(e),"string"==typeof(s.CanvasId=e)&&(s.CanvasId=Q(e)),s.Canvas=s.CanvasId.getContext("2d"),s.ScreenWidth=s.width=1280,s.ScreenHeight=s.height=1024,s.Start=function(e,t,n){i(1),s.nodeid=e,s.port=t;var a={savepass:(s.credentials=n).savecred,useServerCreds:n.servercred,width:n.width,height:n.height,flags:n.flags};n.width&&n.height&&(a.width=s.ScreenWidth=s.width=n.width,a.height=s.ScreenHeight=s.height=n.height,delete n.width,delete n.height),s.render=new Mstsc.Canvas.create(s.canvas),s.socket=new WebSocket("wss://"+window.location.host+"/mstscrelay.ashx"),s.socket.binaryType="arraybuffer",s.socket.onopen=function(){i(2),s.socket.send(JSON.stringify(["infos",{ip:s.nodeid,port:s.port,screen:{width:s.width,height:s.height},domain:n.domain,username:n.username,password:n.password,options:a,locale:Mstsc.locale()}]))},s.socket.onmessage=function(e){if("string"==typeof e.data){var t=JSON.parse(e.data);switch(t[0]){case"rdp-connect":i(3),s.rotation=0,s.Canvas.setTransform(1,0,0,1,0,0),s.Canvas.canvas.width=s.ScreenWidth,s.Canvas.canvas.height=s.ScreenHeight,s.Canvas.fillRect(0,0,s.ScreenWidth,s.ScreenHeight),null!=s.m.onScreenSizeChange&&s.m.onScreenSizeChange(s,s.ScreenWidth,s.ScreenHeight,s.CanvasId);break;case"rdp-bitmap":if(null==s.bitmapData)break;var n=t[1];n.data=s.bitmapData,delete s.bitmapData,s.render.update(n);break;case"rdp-close":s.Stop();break;case"rdp-error":n=t[1];console.log("[mstsc.js] error : "+n.code+"("+n.message+")"),s.Stop();break;case"ping":s.socket.send('["pong"]')}}else s.bitmapData=e.data},s.socket.onclose=function(){i(0)},i(1)},s.Stop=function(){s.Canvas.fillRect(0,0,s.ScreenWidth,s.ScreenHeight),s.socket&&s.socket.close()},s.m.mousemove=function(e){if(s.socket&&3==s.State){var t=a(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return s.mouseNagleData=["mouse",t.x,t.y,0,!1],null==s.mouseNagleTimer&&(s.mouseNagleTimer=setTimeout(function(){s.socket.send(JSON.stringify(s.mouseNagleData)),s.mouseNagleTimer=null},50)),e.preventDefault(),!1}},s.m.mouseup=function(e){if(s.socket&&3==s.State){var t=a(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return null!=s.mouseNagleTimer&&(clearTimeout(s.mouseNagleTimer),s.mouseNagleTimer=null),s.socket.send(JSON.stringify(["mouse",t.x,t.y,n(e.button),!1])),e.preventDefault(),!1}},s.m.mousedown=function(e){if(s.socket&&3==s.State){var t=a(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight))return null!=s.mouseNagleTimer&&(clearTimeout(s.mouseNagleTimer),s.mouseNagleTimer=null),s.socket.send(JSON.stringify(["mouse",t.x,t.y,n(e.button),!0])),e.preventDefault(),!1}},s.m.handleKeyUp=function(e){if(s.socket&&3==s.State)return s.socket.send(JSON.stringify(["scancode",Mstsc.scancode(e),!1])),e.preventDefault(),!1},s.m.handleKeyDown=function(e){if(s.socket&&3==s.State)return s.socket.send(JSON.stringify(["scancode",Mstsc.scancode(e),!0])),e.preventDefault(),!1},s.m.mousewheel=function(e){if(s.socket&&3==s.State){var t=a(e);if(!(t.x<0||t.y<0||t.x>s.ScreenWidth||t.y>s.ScreenHeight)){null!=s.mouseNagleTimer&&(clearTimeout(s.mouseNagleTimer),s.mouseNagleTimer=null);var n=0;return e.detail?n=120*e.detail:e.wheelDelta&&(n=3*e.wheelDelta),0!=n&&s.socket.send(JSON.stringify(["wheel",t.x,t.y,n,!1,!1])),e.preventDefault(),!1}}},s.m.SendStringUnicode=function(e){s.socket&&3==s.State&&s.socket.send(JSON.stringify(["utype",e]))},s.m.mousedblclick=function(){},s.m.handleKeyPress=function(){},s.m.setRotation=function(){},s} \ No newline at end of file diff --git a/public/scripts/agent-redir-ws-0.1.1-min.js b/public/scripts/agent-redir-ws-0.1.1-min.js index de22720b..e7ee6461 100644 --- a/public/scripts/agent-redir-ws-0.1.1-min.js +++ b/public/scripts/agent-redir-ws-0.1.1-min.js @@ -1 +1 @@ -var CreateAgentRedirect=function(e,t,n,o,a,c){var s={};function l(){1==s.webSwitchOk&&1==s.webRtcActive&&(s.latency.current=-1,s.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc0"}'),s.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc1"}'),null!=s.onStateChanged&&s.onStateChanged(s,s.State))}((s.m=t).parent=s).meshserver=e,s.authCookie=o,s.rauthCookie=a,s.State=0,s.nodeid=null,s.options=null,s.socket=null,s.connectstate=-1,s.tunnelid=Math.random().toString(36).substring(2),s.protocol=t.protocol,s.onStateChanged=null,s.ctrlMsgAllowed=!0,s.attemptWebRTC=!1,s.webRtcActive=!1,s.webSwitchOk=!1,s.webchannel=null,s.webrtc=null,s.debugmode=0,s.serverIsRecording=!1,s.urlname="meshrelay.ashx",s.latency={lastSend:null,current:-1,callback:null},null==c&&(c="/"),s.consoleMessage=null,s.onConsoleMessageChange=null,s.metadata=null,s.onMetadataChange=null,s.Start=function(e){var t=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/"+s.urlname+"?browser=1&p="+s.protocol+(e?"&nodeid="+e:"")+"&id="+s.tunnelid;null!=o&&""!=o&&(t+="&auth="+o),null!=urlargs&&null!=urlargs.slowrelay&&(t+="&slowrelay="+urlargs.slowrelay),s.nodeid=e,s.connectstate=0,s.socket=new WebSocket(t),s.socket.binaryType="arraybuffer",s.socket.onopen=s.xxOnSocketConnected,s.socket.onmessage=s.xxOnMessage,s.socket.onerror=function(e){},s.socket.onclose=s.xxOnSocketClosed,s.xxStateChange(1),null!=s.meshserver&&(e="*"+c+"meshrelay.ashx?p="+s.protocol+"&nodeid="+e+"&id="+s.tunnelid,null!=a&&""!=a&&(e+="&rauth="+a),s.meshserver.send({action:"msg",type:"tunnel",nodeid:s.nodeid,value:e,usage:s.protocol}))},s.xxOnSocketConnected=function(){1==s.debugmode&&console.log("onSocketConnected"),s.xxStateChange(2)},s.xxOnControlCommand=function(e){var t;try{t=JSON.parse(e)}catch(e){return}"102938"==t.ctrlChannel?("undefined"!=typeof args&&args.redirtrace&&console.log("RedirRecv",t),"console"==t.type?s.setConsoleMessage(t.msg,t.msgid,t.msgargs,t.timeout):"metadata"==t.type?(s.metadata=t,s.onMetadataChange&&s.onMetadataChange(s.metadata)):"rtt"==t.type&&"number"==typeof t.time?(s.latency.current=(new Date).getTime()-t.time,null!=s.latency.callbacks&&s.latency.callback(s.latency.current)):null!=s.webrtc&&("answer"==t.type?s.webrtc.setRemoteDescription(new RTCSessionDescription(t),function(){},s.xxCloseWebRTC):"webrtc0"==t.type?(s.webSwitchOk=!0,l()):"webrtc1"==t.type?s.sendCtrlMsg('{"ctrlChannel":"102938","type":"webrtc2"}'):t.type)):s.m.ProcessData?s.m.ProcessData(e):console.log(e)},s.setConsoleMessage=function(e,t,n,o){s.consoleMessage!=e&&(s.consoleMessage=e,s.consoleMessageId=t,s.consoleMessageArgs=n,s.consoleMessageTimeout=o,s.onConsoleMessageChange&&s.onConsoleMessageChange(s,s.consoleMessage,s.consoleMessageId))},s.sendCtrlMsg=function(e){if(1==s.ctrlMsgAllowed){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e);try{s.socket.send(e)}catch(e){}}},s.xxOnMessage=function(e){if(s.State<3&&("c"==e.data||"cr"==e.data)){if("cr"==e.data&&(s.serverIsRecording=!0),null!=s.options){delete s.options.action,s.options.type="options";try{s.sendCtrlMsg(JSON.stringify(s.options))}catch(e){}}try{s.socket.send(s.protocol)}catch(e){}return s.xxStateChange(3),void(1==s.attemptWebRTC&&(r=null,"undefined"!=typeof RTCPeerConnection?s.webrtc=new RTCPeerConnection(r):"undefined"!=typeof webkitRTCPeerConnection&&(s.webrtc=new webkitRTCPeerConnection(r)),null!=s.webrtc&&s.webrtc.createDataChannel&&(s.webchannel=s.webrtc.createDataChannel("DataChannel",{}),s.webchannel.binaryType="arraybuffer",s.webchannel.onmessage=s.xxOnMessage,s.webchannel.onopen=function(){s.webRtcActive=!0,l()},s.webchannel.onclose=function(e){s.webRtcActive&&s.Stop()},s.webrtc.onicecandidate=function(e){if(null==e.candidate)try{s.sendCtrlMsg(JSON.stringify(s.webrtcoffer))}catch(e){}else s.webrtcoffer.sdp+="a="+e.candidate.candidate+"\r\n"},s.webrtc.oniceconnectionstatechange=function(){null!=s.webrtc&&("disconnected"==s.webrtc.iceConnectionState?1==s.webRtcActive?s.Stop():s.xxCloseWebRTC():"failed"==s.webrtc.iceConnectionState&&s.xxCloseWebRTC())},s.webrtc.createOffer(function(e){s.webrtcoffer=e,s.webrtc.setLocalDescription(e,function(){},s.xxCloseWebRTC)},s.xxCloseWebRTC,{mandatory:{OfferToReceiveAudio:!1,OfferToReceiveVideo:!1}}))))}if("string"==typeof e.data)"~"==e.data[0]?s.m.ProcessData(e.data):s.xxOnControlCommand(e.data);else if(s.m.ProcessBinaryCommand){if(!(0==u&&e.data.byteLength<4))if(0!=u){var t=new Uint8Array(e.data);if(g.push(t),u+=t.byteLength,d<=u){var n,o=new Uint8Array(u),a=0;for(n in g)o.set(g[n],a),a+=g[n].byteLength;s.m.ProcessBinaryCommand(i,d,o),u=d=i=0,g=[]}}else{var c=((t=new Uint8Array(e.data))[0]<<8)+t[1],r=(t[2]<<8)+t[3];27==c&&8==r&&(c=(t[8]<<8)+t[9],r=(t[5]<<16)+(t[6]<<8)+t[7],t=t.slice(8)),r!=t.byteLength?(i=c,d=r,u=t.byteLength,g=[t]):s.m.ProcessBinaryCommand(c,r,t)}}else s.m.ProcessBinaryData?s.m.ProcessBinaryData(new Uint8Array(e.data)):e.data.byteLength<16e3?s.m.ProcessData(String.fromCharCode.apply(null,new Uint8Array(e.data))):(t=new Blob([new Uint8Array(e.data)]),(e=new FileReader).onload=function(e){s.m.ProcessData(e.target.result)},e.readAsBinaryString(t))};var i=0,d=0,u=0,g=[];return s.sendText=function(e){"string"!=typeof e&&(e=JSON.stringify(e)),s.send(encode_utf8(e))},s.send=function(e){"undefined"!=typeof args&&args.redirtrace&&console.log("RedirSend",typeof e,e.length,"{"==e[0]?e:rstr2hex(e).substring(0,64));try{if(null!=s.socket&&s.socket.readyState==WebSocket.OPEN)if("string"==typeof e)if(1==s.debugmode){for(var t=new Uint8Array(e.length),n=[],o=0;ocontainer->dialog->dialogBody->dialog7->d7rdpkvm->3->d7rdpsize" ] @@ -75271,4 +75270,4 @@ ] } ] -} +} \ No newline at end of file