Fixed RedirTrace.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-16 17:20:39 -08:00
parent da1a8951df
commit f2f23aafb0
9 changed files with 15 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.4.5-v", "version": "0.4.5-w",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -69,6 +69,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
try { controlMsg = JSON.parse(msg); } catch (e) { return; } try { controlMsg = JSON.parse(msg); } catch (e) { return; }
if (controlMsg.ctrlChannel != '102938') { obj.xxOnSocketData(msg); return; } if (controlMsg.ctrlChannel != '102938') { obj.xxOnSocketData(msg); return; }
//console.log(controlMsg); //console.log(controlMsg);
if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirRecv', controlMsg); }
if (controlMsg.type == 'console') { if (controlMsg.type == 'console') {
obj.consoleMessage = controlMsg.msg; obj.consoleMessage = controlMsg.msg;
if (obj.onConsoleMessageChange) { obj.onConsoleMessageChange(obj, obj.consoleMessage); } if (obj.onConsoleMessageChange) { obj.onConsoleMessageChange(obj, obj.consoleMessage); }
@ -102,7 +103,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
if (obj.State < 3) { if (obj.State < 3) {
if ((e.data == 'c') || (e.data == 'cr')) { if ((e.data == 'c') || (e.data == 'cr')) {
if (e.data == 'cr') { obj.serverIsRecording = true; } if (e.data == 'cr') { obj.serverIsRecording = true; }
if (obj.options != null) { delete obj.options.action; obj.options.type = 'options'; try { obj.socket.send(JSON.stringify(obj.options)); } catch (ex) { } } if (obj.options != null) { delete obj.options.action; obj.options.type = 'options'; try { obj.sendCtrlMsg(JSON.stringify(obj.options)); } catch (ex) { } }
try { obj.socket.send(obj.protocol); } catch (ex) { } try { obj.socket.send(obj.protocol); } catch (ex) { }
obj.xxStateChange(3); obj.xxStateChange(3);
@ -119,7 +120,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
obj.webchannel.onclose = function (event) { if (obj.webRtcActive) { obj.Stop(); } } obj.webchannel.onclose = function (event) { if (obj.webRtcActive) { obj.Stop(); } }
obj.webrtc.onicecandidate = function (e) { obj.webrtc.onicecandidate = function (e) {
if (e.candidate == null) { if (e.candidate == null) {
try { obj.socket.send(JSON.stringify(obj.webrtcoffer)); } catch (ex) { } // End of candidates, send the offer try { obj.sendCtrlMsg(JSON.stringify(obj.webrtcoffer)); } catch (ex) { } // End of candidates, send the offer
} else { } else {
obj.webrtcoffer.sdp += ("a=" + e.candidate.candidate + "\r\n"); // New candidate, add it to the SDP obj.webrtcoffer.sdp += ("a=" + e.candidate.candidate + "\r\n"); // New candidate, add it to the SDP
} }
@ -215,7 +216,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
} }
else if (typeof data !== 'string') return; else if (typeof data !== 'string') return;
//console.log("xxOnSocketData", rstr2hex(data)); //console.log("xxOnSocketData", rstr2hex(data));
if ((typeof args != 'undefined') && args.redirtrace) { console.log("RedirRecv", typeof data, data.length, data); } if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirRecv', typeof data, data.length, (data[0] == '{')?data:rstr2hex(data).substring(0, 64)); }
return obj.m.ProcessData(data); return obj.m.ProcessData(data);
} }
@ -227,7 +228,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
obj.send = function (x) { obj.send = function (x) {
//obj.debug("Agent Redir Send(" + obj.webRtcActive + ", " + x.length + "): " + rstr2hex(x)); //obj.debug("Agent Redir Send(" + obj.webRtcActive + ", " + x.length + "): " + rstr2hex(x));
//console.log("Agent Redir Send(" + obj.webRtcActive + ", " + x.length + "): " + ((typeof x == 'string')?x:rstr2hex(x))); //console.log("Agent Redir Send(" + obj.webRtcActive + ", " + x.length + "): " + ((typeof x == 'string')?x:rstr2hex(x)));
if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirSend', typeof x, x.length, x); } if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirSend', typeof x, x.length, (x[0] == '{') ? x : rstr2hex(x).substring(0, 64)); }
try { try {
if (obj.socket != null && obj.socket.readyState == WebSocket.OPEN) { if (obj.socket != null && obj.socket.readyState == WebSocket.OPEN) {
if (typeof x == 'string') { if (typeof x == 'string') {

View File

@ -134,8 +134,8 @@ body {
float: left; float: left;
height: 66px; height: 66px;
color: #c8c8c8; color: #c8c8c8;
padding-left: 20px; padding-left: 14px;
padding-top: 8px; padding-top: 7px;
font-size: 46px; font-size: 46px;
font-family: Arial,Helvetica,sans-serif; font-family: Arial,Helvetica,sans-serif;
font-weight: bold; font-weight: bold;

View File

@ -48,7 +48,7 @@
<!-- Begin Masthead --> <!-- Begin Masthead -->
<div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;"> <div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;">
<div style="float:left">{{{titlehtml}}}</div> <div style="float:left">{{{titlehtml}}}</div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:20px; padding-top:8px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:14px; padding-top:7px">
<strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong> <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong>
</div> </div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">

View File

@ -14,7 +14,7 @@
<div id=mastheadx></div> <div id=mastheadx></div>
<div id=masthead style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div id=masthead style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
<div style="float:left">{{{titlehtml}}}</div> <div style="float:left">{{{titlehtml}}}</div>
<div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px> <div style=float:left;height:66px;color:#c8c8c8;padding-left:14px;padding-top:7px>
<strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title1}}}</font></strong> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title1}}}</font></strong>
</div> </div>
<div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px> <div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px>

View File

@ -15,7 +15,7 @@
<!-- Begin Masthead --> <!-- Begin Masthead -->
<div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;"> <div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;">
<div style="float:left">{{{titlehtml}}}</div> <div style="float:left">{{{titlehtml}}}</div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:20px; padding-top:8px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:16px; padding-top:7px">
<strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong> <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong>
</div> </div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">

View File

@ -14,7 +14,7 @@
<div id=mastheadx></div> <div id=mastheadx></div>
<div id=masthead style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden"> <div id=masthead style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden">
<div style="float:left">{{{titlehtml}}}</div> <div style="float:left">{{{titlehtml}}}</div>
<div style=float:left;height:66px;color:#c8c8c8;padding-left:20px;padding-top:8px> <div style=float:left;height:66px;color:#c8c8c8;padding-left:14px;padding-top:7px>
<strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title1}}}</font></strong> <strong><font style="font-size:46px;font-family:Arial,Helvetica,sans-serif">{{{title1}}}</font></strong>
</div> </div>
<div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px> <div style=float:left;height:66px;color:#c8c8c8;padding-left:5px;padding-top:14px>

View File

@ -15,7 +15,7 @@
<!-- Begin Masthead --> <!-- Begin Masthead -->
<div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;"> <div id="masthead" class=noselect style="background:url(logo.png) 0px 0px;background-color:#036;background-repeat:no-repeat;height:66px;width:100%;overflow:hidden;">
<div style="float:left">{{{titlehtml}}}</div> <div style="float:left">{{{titlehtml}}}</div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:20px; padding-top:8px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:14px; padding-top:7px">
<strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong> <strong><font style="font-size:46px; font-family: Arial, Helvetica, sans-serif;">{{{title1}}}</font></strong>
</div> </div>
<div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px"> <div style="float:left; height: 66px; color:#c8c8c8; padding-left:5px; padding-top:14px">

View File

@ -2338,7 +2338,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
chnl.onData = function (ciraconn, data) { chnl.onData = function (ciraconn, data) {
// CIRA ---> TLS // CIRA ---> TLS
parent.debug('webrelay', 'Relay TLS CIRA data', data.length); parent.debug('webrelay', 'Relay TLS CIRA data', data.length);
if (data.length > 0) { try { ser.updateBuffer(Buffer.from(data, 'binary')); } catch (e) { } } if (data.length > 0) { try { ser.updateBuffer(Buffer.from(data, 'binary')); } catch (ex) { console.log(ex); } }
}; };
// Handle CIRA tunnel state change // Handle CIRA tunnel state change
@ -2438,7 +2438,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
} else { } else {
// Log to recording file // Log to recording file
data = Buffer.from(data, 'binary'); data = Buffer.from(data, 'binary');
recordingEntry(ws.logfile.fd, 2, 0, data, function () { try { ws.send(data); } catch (e) { } }); // TODO: Add TLS support recordingEntry(ws.logfile.fd, 2, 0, data, function () { try { ws.send(data); } catch (ex) { console.log(ex); } }); // TODO: Add TLS support
} }
} }
}; };