From e4b483354a611a77911c31356de669f87aee2a0a Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 28 Mar 2022 22:15:45 -0700 Subject: [PATCH 1/2] Added logic to remove 'safemode' from console command on Windows 32 bit agents running on 64 bit windows. --- agents/meshcore.js | 66 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/agents/meshcore.js b/agents/meshcore.js index cb9d7ec3..ac43c0e9 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -46,6 +46,18 @@ var MESHRIGHT_CHATNOTIFY = 16384; var MESHRIGHT_UNINSTALL = 32768; var MESHRIGHT_NODESKTOP = 65536; + +function bcdOK() +{ + if (process.platform != 'win32') { return (false); } + if(require('os').arch() == 'x64') + { + return (require('_GenericMarshal').PointerSize == 8); + } + return (true); +} + + try { Object.defineProperty(Array.prototype, 'findIndex', { value: function (func) { @@ -109,6 +121,32 @@ function getCoreTranslation() { } var currentTranslation = getCoreTranslation(); +try +{ + require('kvm-helper'); +} +catch (e) +{ + var j = + { + users: function () + { + var r = {}; + require('user-sessions').Current(function (c) { r = c; }); + if (process.platform != 'win32') + { + for (var i in r) + { + r[i].SessionId = r[i].uid; + } + } + return (r); + } + }; + addModuleObject('kvm-helper', j); +} + + function lockDesktop(uid) { switch (process.platform) { case 'linux': @@ -1294,12 +1332,7 @@ function handleServerCommand(data) { break; } case 'userSessions': { - // Send back current user sessions list, this is Windows only. - //sendConsoleText('userSessions: ' + JSON.stringify(data)); - if (process.platform != 'win32') break; - var p = require('user-sessions').enumerateUsers(); - p.sessionid = data.sessionid; - p.then(function (u) { mesh.SendCommand({ action: 'msg', type: 'userSessions', sessionid: data.sessionid, data: u, tag: data.tag }); }); + mesh.SendCommand({ action: 'msg', type: 'userSessions', sessionid: data.sessionid, data: require('kvm-helper').users(), tag: data.tag }); break; } case 'cpuinfo': @@ -3238,7 +3271,11 @@ function processConsoleCommand(cmd, args, rights, sessionid) { var fin = '', f = '', availcommands = 'translations,agentupdate,errorlog,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg,task'; if (require('os').dns != null) { availcommands += ',dnsinfo'; } try { require('linux-dhcp'); availcommands += ',dhcp'; } catch (ex) { } - if (process.platform == 'win32') { availcommands += ',cs,safemode,wpfhwacceleration,uac,volumes'; } + if (process.platform == 'win32') + { + availcommands += ',cs,wpfhwacceleration,uac,volumes'; + if (bcdOK()) { availcommands += ',safemode'; } + } if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; } if (process.platform != 'freebsd') { availcommands += ',vm'; } if (require('MeshAgent').maxKvmTileSize != null) { availcommands += ',kvmmode'; } @@ -3759,9 +3796,17 @@ function processConsoleCommand(cmd, args, rights, sessionid) { } break; case 'safemode': - if (process.platform != 'win32') { + if (process.platform != 'win32') + { response = 'safemode only supported on Windows Platforms' - } else { + } + else + { + if (!bcdOK()) + { + response = 'safemode not supported on 64 bit Windows from a 32 bit process' + break; + } if (args['_'].length != 1) { response = 'Proper usage: safemode (ON|OFF|STATUS)'; // Display usage } @@ -3883,6 +3928,9 @@ function processConsoleCommand(cmd, args, rights, sessionid) { require('user-sessions').enumerateUsers().then(function (u) { for (var i in u) { sendConsoleText(u[i]); } }); break; } + case 'kvmusers': + response = JSON.stringify(require('kvm-helper').users(), null, 1); + break; case 'toast': { if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else { if (require('MeshAgent')._tsid == null) { From 18dfe3eba2e7a9bb3082fbc317480be88c26aae8 Mon Sep 17 00:00:00 2001 From: Marcin Wilk Date: Tue, 29 Mar 2022 10:47:59 +0200 Subject: [PATCH 2/2] Add miggin Polish translations. --- translate/translate.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/translate/translate.json b/translate/translate.json index fe2b158e..424e5fea 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -2955,6 +2955,7 @@ { "en": "2nd Factor", "nl": "2e factor", + "pl": "dwuetapowe", "xloc": [ "default.handlebars->39->2753" ] @@ -3827,7 +3828,8 @@ { "en": "7 days", "nl": "7 dagen", - "xloc": [ + "pl": "7 dni", + "xloc": [ "default.handlebars->39->1720" ] }, @@ -23343,6 +23345,7 @@ }, { "en": "Email domain \\\"{0}\\\" is not allowed. Only ({1}) are allowed", + "pl": "Domena email \\\"{0}\\\" jest niedozwolona. Tylko ({1}) jest dopuszczona", "xloc": [ "default-mobile.handlebars->11->730", "default.handlebars->39->2836" @@ -25429,6 +25432,7 @@ { "en": "FIDO key", "nl": "FIDO sleutel", + "pl": "Klucz FIDO", "xloc": [ "default.handlebars->39->2778" ] @@ -28789,6 +28793,7 @@ { "en": "Hardware OTP", "nl": "Hardware OTP", + "pl": "Sprzętowe OTP", "xloc": [ "default.handlebars->39->2780" ] @@ -36871,6 +36876,7 @@ { "en": "Login Token", "nl": "Inlogtoken", + "pl": "Token Logowania", "xloc": [ "default.handlebars->39->2784" ] @@ -44171,6 +44177,7 @@ { "en": "One-Time Password", "nl": "Eenmalig wachtwoord", + "pl": "Hasło Jednorazowe", "xloc": [ "default.handlebars->39->2782" ] @@ -48112,6 +48119,7 @@ { "en": "Push Notification", "nl": "Push Notificatie", + "pl": "Powiadomianie Push", "xloc": [ "default.handlebars->39->2781" ] @@ -49271,6 +49279,7 @@ { "en": "Remember Device", "nl": "Onthoud apparaat", + "pl": "Pamiętaj Urządzenie", "xloc": [ "default.handlebars->39->2783" ] @@ -53072,6 +53081,7 @@ { "en": "SMS message", "nl": "SMS bericht", + "pl": "Wiadomość SMS", "xloc": [ "default.handlebars->39->2779" ] @@ -57605,6 +57615,7 @@ }, { "en": "Single Sign-on", + "pl": "Pojedyncze Logowanie", "xloc": [ "default.handlebars->39->2786" ]