mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-14 12:01:52 +00:00
always show operating system section and LastBootUpTime fix
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
8bc760855e
commit
7172d1f701
3 changed files with 118 additions and 111 deletions
|
@ -364,7 +364,18 @@ function linux_identifiers()
|
||||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
child.stderr.on('data', function () { });
|
child.stderr.on('data', function () { });
|
||||||
child.waitExit();
|
child.waitExit();
|
||||||
values.linux.LastBootUpTime = child.stdout.str.trim();
|
var regex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
|
||||||
|
if (regex.test(child.stdout.str.trim())) {
|
||||||
|
values.linux.LastBootUpTime = child.stdout.str.trim();
|
||||||
|
} else {
|
||||||
|
child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stdin.write('date -d "@$(( $(date +%s) - $(awk \'{print int($1)}\' /proc/uptime) ))" "+%Y-%m-%d %H:%M:%S"\nexit\n');
|
||||||
|
child.waitExit();
|
||||||
|
if (regex.test(child.stdout.str.trim())) {
|
||||||
|
values.linux.LastBootUpTime = child.stdout.str.trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
child = null;
|
child = null;
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
|
||||||
|
|
|
@ -6152,91 +6152,89 @@
|
||||||
var sections = [], s = {};
|
var sections = [], s = {};
|
||||||
|
|
||||||
// Operating System
|
// Operating System
|
||||||
if ((hardware.windows && hardware.windows.osinfo) || node.osdesc) {
|
var x = '';
|
||||||
var x = '';
|
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
|
||||||
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
|
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
|
||||||
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
|
if (hardware.windows && hardware.windows.osinfo) {
|
||||||
if (hardware.windows && hardware.windows.osinfo) {
|
var m = hardware.windows.osinfo;
|
||||||
var m = hardware.windows.osinfo;
|
if (m.OSArchitecture) {
|
||||||
if (m.OSArchitecture) {
|
if (m.OSArchitecture.startsWith('32')) { x += addDetailItem("Architecture", "32-bit", s); }
|
||||||
if (m.OSArchitecture.startsWith('32')) { x += addDetailItem("Architecture", "32-bit", s); }
|
else if (m.OSArchitecture.startsWith('64')) { x += addDetailItem("Architecture", "64-bit", s); }
|
||||||
else if (m.OSArchitecture.startsWith('64')) { x += addDetailItem("Architecture", "64-bit", s); }
|
else { x += addDetailItem("Architecture", EscapeHtml(m.OSArchitecture), s); }
|
||||||
else { x += addDetailItem("Architecture", EscapeHtml(m.OSArchitecture), s); }
|
|
||||||
}
|
|
||||||
if(m.LastBootUpTime){
|
|
||||||
var thedate = {
|
|
||||||
year: parseInt(m.LastBootUpTime.substring(0, 4)),
|
|
||||||
month: parseInt(m.LastBootUpTime.substring(4, 6)) - 1, // Months are 0-based in JavaScript (0 - January, 11 - December)
|
|
||||||
day: parseInt(m.LastBootUpTime.substring(6, 8)),
|
|
||||||
hours: parseInt(m.LastBootUpTime.substring(8, 10)),
|
|
||||||
minutes: parseInt(m.LastBootUpTime.substring(10, 12)),
|
|
||||||
seconds: parseInt(m.LastBootUpTime.substring(12, 14)),
|
|
||||||
};
|
|
||||||
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(hardware.linux && hardware.linux.LastBootUpTime){
|
if(m.LastBootUpTime){
|
||||||
var lastBootUpTime = new Date(hardware.linux.LastBootUpTime);
|
|
||||||
var thedate = {
|
var thedate = {
|
||||||
year: lastBootUpTime.getFullYear(),
|
year: parseInt(m.LastBootUpTime.substring(0, 4)),
|
||||||
month: lastBootUpTime.getMonth(),
|
month: parseInt(m.LastBootUpTime.substring(4, 6)) - 1, // Months are 0-based in JavaScript (0 - January, 11 - December)
|
||||||
day: lastBootUpTime.getDate(),
|
day: parseInt(m.LastBootUpTime.substring(6, 8)),
|
||||||
hours: lastBootUpTime.getHours(),
|
hours: parseInt(m.LastBootUpTime.substring(8, 10)),
|
||||||
minutes: lastBootUpTime.getMinutes(),
|
minutes: parseInt(m.LastBootUpTime.substring(10, 12)),
|
||||||
seconds: lastBootUpTime.getSeconds()
|
seconds: parseInt(m.LastBootUpTime.substring(12, 14)),
|
||||||
};
|
};
|
||||||
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
}
|
}
|
||||||
if(hardware.darwin && hardware.darwin.LastBootUpTime){
|
|
||||||
var lastBootUpTime = new Date(hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct?
|
|
||||||
var thedate = {
|
|
||||||
year: lastBootUpTime.getFullYear(),
|
|
||||||
month: lastBootUpTime.getMonth(),
|
|
||||||
day: lastBootUpTime.getDate(),
|
|
||||||
hours: lastBootUpTime.getHours(),
|
|
||||||
minutes: lastBootUpTime.getMinutes(),
|
|
||||||
seconds: lastBootUpTime.getSeconds()
|
|
||||||
};
|
|
||||||
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Windows Security Central
|
|
||||||
if (node.wsc) {
|
|
||||||
var y = [];
|
|
||||||
if (node.wsc.antiVirus != null) { if (node.wsc.antiVirus == 'OK') { y.push("AV" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("AV" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
|
||||||
if (node.wsc.autoUpdate != null) { if (node.wsc.autoUpdate == 'OK') { y.push("Update" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("Update" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
|
||||||
if (node.wsc.firewall != null) { if (node.wsc.firewall == 'OK') { y.push("Firewall" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("Firewall" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
|
||||||
x += addDetailItem("Windows Security", y.join(', '));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defender for Windows Server
|
|
||||||
if(node.defender && !node.wsc) {
|
|
||||||
var y = [];
|
|
||||||
if (node.defender.RealTimeProtection != null) { if (node.defender.RealTimeProtection == true) { y.push("RealTimeProtection" + ' - <span style=color:green>' + "On" + '</span>'); } else { y.push("RealTimeProtection" + ' - <span style=color:red>' + "Off" + '</span>'); } }
|
|
||||||
if (node.defender.TamperProtected != null) { if (node.defender.TamperProtected == true) { y.push("TamperProtection" + ' - <span style=color:green>' + "On" + '</span>'); } else { y.push("TamperProtection" + ' - <span style=color:red>' + "Off" + '</span>'); } }
|
|
||||||
x += addDetailItem("Windows Defender", y.join(', '));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Antivirus
|
|
||||||
if (node.av && node.av.length > 0) {
|
|
||||||
var y = [];
|
|
||||||
for (var i in node.av) {
|
|
||||||
if (node.av[i].product) {
|
|
||||||
var avx = EscapeHtml(node.av[i].product);
|
|
||||||
if (node.av[i].enabled !== true) { avx += ' - <span style=color:red>' + "Disabled" + '</span>'; }
|
|
||||||
if (node.av[i].updated !== true) { avx += ' - <span style=color:red>' + "Out of date" + '</span>'; }
|
|
||||||
if ((node.av[i].enabled == true) && (node.av[i].updated == true)) { avx += ' - <span style=color:green>' + "OK" + '</span>'; }
|
|
||||||
y.push(avx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x += addDetailItem("Antivirus", y.join('<br />'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software' }); }
|
|
||||||
}
|
}
|
||||||
|
if(hardware.linux && hardware.linux.LastBootUpTime){
|
||||||
|
var lastBootUpTime = new Date(hardware.linux.LastBootUpTime);
|
||||||
|
var thedate = {
|
||||||
|
year: lastBootUpTime.getFullYear(),
|
||||||
|
month: lastBootUpTime.getMonth(),
|
||||||
|
day: lastBootUpTime.getDate(),
|
||||||
|
hours: lastBootUpTime.getHours(),
|
||||||
|
minutes: lastBootUpTime.getMinutes(),
|
||||||
|
seconds: lastBootUpTime.getSeconds()
|
||||||
|
};
|
||||||
|
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
||||||
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
|
}
|
||||||
|
if(hardware.darwin && hardware.darwin.LastBootUpTime){
|
||||||
|
var lastBootUpTime = new Date(hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct?
|
||||||
|
var thedate = {
|
||||||
|
year: lastBootUpTime.getFullYear(),
|
||||||
|
month: lastBootUpTime.getMonth(),
|
||||||
|
day: lastBootUpTime.getDate(),
|
||||||
|
hours: lastBootUpTime.getHours(),
|
||||||
|
minutes: lastBootUpTime.getMinutes(),
|
||||||
|
seconds: lastBootUpTime.getSeconds()
|
||||||
|
};
|
||||||
|
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
||||||
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Windows Security Central
|
||||||
|
if (node.wsc) {
|
||||||
|
var y = [];
|
||||||
|
if (node.wsc.antiVirus != null) { if (node.wsc.antiVirus == 'OK') { y.push("AV" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("AV" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
||||||
|
if (node.wsc.autoUpdate != null) { if (node.wsc.autoUpdate == 'OK') { y.push("Update" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("Update" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
||||||
|
if (node.wsc.firewall != null) { if (node.wsc.firewall == 'OK') { y.push("Firewall" + ' - <span style=color:green>' + "OK" + '</span>'); } else { y.push("Firewall" + ' - <span style=color:red>' + "BAD" + '</span>'); } }
|
||||||
|
x += addDetailItem("Windows Security", y.join(', '));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defender for Windows Server
|
||||||
|
if(node.defender && !node.wsc) {
|
||||||
|
var y = [];
|
||||||
|
if (node.defender.RealTimeProtection != null) { if (node.defender.RealTimeProtection == true) { y.push("RealTimeProtection" + ' - <span style=color:green>' + "On" + '</span>'); } else { y.push("RealTimeProtection" + ' - <span style=color:red>' + "Off" + '</span>'); } }
|
||||||
|
if (node.defender.TamperProtected != null) { if (node.defender.TamperProtected == true) { y.push("TamperProtection" + ' - <span style=color:green>' + "On" + '</span>'); } else { y.push("TamperProtection" + ' - <span style=color:red>' + "Off" + '</span>'); } }
|
||||||
|
x += addDetailItem("Windows Defender", y.join(', '));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Antivirus
|
||||||
|
if (node.av && node.av.length > 0) {
|
||||||
|
var y = [];
|
||||||
|
for (var i in node.av) {
|
||||||
|
if (node.av[i].product) {
|
||||||
|
var avx = EscapeHtml(node.av[i].product);
|
||||||
|
if (node.av[i].enabled !== true) { avx += ' - <span style=color:red>' + "Disabled" + '</span>'; }
|
||||||
|
if (node.av[i].updated !== true) { avx += ' - <span style=color:red>' + "Out of date" + '</span>'; }
|
||||||
|
if ((node.av[i].enabled == true) && (node.av[i].updated == true)) { avx += ' - <span style=color:green>' + "OK" + '</span>'; }
|
||||||
|
y.push(avx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x += addDetailItem("Antivirus", y.join('<br />'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software' }); }
|
||||||
|
|
||||||
// MeshAgent
|
// MeshAgent
|
||||||
if (node.agent) {
|
if (node.agent) {
|
||||||
|
|
|
@ -12018,42 +12018,40 @@
|
||||||
var sections = [], s = {};
|
var sections = [], s = {};
|
||||||
|
|
||||||
// Operating System
|
// Operating System
|
||||||
if ((hardware.windows && hardware.windows.osinfo) || node.osdesc) {
|
var x = '';
|
||||||
var x = '';
|
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
|
||||||
if (node.rname) { x += addDetailItem("Name", EscapeHtml(node.rname), s); }
|
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
|
||||||
if (node.osdesc) { x += addDetailItem("Version", EscapeHtml(node.osdesc), s); }
|
if (hardware.windows && hardware.windows.osinfo) {
|
||||||
if (hardware.windows && hardware.windows.osinfo) {
|
var m = hardware.windows.osinfo;
|
||||||
var m = hardware.windows.osinfo;
|
if (m.OSArchitecture) {
|
||||||
if (m.OSArchitecture) {
|
if (m.OSArchitecture.startsWith('32')) { x += addDetailItem("Architecture", "32-bit", s); }
|
||||||
if (m.OSArchitecture.startsWith('32')) { x += addDetailItem("Architecture", "32-bit", s); }
|
else if (m.OSArchitecture.startsWith('64')) { x += addDetailItem("Architecture", "64-bit", s); }
|
||||||
else if (m.OSArchitecture.startsWith('64')) { x += addDetailItem("Architecture", "64-bit", s); }
|
else { x += addDetailItem("Architecture", EscapeHtml(m.OSArchitecture), s); }
|
||||||
else { x += addDetailItem("Architecture", EscapeHtml(m.OSArchitecture), s); }
|
|
||||||
}
|
|
||||||
if(m.LastBootUpTime){
|
|
||||||
var thedate = {
|
|
||||||
year: parseInt(m.LastBootUpTime.substring(0, 4)),
|
|
||||||
month: parseInt(m.LastBootUpTime.substring(4, 6)) - 1, // Months are 0-based in JavaScript (0 - January, 11 - December)
|
|
||||||
day: parseInt(m.LastBootUpTime.substring(6, 8)),
|
|
||||||
hours: parseInt(m.LastBootUpTime.substring(8, 10)),
|
|
||||||
minutes: parseInt(m.LastBootUpTime.substring(10, 12)),
|
|
||||||
seconds: parseInt(m.LastBootUpTime.substring(12, 14)),
|
|
||||||
};
|
|
||||||
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(hardware.linux && hardware.linux.LastBootUpTime){
|
if(m.LastBootUpTime){
|
||||||
var lastBootUpTime = new Date(hardware.linux.LastBootUpTime);
|
var thedate = {
|
||||||
const date = printDateTime(lastBootUpTime);
|
year: parseInt(m.LastBootUpTime.substring(0, 4)),
|
||||||
|
month: parseInt(m.LastBootUpTime.substring(4, 6)) - 1, // Months are 0-based in JavaScript (0 - January, 11 - December)
|
||||||
|
day: parseInt(m.LastBootUpTime.substring(6, 8)),
|
||||||
|
hours: parseInt(m.LastBootUpTime.substring(8, 10)),
|
||||||
|
minutes: parseInt(m.LastBootUpTime.substring(10, 12)),
|
||||||
|
seconds: parseInt(m.LastBootUpTime.substring(12, 14)),
|
||||||
|
};
|
||||||
|
const date = printDateTime(new Date(thedate.year, thedate.month, thedate.day, thedate.hours, thedate.minutes, thedate.seconds));
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
}
|
}
|
||||||
if(hardware.darwin && hardware.darwin.LastBootUpTime){
|
|
||||||
var lastBootUpTime = new Date(hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct?
|
|
||||||
const date = printDateTime(lastBootUpTime);
|
|
||||||
x += addDetailItem("Last Boot Up Time", date);
|
|
||||||
}
|
|
||||||
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software64.png'}); }
|
|
||||||
}
|
}
|
||||||
|
if(hardware.linux && hardware.linux.LastBootUpTime){
|
||||||
|
var lastBootUpTime = new Date(hardware.linux.LastBootUpTime);
|
||||||
|
const date = printDateTime(lastBootUpTime);
|
||||||
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
|
}
|
||||||
|
if(hardware.darwin && hardware.darwin.LastBootUpTime){
|
||||||
|
var lastBootUpTime = new Date(hardware.darwin.LastBootUpTime * 1000); // must times by 1000 even tho timestamp is correct?
|
||||||
|
const date = printDateTime(lastBootUpTime);
|
||||||
|
x += addDetailItem("Last Boot Up Time", date);
|
||||||
|
}
|
||||||
|
if (x != '') { sections.push({ name: "Operating System", html: x, img: 'software64.png'}); }
|
||||||
|
|
||||||
// MeshAgent
|
// MeshAgent
|
||||||
if (node.agent) {
|
if (node.agent) {
|
||||||
|
|
Loading…
Reference in a new issue