mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-03 19:44:26 +03:00
Lots of small fixed.
This commit is contained in:
parent
2ca5117b08
commit
8149a73510
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
agents/oldagents/MeshService.exe
Normal file
BIN
agents/oldagents/MeshService.exe
Normal file
Binary file not shown.
BIN
agents/oldagents/MeshService64.exe
Normal file
BIN
agents/oldagents/MeshService64.exe
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_arm
Normal file
BIN
agents/oldagents/meshagent_arm
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_mips
Normal file
BIN
agents/oldagents/meshagent_mips
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_pogo
Normal file
BIN
agents/oldagents/meshagent_pogo
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_poky
Normal file
BIN
agents/oldagents/meshagent_poky
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_poky64
Normal file
BIN
agents/oldagents/meshagent_poky64
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_x86
Normal file
BIN
agents/oldagents/meshagent_x86
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_x86-64
Normal file
BIN
agents/oldagents/meshagent_x86-64
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_x86-64_nokvm
Normal file
BIN
agents/oldagents/meshagent_x86-64_nokvm
Normal file
Binary file not shown.
BIN
agents/oldagents/meshagent_x86_nokvm
Normal file
BIN
agents/oldagents/meshagent_x86_nokvm
Normal file
Binary file not shown.
21
meshagent.js
21
meshagent.js
@ -119,7 +119,6 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
ws.on('message', function (msg) {
|
||||
if (msg.length < 2) return;
|
||||
if (typeof msg == 'object') { msg = msg.toString('binary'); } // TODO: Could change this entire method to use Buffer instead of binary string
|
||||
|
||||
if (obj.authenticated == 2) { // We are authenticated
|
||||
if ((obj.agentUpdate == null) && (msg.charCodeAt(0) == 123)) { processAgentData(msg); } // Only process JSON messages if meshagent update is not in progress
|
||||
if (msg.length < 2) return;
|
||||
@ -372,6 +371,15 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
ChangeAgentTag(tag);
|
||||
}
|
||||
} else if (obj.authenticated < 2) { // We are not authenticated
|
||||
// Check if this is a un-authenticated JSON
|
||||
if (msg.charCodeAt(0) == 123) {
|
||||
var str = msg.toString('utf8'), command = null;
|
||||
if (str[0] == '{') {
|
||||
try { command = JSON.parse(str); } catch (ex) { } // If the command can't be parsed, ignore it.
|
||||
if ((command != null) && (command.action === 'agentName') && (typeof command.value == 'string') && (command.value.length > 0) && (command.value.length < 256)) { obj.agentName = command.value; }
|
||||
}
|
||||
return;
|
||||
}
|
||||
const cmd = common.ReadShort(msg, 0);
|
||||
if (cmd == 1) {
|
||||
// Agent authentication request
|
||||
@ -447,7 +455,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
}
|
||||
else if (cmd == 3) {
|
||||
// Agent meshid
|
||||
if ((msg.length < 72) || ((obj.receivedCommands & 4) != 0)) return;
|
||||
if ((msg.length < 70) || ((obj.receivedCommands & 4) != 0)) return;
|
||||
obj.receivedCommands += 4; // Agent can't send the same command twice on the same connection ever. Block DOS attack path.
|
||||
|
||||
// Set the meshid
|
||||
@ -464,8 +472,14 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
}
|
||||
//console.log('MeshID', obj.meshid);
|
||||
obj.agentInfo.capabilities = common.ReadInt(msg, 66);
|
||||
if (msg.length > 70) {
|
||||
const computerNameLen = common.ReadShort(msg, 70);
|
||||
obj.agentInfo.computerName = Buffer.from(msg.substring(72, 72 + computerNameLen), 'binary').toString('utf8');
|
||||
//console.log('computerName', msg.length, computerNameLen, obj.agentInfo.computerName);
|
||||
} else {
|
||||
obj.agentInfo.computerName = '';
|
||||
//console.log('computerName-none');
|
||||
}
|
||||
obj.dbMeshKey = 'mesh/' + domain.id + '/' + obj.meshid;
|
||||
completeAgentConnection();
|
||||
} else if (cmd == 4) {
|
||||
@ -760,7 +774,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||
db.Set({ _id: 'lc' + obj.dbNodeKey, type: 'lastconnect', domain: domain.id, time: obj.connectTime, addr: obj.remoteaddrport, cause: 1 });
|
||||
|
||||
// This node does not exist, create it.
|
||||
var device = { type: 'node', mtype: mesh.mtype, _id: obj.dbNodeKey, icon: obj.agentInfo.platformType, meshid: obj.dbMeshKey, name: obj.agentInfo.computerName, rname: obj.agentInfo.computerName, domain: domain.id, agent: { ver: obj.agentInfo.agentVersion, id: obj.agentInfo.agentId, caps: obj.agentInfo.capabilities }, host: null };
|
||||
var agentName = obj.agentName ? obj.agentName : obj.agentInfo.computerName;
|
||||
var device = { type: 'node', mtype: mesh.mtype, _id: obj.dbNodeKey, icon: obj.agentInfo.platformType, meshid: obj.dbMeshKey, name: agentName, rname: obj.agentInfo.computerName, domain: domain.id, agent: { ver: obj.agentInfo.agentVersion, id: obj.agentInfo.agentId, caps: obj.agentInfo.capabilities }, host: null };
|
||||
db.Set(device);
|
||||
|
||||
// Event the new node
|
||||
|
@ -263,7 +263,7 @@
|
||||
var newAccount = '{{{newAccount}}}';
|
||||
var passhint = '{{{passhint}}}';
|
||||
var newAccountPass = parseInt('{{{newAccountPass}}}');
|
||||
var emailCheck = ('{{{emailcheck}}}' == 'true');
|
||||
var emailCheck = '{{{emailcheck}}}';
|
||||
var features = parseInt('{{{features}}}');
|
||||
var passRequirements = '{{{passRequirements}}}';
|
||||
if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } else { passRequirements = {}; }
|
||||
@ -322,8 +322,8 @@
|
||||
QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link.
|
||||
if ((passRequirements.hint === true) && (passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); }
|
||||
QV('newAccountPass', (newAccountPass == 1));
|
||||
QV('resetAccountDiv', (emailCheck == true));
|
||||
QV('hrAccountDiv', (emailCheck == true) || (newAccountPass == 1));
|
||||
QV('resetAccountDiv', (emailCheck == 'true'));
|
||||
QV('hrAccountDiv', (emailCheck == 'true') || (newAccountPass == 1));
|
||||
|
||||
if (loginMode == '4') {
|
||||
try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
|
||||
|
@ -258,7 +258,7 @@
|
||||
var loginMode = '{{{loginmode}}}';
|
||||
var newAccount = '{{{newAccount}}}';
|
||||
var newAccountPass = parseInt('{{{newAccountPass}}}');
|
||||
var emailCheck = ('{{{emailcheck}}}' == 'true');
|
||||
var emailCheck = '{{{emailcheck}}}';
|
||||
var passRequirements = '{{{passRequirements}}}';
|
||||
var hardwareKeyChallenge = decodeURIComponent('{{{hkey}}}');
|
||||
if (passRequirements != '') { passRequirements = JSON.parse(decodeURIComponent(passRequirements)); } else { passRequirements = {}; }
|
||||
@ -337,8 +337,8 @@
|
||||
QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link.
|
||||
if ((passhint != null) && (passhint.length > 0)) { QV('showPassHintLink', true); }
|
||||
QV('newAccountPass', (newAccountPass == 1));
|
||||
QV('resetAccountDiv', (emailCheck == true));
|
||||
QV('hrAccountDiv', (emailCheck == true) || (newAccountPass == 1));
|
||||
QV('resetAccountDiv', (emailCheck == 'true'));
|
||||
QV('hrAccountDiv', (emailCheck == 'true') || (newAccountPass == 1));
|
||||
|
||||
if (loginMode == '4') {
|
||||
try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
|
||||
|
@ -4250,7 +4250,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
||||
}
|
||||
} else {
|
||||
xargs.title1 = domain.title1 ? domain.title1 : '';
|
||||
xargs.title2 = (args.title1 && domain.title2) ? domain.title2 : '';
|
||||
xargs.title2 = (domain.title1 && domain.title2) ? domain.title2 : '';
|
||||
}
|
||||
xargs.extitle = encodeURIComponent(xargs.title);
|
||||
xargs.domainurl = domain.url;
|
||||
|
Loading…
Reference in New Issue
Block a user