mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-26 21:23:21 +00:00
1. Fixed bug where NetworkTimeout Error, caused duplicate connection
2. Fixed dispatcher on Windows to put username in quotes 3. Added additional logging 4. Added TLS/ALPN support
This commit is contained in:
@@ -28,7 +28,7 @@ function task()
|
||||
{
|
||||
this.getTaskXml = function getTaskXml(name)
|
||||
{
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN ' + name, '/XML']);
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN "' + name+'"', '/XML']);
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
||||
child.waitExit();
|
||||
@@ -39,7 +39,7 @@ function task()
|
||||
{
|
||||
if (!xml)
|
||||
{
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN ' + name, '/XML']);
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN "' + name + '"', '/XML']);
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
||||
child.waitExit();
|
||||
@@ -54,7 +54,7 @@ function task()
|
||||
{
|
||||
if (!xml)
|
||||
{
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN ' + name, '/XML']);
|
||||
var child = require('child_process').execFile(process.env['windir'] + '\\system32\\schtasks.exe', ['schtasks', '/QUERY', '/TN "' + name + '"', '/XML']);
|
||||
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
||||
child.waitExit();
|
||||
|
||||
@@ -112,11 +112,13 @@ function _execv(exePath, argarr)
|
||||
}
|
||||
|
||||
var i;
|
||||
var tmp = [];
|
||||
var path = require('_GenericMarshal').CreateVariable(exePath);
|
||||
var args = require('_GenericMarshal').CreateVariable((1 + argarr.length) * require('_GenericMarshal').PointerSize);
|
||||
for (i = 0; i < argarr.length; ++i)
|
||||
{
|
||||
var arg = require('_GenericMarshal').CreateVariable(argarr[i]);
|
||||
tmp.push(arg);
|
||||
arg.pointerBuffer().copy(args.toBuffer(), i * require('_GenericMarshal').PointerSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,23 +80,7 @@ function dispatch(options)
|
||||
this.parent.emit('connection', s);
|
||||
});
|
||||
|
||||
var parms = '/C SCHTASKS /CREATE /F /TN MeshUserTask /SC ONCE /ST 00:00 ';
|
||||
if (options.user)
|
||||
{
|
||||
// Specified User
|
||||
parms += ('/RU ' + options.user + ' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (require('user-sessions').getProcessOwnerName(process.pid).tsid == 0)
|
||||
{
|
||||
// LocalSystem
|
||||
parms += ('/RU SYSTEM ');
|
||||
}
|
||||
}
|
||||
parms += ('/TR "\\"' + process.execPath + '\\" -b64exec ' + str + '"');
|
||||
|
||||
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + str, _user: options.user } };
|
||||
var taskoptions = { env: { _target: process.execPath, _args: '-b64exec ' + str, _user: '"' + options.user + '"' } };
|
||||
for (var c1e in process.env)
|
||||
{
|
||||
taskoptions.env[c1e] = process.env[c1e];
|
||||
|
||||
Reference in New Issue
Block a user