Synced with Agent Repo
1. Capped smbios to 64k 2. Removed commented out code from win-console.js 3. Updated win-terminal to check for null before pushing
Bryan Roe committed
Apr 6, 2020 at 17:21 UTC
b93ba8ccddf8843f451731bb8cd3a6ea9ff4006a
3 files changed
+28
-17
agents/modules_meshcore/smbios.js
+6
@@ -191,6 +191,12 @@ function SMBiosTables()
191
catch(e)
192
{
193
}
194
+ try
195
+ {
196
+ if (JSON.stringify(r).length > 65535) { r = {}; }
197
+ }
198
+ catch(ee)
199
+ {}
200
return r;
201
}
202
this.processorInfo = function processorInfo(data) {
agents/modules_meshcore/win-console.js
-1
@@ -145,7 +145,6 @@ function WindowsConsole()
145
this.TrayIcon.remove();
146
handled = true;
147
}
148
- //if (!handled) { console.log(msg); }
148
}
149
});
150
retVal.remove = function remove()
agents/modules_meshcore/win-terminal.js
+22
-16
@@ -401,7 +401,8 @@ function windows_terminal() {
401
}
402
}
403
}
404
- this._WriteCharacter = function (key, bControlKey) {
404
+ this._WriteCharacter = function (key, bControlKey)
405
+ {
406
var rec = GM.CreateVariable(20);
407
rec.Deref(0, 2).toBuffer().writeUInt16LE(KEY_EVENT); // rec.EventType
408
rec.Deref(4, 4).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.bKeyDown
@@ -410,10 +411,10 @@ function windows_terminal() {
411
rec.Deref(8, 2).toBuffer().writeUInt16LE(1); // rec.Event.KeyEvent.wRepeatCount
412
rec.Deref(10, 2).toBuffer().writeUInt16LE(this._user32.VkKeyScanA(key).Val); // rec.Event.KeyEvent.wVirtualKeyCode
413
rec.Deref(12, 2).toBuffer().writeUInt16LE(this._user32.MapVirtualKeyA(this._user32.VkKeyScanA(key).Val, MAPVK_VK_TO_VSC).Val);
413
-
414
+
415
var dwWritten = GM.CreateVariable(4);
416
if (this._kernel32.WriteConsoleInputA(this._stdinput, rec, 1, dwWritten).Val == 0) { return (false); }
416
-
417
+
418
rec.Deref(4, 4).toBuffer().writeUInt16LE(0); // rec.Event.KeyEvent.bKeyDown
419
return (this._kernel32.WriteConsoleInputA(this._stdinput, rec, 1, dwWritten).Val != 0);
420
}
@@ -478,23 +479,28 @@ function windows_terminal() {
479
return (retVal);
480
}
481
481
- this._SendDataBuffer = function (data) {
482
+ this._SendDataBuffer = function (data)
483
+ {
484
// { data, attributes, width, height, x, y }
483
-
484
- var dy, line, attr;
485
- for (dy = 0; dy < data.height; ++dy) {
486
- line = data.data[dy];
487
- attr = data.attributes[dy];
488
- line.s = line.toString();
489
-
490
- //line = data.data.slice(data.width * dy, (data.width * dy) + data.width);
491
- //attr = data.attributes.slice(data.width * dy, (data.width * dy) + data.width);
492
- this._stream.push(TranslateLine(data.x + 1, data.y + dy + 1, line, attr));
485
+ if (this._stream != null)
486
+ {
487
+ var dy, line, attr;
488
+ for (dy = 0; dy < data.height; ++dy)
489
+ {
490
+ line = data.data[dy];
491
+ attr = data.attributes[dy];
492
+ line.s = line.toString();
493
+
494
+ //line = data.data.slice(data.width * dy, (data.width * dy) + data.width);
495
+ //attr = data.attributes.slice(data.width * dy, (data.width * dy) + data.width);
496
+ this._stream.push(TranslateLine(data.x + 1, data.y + dy + 1, line, attr));
497
+ }
498
}
499
}
500
496
- this._SendScroll = function _SendScroll(dx, dy) {
497
- if (this._scrollTimer) { return; }
501
+ this._SendScroll = function _SendScroll(dx, dy)
502
+ {
503
+ if (this._scrollTimer || this._stream == null) { return; }
504
505
var info = GM.CreateVariable(22);
506
if (this._kernel32.GetConsoleScreenBufferInfo(this._stdoutput, info).Val == 0) { throw ('Error getting screen buffer info'); }