mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-22 11:26:33 -04:00
Merge branch 'master' of https://github.com/Ylianst/MeshCentral
This commit is contained in:
commit
3b691e3d58
@ -17,6 +17,13 @@ limitations under the License.
|
|||||||
process.on('uncaughtException', function (ex) {
|
process.on('uncaughtException', function (ex) {
|
||||||
require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: "uncaughtException1: " + ex });
|
require('MeshAgent').SendCommand({ action: 'msg', type: 'console', value: "uncaughtException1: " + ex });
|
||||||
});
|
});
|
||||||
|
if (process.platform == 'win32' && require('user-sessions').getDomain == null)
|
||||||
|
{
|
||||||
|
require('user-sessions').getDomain = function getDomain(uid)
|
||||||
|
{
|
||||||
|
return (this.getSessionAttribute(uid, this.InfoClass.WTSDomainName));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: This seems to cause big problems, don't enable the debugger in the server's meshcore.
|
// NOTE: This seems to cause big problems, don't enable the debugger in the server's meshcore.
|
||||||
//attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); });
|
//attachDebugger({ webport: 9999, wait: 1 }).then(function (prt) { console.log('Point Browser for Debug to port: ' + prt); });
|
||||||
@ -984,8 +991,11 @@ function handleServerCommand(data) {
|
|||||||
{
|
{
|
||||||
var tmp = "require('clipboard')(\"" + data.data.split('"').join('\\"') + '");process.exit();';
|
var tmp = "require('clipboard')(\"" + data.data.split('"').join('\\"') + '");process.exit();';
|
||||||
tmp = Buffer.from(tmp).toString('base64');
|
tmp = Buffer.from(tmp).toString('base64');
|
||||||
|
var uid = require('user-sessions').consoleUid();
|
||||||
|
var user = require('user-sessions').getUsername(uid);
|
||||||
|
var domain = require('user-sessions').getDomain(uid);
|
||||||
|
|
||||||
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + tmp, _user: require('user-sessions').getUsername(require('user-sessions').consoleUid()) } };
|
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + tmp, _user: user } };
|
||||||
for (var c1e in process.env)
|
for (var c1e in process.env)
|
||||||
{
|
{
|
||||||
taskoptions.env[c1e] = process.env[c1e];
|
taskoptions.env[c1e] = process.env[c1e];
|
||||||
@ -1766,7 +1776,8 @@ function onTunnelData(data) {
|
|||||||
userPromise.then(function (u) {
|
userPromise.then(function (u) {
|
||||||
var that = this.that;
|
var that = this.that;
|
||||||
if (u.Active.length > 0) {
|
if (u.Active.length > 0) {
|
||||||
var username = u.Active[0].Username;
|
var username = '"' + u.Active[0].Domain + '\\' + u.Active[0].Username + '"';
|
||||||
|
sendConsoleText('Terminal: ' + username);
|
||||||
if (require('win-virtual-terminal').supported) {
|
if (require('win-virtual-terminal').supported) {
|
||||||
// ConPTY PseudoTerminal
|
// ConPTY PseudoTerminal
|
||||||
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } });
|
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [cols, rows] } });
|
||||||
@ -2692,8 +2703,10 @@ function openUserDesktopUrl(url) {
|
|||||||
try {
|
try {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
var user = require('user-sessions').getUsername(require('user-sessions').consoleUid());
|
var uid = require('user-sessions').consoleUid();
|
||||||
var taskoptions = { env: { _target: process.env['windir'] + '\\system32\\cmd.exe', _args: '/C START ' + url.split('&').join('^&'), _user: '"' + user + '"' } };
|
var user = require('user-sessions').getUsername(uid);
|
||||||
|
var domain = require('user-sessions').getDomain(uid);
|
||||||
|
var taskoptions = { env: { _target: process.env['windir'] + '\\system32\\cmd.exe', _args: '/C START ' + url.split('&').join('^&'), _user: '"' + domain + '\\' + user + '"' } };
|
||||||
for (var c1e in process.env)
|
for (var c1e in process.env)
|
||||||
{
|
{
|
||||||
taskoptions.env[c1e] = process.env[c1e];
|
taskoptions.env[c1e] = process.env[c1e];
|
||||||
@ -3290,7 +3303,11 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
|
|||||||
var tmp = "require('clipboard')(\"" + (args['_'][0]).split('"').join('\\"') + '");process.exit();';
|
var tmp = "require('clipboard')(\"" + (args['_'][0]).split('"').join('\\"') + '");process.exit();';
|
||||||
tmp = Buffer.from(tmp).toString('base64');
|
tmp = Buffer.from(tmp).toString('base64');
|
||||||
|
|
||||||
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + tmp, _user: require('user-sessions').getUsername(require('user-sessions').consoleUid()) } };
|
var uid = require('user-sessions').consoleUid();
|
||||||
|
var user = require('user-sessions').getUsername(uid);
|
||||||
|
var domain = require('user-sessions').getDomain(uid);
|
||||||
|
|
||||||
|
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + tmp, _user: domain + '\\' + user } };
|
||||||
for (var c1e in process.env)
|
for (var c1e in process.env)
|
||||||
{
|
{
|
||||||
taskoptions.env[c1e] = process.env[c1e];
|
taskoptions.env[c1e] = process.env[c1e];
|
||||||
|
@ -445,11 +445,16 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : '');
|
var npmproxy = ((typeof obj.args.npmproxy == 'string') ? (' --proxy ' + obj.args.npmproxy) : '');
|
||||||
var env = Object.assign({}, process.env); // Shallow clone
|
var env = Object.assign({}, process.env); // Shallow clone
|
||||||
if (typeof obj.args.npmproxy == 'string') { env['HTTP_PROXY'] = env['HTTPS_PROXY'] = env['http_proxy'] = env['https_proxy'] = obj.args.npmproxy; }
|
if (typeof obj.args.npmproxy == 'string') { env['HTTP_PROXY'] = env['HTTPS_PROXY'] = env['http_proxy'] = env['https_proxy'] = obj.args.npmproxy; }
|
||||||
var xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) { });
|
var xxprocess = child_process.exec(npmpath + ' install meshcentral' + version + npmproxy, { maxBuffer: Infinity, cwd: obj.parentpath, env: env }, function (error, stdout, stderr) {
|
||||||
|
if ((error != null) && (error != '')) { console.log('Update failed: ' + error); }
|
||||||
|
});
|
||||||
xxprocess.data = '';
|
xxprocess.data = '';
|
||||||
xxprocess.stdout.on('data', function (data) { xxprocess.data += data; });
|
xxprocess.stdout.on('data', function (data) { xxprocess.data += data; });
|
||||||
xxprocess.stderr.on('data', function (data) { xxprocess.data += data; });
|
xxprocess.stderr.on('data', function (data) { xxprocess.data += data; });
|
||||||
xxprocess.on('close', function (code) { console.log('Update completed...'); setTimeout(function () { obj.launchChildServer(startArgs); }, 1000); });
|
xxprocess.on('close', function (code) {
|
||||||
|
if (code == 0) { console.log('Update completed...'); }
|
||||||
|
setTimeout(function () { obj.launchChildServer(startArgs); }, 1000);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
// This is an un-expected restart
|
// This is an un-expected restart
|
||||||
@ -2839,7 +2844,7 @@ function CreateMeshCentralServer(config, args) {
|
|||||||
const d = new Date();
|
const d = new Date();
|
||||||
if (obj.xxLogFile == null) {
|
if (obj.xxLogFile == null) {
|
||||||
try {
|
try {
|
||||||
obj.xxLogFile = obj.fs.openSync(obj.getConfigFilePath('log.txt'), 'a+', 666);
|
obj.xxLogFile = obj.fs.openSync(obj.getConfigFilePath('log.txt'), 'a+', 0o666);
|
||||||
obj.fs.writeSync(obj.xxLogFile, '---- Log start at ' + new Date().toLocaleString() + ' ----\r\n');
|
obj.fs.writeSync(obj.xxLogFile, '---- Log start at ' + new Date().toLocaleString() + ' ----\r\n');
|
||||||
obj.xxLogDateStr = d.toLocaleDateString();
|
obj.xxLogDateStr = d.toLocaleDateString();
|
||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user