mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Updated taskscheduler on windows to use domain
This commit is contained in:
parent
05259eb7c7
commit
4262faf00c
1 changed files with 22 additions and 5 deletions
|
@ -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];
|
||||||
|
|
Loading…
Reference in a new issue