diff --git a/agents/MeshCentralRouter.exe b/agents/MeshCentralRouter.exe index ac726391..7e7ea1cd 100644 Binary files a/agents/MeshCentralRouter.exe and b/agents/MeshCentralRouter.exe differ diff --git a/meshuser.js b/meshuser.js index f4818f0f..1554fe92 100644 --- a/meshuser.js +++ b/meshuser.js @@ -4335,8 +4335,9 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use // Add a user authentication cookie to a url var cookieContent = { userid: user._id, domainid: user.domain }; if (command.nodeid) { cookieContent.nodeid = command.nodeid; } - if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want to agent to TCP connect to a remote address - if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want to agent to TCP connect to a remote port + if (command.tcpaddr) { cookieContent.tcpaddr = command.tcpaddr; } // Indicates the browser want the agent to TCP connect to a remote address + if (command.tcpport) { cookieContent.tcpport = command.tcpport; } // Indicates the browser want the agent to TCP connect to a remote port + //if (command.localport) { cookieContent.localport = command.localport; } // Indicates the browser want MeshCenral Router to use a local port if (command.ip) { cookieContent.ip = command.ip; } // Indicates the browser want to agent to relay a TCP connection to a IP:port if (node.mtype == 3) { cookieContent.lc = 1; command.localRelay = true; } // Indicate this is for a local connection command.cookie = parent.parent.encodeCookie(cookieContent, parent.parent.loginCookieEncryptionKey); diff --git a/views/default.handlebars b/views/default.handlebars index e65052b7..65283b33 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2482,6 +2482,7 @@ if (message.nodeid != null) { url += ('&nodeid=' + message.nodeid); } if (message.tcpport != null) { url += ('&protocol=1&remoteport=' + message.tcpport); } if (message.localRelay) { url += '&local=1'; } + if (message.localport) { url += '&localport=' + message.localport; } if (message.ip != null) { url += ('&remoteip=' + message.ip); } url += ('&appid=' + message.protocol + '&autoexit=1'); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP downloadFile(url, ''); @@ -4191,47 +4192,6 @@ } } - // Return HTML with a list of MeshCentral Router links - function getShortRouterLinks(node) { - var x = '', meshrights = GetNodeRights(node); - - // RDP link, show this link only of the remote machine is Windows. - if (((node.conn & 1) != 0) && (node.agent) && ((meshrights & 8) != 0) && (node.agent.id != 14)) { - if ((node.agent.id > 0) && (node.agent.id < 5)) { - if (navigator.platform.toLowerCase() == 'win32') { - if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.rdp != false)) { - x += '' + "RDP" + ' '; - } - } - } - if (node.agent.id > 4) { - if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) { - if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.ssh != false)) { - x += '' + "SSH" + ' '; - } - } - if (navigator.platform.toLowerCase() == 'win32') { - if ((serverinfo.devicemeshrouterlinks == null) || (serverinfo.devicemeshrouterlinks.scp != false)) { - x += '' + "SCP" + ' '; - } - } - } - if ((navigator.platform.toLowerCase() == 'win32') || (navigator.platform.toLowerCase() == 'macintel')) { - if ((serverinfo.devicemeshrouterlinks != null) && (Array.isArray(serverinfo.devicemeshrouterlinks.extralinks))) { - for (var i in serverinfo.devicemeshrouterlinks.extralinks) { - var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0; - if (doesDeviceMatchFilterTags(node, r.filter)) { - if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; } - x += '' + r.name + ' '; - } - } - } - } - } - - return x; - } - // Check if this device matches any of the given filters function doesDeviceMatchFilterTags(node, filter) { if (filter == null) return true; // No filters, every device matches. @@ -6493,7 +6453,7 @@ var r = serverinfo.devicemeshrouterlinks.extralinks[i], p = 0; if (doesDeviceMatchFilterTags(node, r.filter)) { if (typeof r.protocol == 'number') { p = r.protocol; } else if (r.protocol == 'http') { p = 1; } else if (r.protocol == 'https') { p = 2; } else if (r.protocol == 'rdp') { p = 3; } else if (r.protocol == 'ssh') { p = 4; } else if (r.protocol == 'scp') { p = 5; } - x += '' + r.name + ' '; + x += '' + r.name + ' '; } } } @@ -7274,10 +7234,10 @@ meshserver.send({ action: 'removedevices', nodeids: [ nodeid ] }); } - function p10MCRouter(nodeid, protocol, port, ip) { + function p10MCRouter(nodeid, protocol, port, ip, localport) { var node = getNodeFromId(nodeid); if ((protocol == 3) && (port == null)) { if (node.rdpport != null) { port = node.rdpport; } else { port = 3389; } } - meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, ip: ip, tag: 'MCRouter', protocol: protocol }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP + meshserver.send({ action: 'getcookie', nodeid: nodeid, tcpport: port, ip: ip, tag: 'MCRouter', protocol: protocol, localport: localport }); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP return false; }