mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 14:01:43 +03:00
Added copy in network interface dialog, commented out sysinfo until agent binary fix.
This commit is contained in:
parent
bfd56a8a64
commit
01025a7ec1
@ -822,6 +822,7 @@ function createMeshCore(agent)
|
||||
sendConsoleText('getScript: ' + JSON.stringify(data));
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 'sysinfo': {
|
||||
// Fetch system information
|
||||
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
||||
@ -837,7 +838,6 @@ function createMeshCore(agent)
|
||||
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
||||
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
||||
}
|
||||
/*
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
var defragResult = function (r)
|
||||
@ -857,18 +857,18 @@ function createMeshCore(agent)
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
}
|
||||
}
|
||||
var pr = require('win-info').defrag({ volume: 'C:' }); // Defrag
|
||||
var pr = require('win-info').defrag({ volume: 'C:' }); // Defrag TODO
|
||||
pr.callname = 'defrag';
|
||||
pr.sessionid = data.sessionid;
|
||||
pr.then(defragResult, defragResult);
|
||||
} else {
|
||||
*/
|
||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
//}
|
||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
}
|
||||
} catch (ex) { }
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||
case 'pong': { break; }
|
||||
default:
|
||||
@ -1650,7 +1650,7 @@ function createMeshCore(agent)
|
||||
var response = null;
|
||||
switch (cmd) {
|
||||
case 'help': { // Displays available commands
|
||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo.';
|
||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av.'; // cpuinfo, sysinfo
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -1814,6 +1814,7 @@ function createMeshCore(agent)
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 'cpuinfo': { // Return system information
|
||||
// CPU & memory utilization
|
||||
pr = require('sysinfo').cpuUtilization();
|
||||
@ -1849,6 +1850,7 @@ function createMeshCore(agent)
|
||||
}
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 'info': { // Return information about the agent and agent core module
|
||||
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
||||
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
||||
|
16
agents/meshcore.min.js
vendored
16
agents/meshcore.min.js
vendored
@ -822,6 +822,7 @@ function createMeshCore(agent)
|
||||
sendConsoleText('getScript: ' + JSON.stringify(data));
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 'sysinfo': {
|
||||
// Fetch system information
|
||||
if (process.platform != 'win32') break; // Remove this when Linux/MacOS support this.
|
||||
@ -837,7 +838,6 @@ function createMeshCore(agent)
|
||||
try { delete x.TotalVirtualMemorySize; } catch (ex) { }
|
||||
try { delete x.TotalVisibleMemorySize; } catch (ex) { }
|
||||
}
|
||||
/*
|
||||
if (process.platform == 'win32')
|
||||
{
|
||||
var defragResult = function (r)
|
||||
@ -857,18 +857,18 @@ function createMeshCore(agent)
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
}
|
||||
}
|
||||
var pr = require('win-info').defrag({ volume: 'C:' }); // Defrag
|
||||
var pr = require('win-info').defrag({ volume: 'C:' }); // Defrag TODO
|
||||
pr.callname = 'defrag';
|
||||
pr.sessionid = data.sessionid;
|
||||
pr.then(defragResult, defragResult);
|
||||
} else {
|
||||
*/
|
||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
//}
|
||||
results.hash = require('SHA384Stream').create().syncHash(JSON.stringify(results)).toString('hex');
|
||||
if (data.hash != results.hash) { mesh.SendCommand({ "action": "sysinfo", "sessionid": this.sessionid, "data": results }); }
|
||||
}
|
||||
} catch (ex) { }
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 'ping': { mesh.SendCommand('{"action":"pong"}'); break; }
|
||||
case 'pong': { break; }
|
||||
default:
|
||||
@ -1650,7 +1650,7 @@ function createMeshCore(agent)
|
||||
var response = null;
|
||||
switch (cmd) {
|
||||
case 'help': { // Displays available commands
|
||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av, cpuinfo, sysinfo.';
|
||||
response = 'Available commands: help, info, osinfo, args, print, type, dbget, dbset, dbcompact, eval, parseuri, httpget,\r\nwslist, wsconnect, wssend, wsclose, notify, ls, ps, kill, amt, netinfo, location, power, wakeonlan, scanwifi,\r\nscanamt, setdebug, smbios, rawsmbios, toast, lock, users, sendcaps, openurl, amtreset, amtccm, amtacm,\r\namtdeactivate, amtpolicy, getscript, getclip, setclip, log, av.'; // cpuinfo, sysinfo
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@ -1814,6 +1814,7 @@ function createMeshCore(agent)
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 'cpuinfo': { // Return system information
|
||||
// CPU & memory utilization
|
||||
pr = require('sysinfo').cpuUtilization();
|
||||
@ -1849,6 +1850,7 @@ function createMeshCore(agent)
|
||||
}
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case 'info': { // Return information about the agent and agent core module
|
||||
response = 'Current Core: ' + meshCoreObj.value + '.\r\nAgent Time: ' + Date() + '.\r\nUser Rights: 0x' + rights.toString(16) + '.\r\nPlatform: ' + process.platform + '.\r\nCapabilities: ' + meshCoreObj.caps + '.\r\nServer URL: ' + mesh.ServerUrl + '.';
|
||||
if (amt != null) { response += '\r\nBuilt-in LMS: ' + ['Disabled', 'Connecting..', 'Connected'][amt.lmsstate] + '.'; }
|
||||
|
@ -911,9 +911,11 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
}
|
||||
|
||||
// Fetch system information
|
||||
/*
|
||||
db.GetHash('si' + obj.dbNodeKey, function (err, results) {
|
||||
if ((results != null) && (results.length == 1)) { obj.send(JSON.stringify({ action: 'sysinfo', hash: results[0].hash })); } else { obj.send(JSON.stringify({ action: 'sysinfo' })); }
|
||||
});
|
||||
*/
|
||||
|
||||
// Do this if IP location is enabled on this domain TODO: Set IP location per device group?
|
||||
if (domain.iplocation == true) {
|
||||
@ -1304,6 +1306,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case 'sysinfo': {
|
||||
//console.log('sysinfo', obj.nodeid, JSON.stringify(command.data.hash));
|
||||
command.data._id = 'si' + obj.dbNodeKey;
|
||||
@ -1317,6 +1320,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
});
|
||||
break;
|
||||
}
|
||||
*/
|
||||
default: {
|
||||
parent.agentStats.unknownAgentActionCount++;
|
||||
console.log('Unknown agent action (' + obj.remoteaddrport + '): ' + command.action + '.');
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.3.9-h",
|
||||
"version": "0.3.9-i",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
|
File diff suppressed because one or more lines are too long
@ -1497,13 +1497,13 @@
|
||||
var splitip = currentNode.lastaddr.split(':');
|
||||
if (splitip.length > 2) {
|
||||
// IPv6
|
||||
x += addHtmlValue2('Last agent address', currentNode.lastaddr);
|
||||
x += addHtmlValue2('Last agent address', currentNode.lastaddr + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(currentNode.lastaddr) + '\") width=10 height=10>');
|
||||
} else {
|
||||
// IPv4
|
||||
if (isPrivateIP(currentNode.lastaddr)) {
|
||||
x += addHtmlValue2('Last agent address', splitip[0]);
|
||||
x += addHtmlValue2('Last agent address', splitip[0] + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
|
||||
} else {
|
||||
x += addHtmlValue2('Last agent address', '<a href="https://iplocation.com/?ip=' + splitip[0] + '" rel="noreferrer noopener" target="MeshIPLoopup">' + splitip[0] + '</a>');
|
||||
x += addHtmlValue2('Last agent address', '<a href="https://iplocation.com/?ip=' + splitip[0] + '" rel="noreferrer noopener" target="MeshIPLoopup">' + splitip[0] + '</a> <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(splitip[0]) + '\") width=10 height=10>');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1515,11 +1515,11 @@
|
||||
if (net.name) { x += addHtmlValue2('Name', '<b>' + EscapeHtml(net.name) + '</b>'); }
|
||||
if (net.desc) { x += addHtmlValue2('Description', EscapeHtml(net.desc).replace('(R)', '®').replace('(r)', '®')); }
|
||||
if (net.dnssuffix) { x += addHtmlValue2('DNS suffix', EscapeHtml(net.dnssuffix)); }
|
||||
if (net.mac) { x += addHtmlValue2('MAC address', '<a href="https://dnslytics.com/mac-address-lookup/' + net.mac.substring(0,6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.mac.toLowerCase()) + '</a>'); }
|
||||
if (net.v4addr) { x += addHtmlValue2('IPv4 address', EscapeHtml(net.v4addr)); }
|
||||
if (net.v4mask) { x += addHtmlValue2('IPv4 mask', EscapeHtml(net.v4mask)); }
|
||||
if (net.v4gateway) { x += addHtmlValue2('IPv4 gateway', EscapeHtml(net.v4gateway)); }
|
||||
if (net.gatewaymac) { x += addHtmlValue2('Gateway MAC', '<a href="https://dnslytics.com/mac-address-lookup/' + net.gatewaymac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.gatewaymac.toLowerCase()) + '</a>'); }
|
||||
if (net.mac) { x += addHtmlValue2('MAC address', '<a href="https://dnslytics.com/mac-address-lookup/' + net.mac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.mac.toLowerCase()) + '</a> <img src="images/link4.png" title="Copy MAC address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.mac.toLowerCase()) + '\") width=10 height=10>'); }
|
||||
if (net.v4addr) { x += addHtmlValue2('IPv4 address', EscapeHtml(net.v4addr) + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4addr) + '\") width=10 height=10>'); }
|
||||
if (net.v4mask) { x += addHtmlValue2('IPv4 mask', EscapeHtml(net.v4mask) + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4mask) + '\") width=10 height=10>'); }
|
||||
if (net.v4gateway) { x += addHtmlValue2('IPv4 gateway', EscapeHtml(net.v4gateway) + ' <img src="images/link4.png" title="Copy address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.v4gateway) + '\") width=10 height=10>'); }
|
||||
if (net.gatewaymac) { x += addHtmlValue2('Gateway MAC', '<a href="https://dnslytics.com/mac-address-lookup/' + net.gatewaymac.substring(0, 6) + '" rel="noreferrer noopener" target="MeshMACLoopup">' + EscapeHtml(net.gatewaymac.toLowerCase()) + '</a> <img src="images/link4.png" title="Copy MAC address to clipboard" style="cursor:pointer" onclick=copyTextToClip2(\"' + encodeURIComponent(net.gatewaymac.toLowerCase()) + '\") width=10 height=10>'); }
|
||||
}
|
||||
x += '</div>';
|
||||
QH('d2netinfo', x);
|
||||
@ -8709,6 +8709,7 @@
|
||||
function u2fSupported() { return (window.u2f && ((navigator.userAgent.indexOf('Chrome/') > 0) || (navigator.userAgent.indexOf('Firefox/') > 0) || (navigator.userAgent.indexOf('Opera/') > 0) || (navigator.userAgent.indexOf('Safari/') > 0))); }
|
||||
function findOne(arr1, arr2) { if ((arr1 == null) || (arr2 == null)) return false; return arr2.some(function (v) { return arr1.indexOf(v) >= 0; }); };
|
||||
function copyTextToClip(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = txt; document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
||||
function copyTextToClip2(txt) { function selectElementText(e) { if (document.selection) { var range = document.body.createTextRange(); range.moveToElementText(e); range.select(); } else if (window.getSelection) { var range = document.createRange(); range.selectNode(e); window.getSelection().removeAllRanges(); window.getSelection().addRange(range); } } var e = document.createElement('DIV'); e.textContent = decodeURIComponent(txt); document.body.appendChild(e); selectElementText(e); document.execCommand('copy'); e.remove(); }
|
||||
function capitalizeFirstLetter(x) { return x.charAt(0).toUpperCase() + x.slice(1); }
|
||||
function printDate(d) { return d.toLocaleDateString(args.locale); }
|
||||
function printTime(d) { return d.toLocaleTimeString(args.locale); }
|
||||
|
Loading…
Reference in New Issue
Block a user