mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-14 12:01:52 +00:00
Fix for invalid amtactivation.log parsing.
This commit is contained in:
parent
7e0e790e39
commit
0240d1a651
1 changed files with 10 additions and 7 deletions
|
@ -2851,16 +2851,19 @@ function CreateMeshCentralServer(config, args) {
|
||||||
obj.fs.readFile(amtlogfilename, 'utf8', function (err, data) {
|
obj.fs.readFile(amtlogfilename, 'utf8', function (err, data) {
|
||||||
var amtPasswords = {}; // UUID --> [Passwords]
|
var amtPasswords = {}; // UUID --> [Passwords]
|
||||||
if ((err == null) && (data != null)) {
|
if ((err == null) && (data != null)) {
|
||||||
const lines = data.split('\r\n');
|
const lines = data.split('\r\n').join('\n').split('\n');
|
||||||
for (var i in lines) {
|
for (var i in lines) {
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
if (line.startsWith('{')) {
|
if (line.startsWith('{')) {
|
||||||
var j = JSON.parse(line);
|
var j = null;
|
||||||
if ((typeof j.amtUuid == 'string') && (typeof j.password == 'string')) {
|
try { j = JSON.parse(line); } catch (ex) { }
|
||||||
if (amtPasswords[j.amtUuid] == null) {
|
if ((j != null) && (typeof j == 'object')) {
|
||||||
amtPasswords[j.amtUuid] = [j.password]; // Add password to array
|
if ((typeof j.amtUuid == 'string') && (typeof j.password == 'string')) {
|
||||||
} else {
|
if (amtPasswords[j.amtUuid] == null) {
|
||||||
amtPasswords[j.amtUuid].unshift(j.password); // Add password at the start of the array
|
amtPasswords[j.amtUuid] = [j.password]; // Add password to array
|
||||||
|
} else {
|
||||||
|
amtPasswords[j.amtUuid].unshift(j.password); // Add password at the start of the array
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue