Added RDP alternate shell / working dir, #3943
This commit is contained in:
parent
2023a2f929
commit
6797f8199c
|
@ -179,7 +179,11 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) {
|
|||
screen: obj.infos.screen,
|
||||
locale: obj.infos.locale,
|
||||
};
|
||||
if (obj.infos.options && (obj.infos.options.flags != null)) { args.perfFlags = obj.infos.options.flags; delete obj.infos.options.flags; }
|
||||
if (obj.infos.options) {
|
||||
if (obj.infos.options.flags != null) { args.perfFlags = obj.infos.options.flags; delete obj.infos.options.flags; }
|
||||
if ((obj.infos.options.workingDir != null) && (obj.infos.options.workingDir != '')) { args.workingDir = obj.infos.options.workingDir; }
|
||||
if ((obj.infos.options.alternateShell != null) && (obj.infos.options.alternateShell != '')) { args.alternateShell = obj.infos.options.alternateShell; }
|
||||
}
|
||||
rdpClient = require('./rdp').createClient(args).on('connect', function () {
|
||||
send(['rdp-connect']);
|
||||
if ((typeof obj.infos.options == 'object') && (obj.infos.options.savepass == true)) { saveRdpCredentials(); } // Save the credentials if needed
|
||||
|
|
|
@ -27,7 +27,7 @@ var CreateRDPDesktop = function (canvasid) {
|
|||
obj.nodeid = nodeid;
|
||||
obj.port = port;
|
||||
obj.credentials = credentials;
|
||||
var options = { savepass: credentials.savecred, useServerCreds: credentials.servercred, width: credentials.width, height: credentials.height, flags: credentials.flags };
|
||||
var options = { savepass: credentials.savecred, useServerCreds: credentials.servercred, width: credentials.width, height: credentials.height, flags: credentials.flags, workingDir: credentials.workdir, alternateShell: credentials.altshell };
|
||||
if (credentials.width && credentials.height) {
|
||||
options.width = obj.ScreenWidth = obj.width = credentials.width;
|
||||
options.height = obj.ScreenHeight = obj.height = credentials.height;
|
||||
|
|
|
@ -33,7 +33,7 @@ var pdu = require('./pdu');
|
|||
* decompress bitmap from RLE algorithm
|
||||
* @param bitmap {object} bitmap object of bitmap event of node-rdpjs
|
||||
*/
|
||||
function decompress (bitmap) {
|
||||
function decompress(bitmap) {
|
||||
var fName = null;
|
||||
switch (bitmap.bitsPerPixel.value) {
|
||||
case 15:
|
||||
|
@ -102,10 +102,10 @@ function RdpClient(config) {
|
|||
if (config.password) {
|
||||
this.sec.infos.obj.password.value = Buffer.from(config.password + '\x00', 'ucs2');
|
||||
}
|
||||
if(config.workingDir) {
|
||||
if (config.workingDir) {
|
||||
this.sec.infos.obj.workingDir.value = Buffer.from(config.workingDir + '\x00', 'ucs2');
|
||||
}
|
||||
if(config.alternateShell) {
|
||||
if (config.alternateShell) {
|
||||
this.sec.infos.obj.alternateShell.value = Buffer.from(config.alternateShell + '\x00', 'ucs2');
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ function RdpClient(config) {
|
|||
self.connected = false;
|
||||
self.emit('close');
|
||||
}).on('bitmap', function (bitmaps) {
|
||||
for(var bitmap in bitmaps) {
|
||||
for (var bitmap in bitmaps) {
|
||||
var bitmapData = bitmaps[bitmap].obj.bitmapDataStream.value;
|
||||
var isCompress = bitmaps[bitmap].obj.flags.value & pdu.data.BitmapFlag.BITMAP_COMPRESSION;
|
||||
|
||||
|
@ -167,15 +167,15 @@ function RdpClient(config) {
|
|||
}
|
||||
|
||||
self.emit('bitmap', {
|
||||
destTop : bitmaps[bitmap].obj.destTop.value,
|
||||
destLeft : bitmaps[bitmap].obj.destLeft.value,
|
||||
destBottom : bitmaps[bitmap].obj.destBottom.value,
|
||||
destRight : bitmaps[bitmap].obj.destRight.value,
|
||||
width : bitmaps[bitmap].obj.width.value,
|
||||
height : bitmaps[bitmap].obj.height.value,
|
||||
bitsPerPixel : bitmaps[bitmap].obj.bitsPerPixel.value,
|
||||
isCompress : isCompress,
|
||||
data : bitmapData
|
||||
destTop: bitmaps[bitmap].obj.destTop.value,
|
||||
destLeft: bitmaps[bitmap].obj.destLeft.value,
|
||||
destBottom: bitmaps[bitmap].obj.destBottom.value,
|
||||
destRight: bitmaps[bitmap].obj.destRight.value,
|
||||
width: bitmaps[bitmap].obj.width.value,
|
||||
height: bitmaps[bitmap].obj.height.value,
|
||||
bitsPerPixel: bitmaps[bitmap].obj.bitsPerPixel.value,
|
||||
isCompress: isCompress,
|
||||
data: bitmapData
|
||||
});
|
||||
}
|
||||
}).on('error', function (err) {
|
||||
|
@ -210,7 +210,7 @@ RdpClient.prototype.connect = function (host, port) {
|
|||
* Close RDP client
|
||||
*/
|
||||
RdpClient.prototype.close = function () {
|
||||
if(this.connected) {
|
||||
if (this.connected) {
|
||||
this.global.close();
|
||||
}
|
||||
this.connected = false;
|
||||
|
@ -233,7 +233,7 @@ RdpClient.prototype.sendPointerEvent = function (x, y, button, isPressed) {
|
|||
event.obj.pointerFlags.value |= pdu.data.PointerFlag.PTRFLAGS_DOWN;
|
||||
}
|
||||
|
||||
switch(button) {
|
||||
switch (button) {
|
||||
case 1:
|
||||
event.obj.pointerFlags.value |= pdu.data.PointerFlag.PTRFLAGS_BUTTON1;
|
||||
break;
|
||||
|
@ -350,7 +350,7 @@ function RdpServer(config, socket) {
|
|||
|
||||
inherits(RdpServer, events.EventEmitter);
|
||||
|
||||
function createServer (config, next) {
|
||||
function createServer(config, next) {
|
||||
return net.createServer(function (socket) {
|
||||
next(new RdpServer(config, socket));
|
||||
});
|
||||
|
@ -360,6 +360,6 @@ function createServer (config, next) {
|
|||
* Module exports
|
||||
*/
|
||||
module.exports = {
|
||||
createClient : createClient,
|
||||
createServer : createServer
|
||||
createClient: createClient,
|
||||
createServer: createServer
|
||||
};
|
|
@ -1379,6 +1379,10 @@
|
|||
<input id="idx_dlgCancelButton" type="button" value="Cancel" style="" onclick="dialogclose(0)" />
|
||||
<input id="idx_dlgOkButton" type="button" value="OK" style="" onclick="dialogclose(1)" />
|
||||
<div><input id="idx_dlgDeleteButton" type="button" value="Delete" style="display:none" onclick="dialogclose(2)" /></div>
|
||||
<div id="idx_dlgMoreButtons">
|
||||
<a href=# id=morexxx1 style=cursor:pointer;color:gray;text-decoration:none title="Toggle advanced options" onclick=MoreToggle(true)>▼</a>
|
||||
<a href=# id=morexxx2 style=cursor:pointer;color:gray;text-decoration:none title="Toggle advanced options" onclick=MoreToggle(false)>▲</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<iframe name="fileUploadFrame" style="display:none"></iframe>
|
||||
|
@ -8552,7 +8556,11 @@
|
|||
x += addHtmlValue("Username", '<input type=text id=d2user style=width:230px onKeyUp=askRdpCredentialsValidate() maxlength=128 />');
|
||||
x += addHtmlValue("Password", '<input type=password id=d2pass style=width:230px maxlength=128 autocomplete=off />');
|
||||
if ((features2 & 0x00400000) == 0) { x += addHtmlValue("", '<label><input type="checkbox" id=d2savecred>' + "Remember credentials" + '</label>'); }
|
||||
x + '</div></div>';
|
||||
x += '</div>';
|
||||
x += MoreStart();
|
||||
x += addHtmlValue("Alt Shell", '<input type=text id=d2altshell style=width:230px maxlength=2048 />');
|
||||
x += addHtmlValue("Working Dir", '<input type=text id=d2workdir style=width:230px maxlength=2048 />');
|
||||
x += MoreEnd();
|
||||
setDialogMode(2, "RDP Credentials", 3, askRdpCredentialsEx, x);
|
||||
}
|
||||
|
||||
|
@ -8586,11 +8594,11 @@
|
|||
height = Q('DeskParent').offsetHeight;
|
||||
}
|
||||
if ((currentNode.rdp == 1) && (Q('d2mode').value == 1)) {
|
||||
connectDesktop(null, 4, { servercred: true, width: width, height: height, flags: (desktopsettings.rdpflags != null) ? desktopsettings.rdpflags : 0x2F });
|
||||
connectDesktop(null, 4, { servercred: true, width: width, height: height, flags: (desktopsettings.rdpflags != null) ? desktopsettings.rdpflags : 0x2F, altshell: Q('d2altshell').value, workdir: Q('d2workdir').value });
|
||||
} else {
|
||||
var savecred = false;
|
||||
if ((features2 & 0x00400000) == 0) { savecred = Q('d2savecred').checked; }
|
||||
connectDesktop(null, 4, { domain: Q('d2domain').value, username: Q('d2user').value, password: Q('d2pass').value, savecred: savecred, width: width, height: height, flags: (desktopsettings.rdpflags != null) ? desktopsettings.rdpflags : 0x2F });
|
||||
connectDesktop(null, 4, { domain: Q('d2domain').value, username: Q('d2user').value, password: Q('d2pass').value, savecred: savecred, width: width, height: height, flags: (desktopsettings.rdpflags != null) ? desktopsettings.rdpflags : 0x2F, altshell: Q('d2altshell').value, workdir: Q('d2workdir').value });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16857,6 +16865,7 @@
|
|||
|
||||
// Reset dialog size
|
||||
QS('dialog').width = QS('dialog').top = QS('dialog').left = QS('dialog').right = QS('dialog').bottom = null;
|
||||
MoreToggle(false);
|
||||
|
||||
QE('idx_dlgOkButton', true);
|
||||
QV('idx_dlgOkButton', b & 1);
|
||||
|
@ -16869,6 +16878,7 @@
|
|||
for (var i = 1; i < 24; i++) { QV('dialog' + i, i == x); } // Edit this line when more dialogs are added
|
||||
QV('dialog', x);
|
||||
if (c) { if (x == 2) { QH('id_dialogOptions', c); } else { QH('id_dialogMessage', c); } }
|
||||
QV('idx_dlgMoreButtons', (Q('morexxx3') != null));
|
||||
}
|
||||
|
||||
function dialogclose(x) {
|
||||
|
@ -17470,8 +17480,9 @@
|
|||
function AddButton(v, f) { return '<input type=button value="' + v + '" onclick="' + f + '" style=margin:4px>'; }
|
||||
function AddButton2(v, f) { return '<input type=button value="' + v + '" onclick="' + f + '">'; }
|
||||
function AddRefreshButton(f) { return '<input type=button name=refreshbtn value=Refresh onclick="refreshButtons(false);' + f + '" style=margin:4px ' + (refreshButtonsState==false?'disabled':'') + '>'; }
|
||||
function MoreStart() { return '<a href=# style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ ' + "More" + '</a><div id=morexxx2 style=display:none><br><hr>'; };
|
||||
function MoreEnd() { return '<a href=# style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ ' + "Less" + '</a></div>'; };
|
||||
function MoreStart() { return '<div id=morexxx3 style=display:none><hr>'; };
|
||||
function MoreEnd() { return '</div>'; };
|
||||
function MoreToggle(v) { QV("morexxx1",!v); QV("morexxx2",v); QV("morexxx3",v); }
|
||||
function getSelectedOptions(sel) { var opts = [], opt; for (var i = 0, len = sel.options.length; i < len; i++) { opt = sel.options[i]; if (opt.selected) { opts.push(opt.value); } } return opts; }
|
||||
function getInstance(x, y) { for (var i in x) { if (x[i]['InstanceID'] == y) return x[i]; } return null; }
|
||||
function getItem(x, y, z) { for (var i in x) { if (x[i][y] == z) return x[i]; } return null; }
|
||||
|
|
Loading…
Reference in New Issue