1
0
mirror of https://github.com/Ylianst/MeshCommander synced 2025-12-10 21:33:31 +00:00

Internalization of MeshCommander.

This commit is contained in:
Ylian Saint-Hilaire
2020-06-14 19:16:57 -07:00
parent b3d8274c18
commit ef327b2bdd
30 changed files with 27178 additions and 1149 deletions

View File

@@ -9,7 +9,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
var obj = {} var obj = {}
obj.CanvasId = canvasid; obj.CanvasId = canvasid;
if (typeof canvasid === 'string') obj.CanvasId = Q(canvasid); if (typeof canvasid === 'string') obj.CanvasId = Q(canvasid);
obj.Canvas = obj.CanvasId.getContext("2d"); obj.Canvas = obj.CanvasId.getContext('2d');
obj.scrolldiv = scrolldiv; obj.scrolldiv = scrolldiv;
obj.State = 0; obj.State = 0;
obj.PendingOperations = []; obj.PendingOperations = [];
@@ -96,19 +96,19 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
obj.send = function (x) { obj.send = function (x) {
if (obj.debugmode > 1) { console.log("KSend(" + x.length + "): " + rstr2hex(x)); } if (obj.debugmode > 1) { console.log('KSend(' + x.length + '): ' + rstr2hex(x)); }
if (obj.parent != null) { obj.parent.send(x); } if (obj.parent != null) { obj.parent.send(x); }
} }
// KVM Control. // KVM Control.
// Routines for processing incoming packets from the AJAX server, and handling individual messages. // Routines for processing incoming packets from the AJAX server, and handling individual messages.
obj.ProcessPictureMsg = function (str, X, Y) { obj.ProcessPictureMsg = function (str, X, Y) {
//if (obj.targetnode != null) obj.Debug("ProcessPictureMsg " + X + "," + Y + " - " + obj.targetnode.substring(0, 8)); //if (obj.targetnode != null) obj.Debug('ProcessPictureMsg ' + X + ',' + Y + ' - ' + obj.targetnode.substring(0, 8));
var tile = new Image(); var tile = new Image();
tile.xcount = obj.tilesReceived++; tile.xcount = obj.tilesReceived++;
//console.log('Tile #' + tile.xcount); //console.log('Tile #' + tile.xcount);
var r = obj.tilesReceived; var r = obj.tilesReceived;
tile.src = "data:image/jpeg;base64," + btoa(str.substring(4, str.length)); tile.src = 'data:image/jpeg;base64,' + btoa(str.substring(4, str.length));
tile.onload = function () { tile.onload = function () {
//console.log('DecodeTile #' + this.xcount); //console.log('DecodeTile #' + this.xcount);
if (obj.Canvas != null && obj.KillDraw < r && obj.State != 0) { if (obj.Canvas != null && obj.KillDraw < r && obj.State != 0) {
@@ -148,13 +148,13 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
obj.SendUnPause = function () { obj.SendUnPause = function () {
//obj.Debug("SendUnPause"); //obj.Debug('SendUnPause');
//obj.xxStateChange(3); //obj.xxStateChange(3);
obj.send(String.fromCharCode(0x00, 0x08, 0x00, 0x05, 0x00)); obj.send(String.fromCharCode(0x00, 0x08, 0x00, 0x05, 0x00));
} }
obj.SendPause = function () { obj.SendPause = function () {
//obj.Debug("SendPause"); //obj.Debug('SendPause');
//obj.xxStateChange(2); //obj.xxStateChange(2);
obj.send(String.fromCharCode(0x00, 0x08, 0x00, 0x05, 0x01)); obj.send(String.fromCharCode(0x00, 0x08, 0x00, 0x05, 0x01));
} }
@@ -171,7 +171,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
obj.ProcessScreenMsg = function (width, height) { obj.ProcessScreenMsg = function (width, height) {
if (obj.debugmode > 0) { console.log("ScreenSize: " + width + " x " + height); } if (obj.debugmode > 0) { console.log('ScreenSize: ' + width + ' x ' + height); }
obj.Canvas.setTransform(1, 0, 0, 1, 0, 0); obj.Canvas.setTransform(1, 0, 0, 1, 0, 0);
obj.rotation = 0; obj.rotation = 0;
obj.FirstDraw = true; obj.FirstDraw = true;
@@ -200,7 +200,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
//console.log('KVM using accumulated data, total size is now ' + str.length + ' bytes.'); //console.log('KVM using accumulated data, total size is now ' + str.length + ' bytes.');
obj.accumulator = null; obj.accumulator = null;
} }
if (obj.debugmode > 1) { console.log("KRecv(" + str.length + "): " + rstr2hex(str.substring(0, Math.min(str.length, 40)))); } if (obj.debugmode > 1) { console.log('KRecv(' + str.length + '): ' + rstr2hex(str.substring(0, Math.min(str.length, 40)))); }
if (str.length < 4) return; if (str.length < 4) return;
var cmdmsg = null, X = 0, Y = 0, command = ReadShort(str, 0), cmdsize = ReadShort(str, 2), jumboAdd = 0; var cmdmsg = null, X = 0, Y = 0, command = ReadShort(str, 0), cmdsize = ReadShort(str, 2), jumboAdd = 0;
if ((command == 27) && (cmdsize == 8)) { if ((command == 27) && (cmdsize == 8)) {
@@ -218,19 +218,19 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
jumboAdd = 8; jumboAdd = 8;
} }
if ((cmdsize != str.length) && (obj.debugmode > 0)) { console.log(cmdsize, str.length, cmdsize == str.length); } if ((cmdsize != str.length) && (obj.debugmode > 0)) { console.log(cmdsize, str.length, cmdsize == str.length); }
if ((command >= 18) && (command != 65) && (command != 88)) { console.error("Invalid KVM command " + command + " of size " + cmdsize); console.log("Invalid KVM data", str.length, rstr2hex(str.substring(0, 40)) + '...'); return; } if ((command >= 18) && (command != 65) && (command != 88)) { console.error('Invalid KVM command ' + command + ' of size ' + cmdsize); console.log('Invalid KVM data', str.length, rstr2hex(str.substring(0, 40)) + '...'); return; }
if (cmdsize > str.length) { if (cmdsize > str.length) {
//console.log('KVM accumulator set to ' + str.length + ' bytes, need ' + cmdsize + ' bytes.'); //console.log('KVM accumulator set to ' + str.length + ' bytes, need ' + cmdsize + ' bytes.');
obj.accumulator = str; obj.accumulator = str;
return; return;
} }
//console.log("KVM Command: " + command + " Len:" + cmdsize); //console.log('KVM Command: ' + command + ' Len:' + cmdsize);
if (command == 3 || command == 4 || command == 7) { if (command == 3 || command == 4 || command == 7) {
cmdmsg = str.substring(4, cmdsize); cmdmsg = str.substring(4, cmdsize);
X = ((cmdmsg.charCodeAt(0) & 0xFF) << 8) + (cmdmsg.charCodeAt(1) & 0xFF); X = ((cmdmsg.charCodeAt(0) & 0xFF) << 8) + (cmdmsg.charCodeAt(1) & 0xFF);
Y = ((cmdmsg.charCodeAt(2) & 0xFF) << 8) + (cmdmsg.charCodeAt(3) & 0xFF); Y = ((cmdmsg.charCodeAt(2) & 0xFF) << 8) + (cmdmsg.charCodeAt(3) & 0xFF);
if (obj.debugmode > 0) { console.log("CMD" + command + " at X=" + X + " Y=" + Y); } if (obj.debugmode > 0) { console.log('CMD' + command + ' at X=' + X + ' Y=' + Y); }
} }
switch (command) { switch (command) {
@@ -282,11 +282,11 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
break; break;
case 16: // MNG_KVM_CONNECTCOUNT case 16: // MNG_KVM_CONNECTCOUNT
obj.connectioncount = ReadInt(str, 4); obj.connectioncount = ReadInt(str, 4);
//obj.Debug("Got KVM Connect Count: " + obj.connectioncount); //obj.Debug('Got KVM Connect Count: ' + obj.connectioncount);
if (obj.onConnectCountChanged != null) obj.onConnectCountChanged(obj.connectioncount, obj); if (obj.onConnectCountChanged != null) obj.onConnectCountChanged(obj.connectioncount, obj);
break; break;
case 17: // MNG_KVM_MESSAGE case 17: // MNG_KVM_MESSAGE
//obj.Debug("Got KVM Message: " + str.substring(4, cmdsize)); //obj.Debug('Got KVM Message: ' + str.substring(4, cmdsize));
if (obj.onMessage != null) obj.onMessage(str.substring(4, cmdsize), obj); if (obj.onMessage != null) obj.onMessage(str.substring(4, cmdsize), obj);
break; break;
case 65: // Alert case 65: // Alert
@@ -313,82 +313,82 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
// Keyboard and Mouse I/O. // Keyboard and Mouse I/O.
obj.MouseButton = { "NONE": 0x00, "LEFT": 0x02, "RIGHT": 0x08, "MIDDLE": 0x20 }; obj.MouseButton = { 'NONE': 0x00, 'LEFT': 0x02, 'RIGHT': 0x08, 'MIDDLE': 0x20 };
obj.KeyAction = { "NONE": 0, "DOWN": 1, "UP": 2, "SCROLL": 3, "EXUP": 4, "EXDOWN": 5, "DBLCLICK": 6 }; obj.KeyAction = { 'NONE': 0, 'DOWN': 1, 'UP': 2, 'SCROLL': 3, 'EXUP': 4, 'EXDOWN': 5, 'DBLCLICK': 6 };
obj.InputType = { "KEY": 1, "MOUSE": 2, "CTRLALTDEL": 10, "TOUCH": 15 }; obj.InputType = { 'KEY': 1, 'MOUSE': 2, 'CTRLALTDEL': 10, 'TOUCH': 15 };
obj.Alternate = 0; obj.Alternate = 0;
var convertKeyCodeTable = { var convertKeyCodeTable = {
"Pause": 19, 'Pause': 19,
"CapsLock": 20, 'CapsLock': 20,
"Space": 32, 'Space': 32,
"Quote": 222, 'Quote': 222,
"Minus": 189, 'Minus': 189,
"NumpadMultiply": 106, 'NumpadMultiply': 106,
"NumpadAdd": 107, 'NumpadAdd': 107,
"PrintScreen": 44, 'PrintScreen': 44,
"Comma": 188, 'Comma': 188,
"NumpadSubtract": 109, 'NumpadSubtract': 109,
"NumpadDecimal": 110, 'NumpadDecimal': 110,
"Period": 190, 'Period': 190,
"Slash": 191, 'Slash': 191,
"NumpadDivide": 111, 'NumpadDivide': 111,
"Semicolon": 186, 'Semicolon': 186,
"Equal": 187, 'Equal': 187,
"OSLeft": 91, 'OSLeft': 91,
"BracketLeft": 219, 'BracketLeft': 219,
"OSRight": 91, 'OSRight': 91,
"Backslash": 220, 'Backslash': 220,
"BracketRight": 221, 'BracketRight': 221,
"ContextMenu": 93, 'ContextMenu': 93,
"Backquote": 192, 'Backquote': 192,
"NumLock": 144, 'NumLock': 144,
"ScrollLock": 145, 'ScrollLock': 145,
"Backspace": 8, 'Backspace': 8,
"Tab": 9, 'Tab': 9,
"Enter": 13, 'Enter': 13,
"NumpadEnter": 13, 'NumpadEnter': 13,
"Escape": 27, 'Escape': 27,
"Delete": 46, 'Delete': 46,
"Home": 36, 'Home': 36,
"PageUp": 33, 'PageUp': 33,
"PageDown": 34, 'PageDown': 34,
"ArrowLeft": 37, 'ArrowLeft': 37,
"ArrowUp": 38, 'ArrowUp': 38,
"ArrowRight": 39, 'ArrowRight': 39,
"ArrowDown": 40, 'ArrowDown': 40,
"End": 35, 'End': 35,
"Insert": 45, 'Insert': 45,
"F1": 112, 'F1': 112,
"F2": 113, 'F2': 113,
"F3": 114, 'F3': 114,
"F4": 115, 'F4': 115,
"F5": 116, 'F5': 116,
"F6": 117, 'F6': 117,
"F7": 118, 'F7': 118,
"F8": 119, 'F8': 119,
"F9": 120, 'F9': 120,
"F10": 121, 'F10': 121,
"F11": 122, 'F11': 122,
"F12": 123, 'F12': 123,
"ShiftLeft": 16, 'ShiftLeft': 16,
"ShiftRight": 16, 'ShiftRight': 16,
"ControlLeft": 17, 'ControlLeft': 17,
"ControlRight": 17, 'ControlRight': 17,
"AltLeft": 18, 'AltLeft': 18,
"AltRight": 18, 'AltRight': 18,
"MetaLeft": 91, 'MetaLeft': 91,
"MetaRight": 92, 'MetaRight': 92,
"VolumeMute": 181 'VolumeMute': 181
//"LaunchMail": //'LaunchMail':
//"LaunchApp1": //'LaunchApp1':
//"LaunchApp2": //'LaunchApp2':
//"BrowserStop": //'BrowserStop':
//"MediaStop": //'MediaStop':
//"MediaTrackPrevious": //'MediaTrackPrevious':
//"MediaTrackNext": //'MediaTrackNext':
//"MediaPlayPause": //'MediaPlayPause':
//"MediaSelect": //'MediaSelect':
} }
function convertKeyCode(e) { function convertKeyCode(e) {
@@ -457,11 +457,11 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.SendTouchMsg2 = function (id, flags) { obj.SendTouchMsg2 = function (id, flags) {
var msg = ''; var msg = '';
var flags2; var flags2;
var str = "TOUCHSEND: "; var str = 'TOUCHSEND: ';
for (var k in obj.TouchArray) { for (var k in obj.TouchArray) {
if (k == id) { flags2 = flags; } else { if (k == id) { flags2 = flags; } else {
if (obj.TouchArray[k].f == 1) { flags2 = 0x00010000 | 0x00000002 | 0x00000004; obj.TouchArray[k].f = 3; str += "START" + k; } // POINTER_FLAG_DOWN if (obj.TouchArray[k].f == 1) { flags2 = 0x00010000 | 0x00000002 | 0x00000004; obj.TouchArray[k].f = 3; str += 'START' + k; } // POINTER_FLAG_DOWN
else if (obj.TouchArray[k].f == 2) { flags2 = 0x00040000; str += "STOP" + k; } // POINTER_FLAG_UP else if (obj.TouchArray[k].f == 2) { flags2 = 0x00040000; str += 'STOP' + k; } // POINTER_FLAG_UP
else flags2 = 0x00000002 | 0x00000004 | 0x00020000; // POINTER_FLAG_UPDATE else flags2 = 0x00000002 | 0x00000004 | 0x00020000; // POINTER_FLAG_UPDATE
} }
msg += String.fromCharCode(k) + obj.intToStr(flags2) + obj.shortToStr(obj.TouchArray[k].x) + obj.shortToStr(obj.TouchArray[k].y); msg += String.fromCharCode(k) + obj.intToStr(flags2) + obj.shortToStr(obj.TouchArray[k].x) + obj.shortToStr(obj.TouchArray[k].y);
@@ -495,7 +495,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
if (event.detail) { Delta = (-1 * (event.detail * 120)); } else if (event.wheelDelta) { Delta = (event.wheelDelta * 3); } if (event.detail) { Delta = (-1 * (event.detail * 120)); } else if (event.wheelDelta) { Delta = (event.wheelDelta * 3); }
} }
var MouseMsg = ""; var MouseMsg = '';
if (Action == obj.KeyAction.DBLCLICK) { if (Action == obj.KeyAction.DBLCLICK) {
MouseMsg = String.fromCharCode(0x00, obj.InputType.MOUSE, 0x00, 0x0A, 0x00, 0x88, ((X / 256) & 0xFF), (X & 0xFF), ((Y / 256) & 0xFF), (Y & 0xFF)); MouseMsg = String.fromCharCode(0x00, obj.InputType.MOUSE, 0x00, 0x0A, 0x00, 0x88, ((X / 256) & 0xFF), (X & 0xFF), ((Y / 256) & 0xFF), (Y & 0xFF));
} else if (Action == obj.KeyAction.SCROLL) { } else if (Action == obj.KeyAction.SCROLL) {
@@ -528,7 +528,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId); if (obj.onScreenSizeChange != null) obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight, obj.CanvasId);
} }
obj.FirstDraw = false; obj.FirstDraw = false;
//obj.Debug("onResize: " + obj.ScreenWidth + " x " + obj.ScreenHeight); //obj.Debug('onResize: ' + obj.ScreenWidth + ' x ' + obj.ScreenHeight);
} }
obj.xxMouseInputGrab = false; obj.xxMouseInputGrab = false;
@@ -786,7 +786,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
// Private method // Private method
obj.MuchTheSame = function (a, b) { return (Math.abs(a - b) < 4); } obj.MuchTheSame = function (a, b) { return (Math.abs(a - b) < 4); }
obj.Debug = function (msg) { console.log(msg); } obj.Debug = function (msg) { console.log(msg); }
obj.getIEVersion = function () { var r = -1; if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) r = parseFloat(RegExp.$1); } return r; } obj.getIEVersion = function () { var r = -1; if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp('MSIE ([0-9]{1,}[\.0-9]{0,})'); if (re.exec(ua) != null) r = parseFloat(RegExp.$1); } return r; }
obj.haltEvent = function (e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; } obj.haltEvent = function (e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
return obj; return obj;

View File

@@ -55,13 +55,13 @@ var CreateKvmDataChannel = function (webchannel, module, keepalive) {
fileReader.readAsArrayBuffer(e.data); fileReader.readAsArrayBuffer(e.data);
} else { } else {
// IE10, readAsBinaryString does not exist, use an alternative. // IE10, readAsBinaryString does not exist, use an alternative.
var binary = "", bytes = new Uint8Array(e.data), length = bytes.byteLength; var binary = '', bytes = new Uint8Array(e.data), length = bytes.byteLength;
for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
obj.xxOnSocketData(binary); obj.xxOnSocketData(binary);
} }
} else { } else {
// If we get a string object, it maybe the WebRTC confirm. Ignore it. // If we get a string object, it maybe the WebRTC confirm. Ignore it.
//obj.debug("Agent Redir Relay - OnData - " + typeof e.data + " - " + e.data.length); //obj.debug('Agent Redir Relay - OnData - ' + typeof e.data + ' - ' + e.data.length);
obj.xxOnSocketData(e.data); obj.xxOnSocketData(e.data);
} }
}; };
@@ -89,7 +89,7 @@ var CreateKvmDataChannel = function (webchannel, module, keepalive) {
} }
} else { } else {
// If we get a string object, it maybe the WebRTC confirm. Ignore it. // If we get a string object, it maybe the WebRTC confirm. Ignore it.
//obj.debug("Agent Redir Relay - OnData - " + typeof e.data + " - " + e.data.length); //obj.debug('Agent Redir Relay - OnData - ' + typeof e.data + ' - ' + e.data.length);
obj.xxOnSocketData(e.data); obj.xxOnSocketData(e.data);
} }
}; };
@@ -98,12 +98,12 @@ var CreateKvmDataChannel = function (webchannel, module, keepalive) {
if (!data) return; if (!data) return;
if (typeof data === 'object') { if (typeof data === 'object') {
// This is an ArrayBuffer, convert it to a string array (used in IE) // This is an ArrayBuffer, convert it to a string array (used in IE)
var binary = "", bytes = new Uint8Array(data), length = bytes.byteLength; var binary = '', bytes = new Uint8Array(data), length = bytes.byteLength;
for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
data = binary; data = binary;
} }
else if (typeof data !== 'string') return; else if (typeof data !== 'string') return;
//console.log("xxOnSocketData", rstr2hex(data)); //console.log('xxOnSocketData', rstr2hex(data));
return obj.m.ProcessData(data); return obj.m.ProcessData(data);
} }

View File

@@ -11,7 +11,7 @@
function AmtStackCreateService(wsmanStack) { function AmtStackCreateService(wsmanStack) {
var obj = new Object(); var obj = new Object();
obj.wsman = wsmanStack; obj.wsman = wsmanStack;
obj.pfx = ["http://intel.com/wbem/wscim/1/amt-schema/1/", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/", "http://intel.com/wbem/wscim/1/ips-schema/1/"]; obj.pfx = ['http://intel.com/wbem/wscim/1/amt-schema/1/', 'http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/', 'http://intel.com/wbem/wscim/1/ips-schema/1/'];
obj.PendingEnums = []; obj.PendingEnums = [];
obj.PendingBatchOperations = 0; obj.PendingBatchOperations = 0;
obj.ActiveEnumsCount = 0; obj.ActiveEnumsCount = 0;
@@ -28,7 +28,7 @@ function AmtStackCreateService(wsmanStack) {
var x = obj.GetPendingActions(); var x = obj.GetPendingActions();
if (_MaxProcess < x) _MaxProcess = x; if (_MaxProcess < x) _MaxProcess = x;
if (obj.onProcessChanged != null && _LastProcess != x) { if (obj.onProcessChanged != null && _LastProcess != x) {
//console.log("Process Old=" + _LastProcess + ", New=" + x + ", PEnums=" + obj.PendingEnums.length + ", AEnums=" + obj.ActiveEnumsCount + ", PAjax=" + obj.wsman.comm.PendingAjax.length + ", AAjax=" + obj.wsman.comm.ActiveAjaxCount + ", PBatch=" + obj.PendingBatchOperations); //console.log('Process Old=' + _LastProcess + ', New=' + x + ', PEnums=' + obj.PendingEnums.length + ', AEnums=' + obj.ActiveEnumsCount + ', PAjax=' + obj.wsman.comm.PendingAjax.length + ', AAjax=' + obj.wsman.comm.ActiveAjaxCount + ', PBatch=' + obj.PendingBatchOperations);
_LastProcess = x; _LastProcess = x;
obj.onProcessChanged(x, _MaxProcess); obj.onProcessChanged(x, _MaxProcess);
} }
@@ -72,24 +72,24 @@ function AmtStackCreateService(wsmanStack) {
// Private method // Private method
function _EnumStartSink(name, response, callback, resuri, status, tag, pri) { function _EnumStartSink(name, response, callback, resuri, status, tag, pri) {
if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; } if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
if (response == null || response.Header["Method"] != "EnumerateResponse" || !response.Body["EnumerationContext"]) { callback(obj, name, null, 603, tag); _EnumDoNext(1); return; } if (response == null || response.Header['Method'] != 'EnumerateResponse' || !response.Body['EnumerationContext']) { callback(obj, name, null, 603, tag); _EnumDoNext(1); return; }
var enumctx = response.Body["EnumerationContext"]; var enumctx = response.Body['EnumerationContext'];
obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, [], xstatus, tag, pri); }); obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, [], xstatus, tag, pri); });
} }
// Private method // Private method
function _EnumContinueSink(name, response, callback, resuri, items, status, tag, pri) { function _EnumContinueSink(name, response, callback, resuri, items, status, tag, pri) {
if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; } if (status != 200) { callback(obj, name, null, status, tag); _EnumDoNext(1); return; }
if (response == null || response.Header["Method"] != "PullResponse") { callback(obj, name, null, 604, tag); _EnumDoNext(1); return; } if (response == null || response.Header['Method'] != 'PullResponse') { callback(obj, name, null, 604, tag); _EnumDoNext(1); return; }
for (var i in response.Body["Items"]) { for (var i in response.Body['Items']) {
if (response.Body["Items"][i] instanceof Array) { if (response.Body['Items'][i] instanceof Array) {
for (var j in response.Body["Items"][i]) { if (typeof response.Body["Items"][i][j] != 'function') { items.push(response.Body["Items"][i][j]); } } for (var j in response.Body['Items'][i]) { if (typeof response.Body['Items'][i][j] != 'function') { items.push(response.Body['Items'][i][j]); } }
} else { } else {
if (typeof response.Body["Items"][i] != 'function') { items.push(response.Body["Items"][i]); } if (typeof response.Body['Items'][i] != 'function') { items.push(response.Body['Items'][i]); }
} }
} }
if (response.Body["EnumerationContext"]) { if (response.Body['EnumerationContext']) {
var enumctx = response.Body["EnumerationContext"]; var enumctx = response.Body['EnumerationContext'];
obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, items, xstatus, tag, 1); }); obj.wsman.ExecPull(resuri, enumctx, function (ws, resuri, response, xstatus) { _EnumContinueSink(name, response, callback, resuri, items, xstatus, tag, 1); });
} else { } else {
_EnumDoNext(1); _EnumDoNext(1);
@@ -149,33 +149,33 @@ function AmtStackCreateService(wsmanStack) {
if (response == null || status != 200) { if (response == null || status != 200) {
batch.callback(obj, batch.name, null, status, batch.tag); batch.callback(obj, batch.name, null, status, batch.tag);
} else { } else {
batch.responses[response.Header["Method"]] = response; batch.responses[response.Header['Method']] = response;
_FetchNext(batch); _FetchNext(batch);
} }
} }
// Private method // Private method
obj.CompleteName = function(name) { obj.CompleteName = function(name) {
if (name.indexOf("AMT_") == 0) return obj.pfx[0] + name; if (name.indexOf('AMT_') == 0) return obj.pfx[0] + name;
if (name.indexOf("CIM_") == 0) return obj.pfx[1] + name; if (name.indexOf('CIM_') == 0) return obj.pfx[1] + name;
if (name.indexOf("IPS_") == 0) return obj.pfx[2] + name; if (name.indexOf('IPS_') == 0) return obj.pfx[2] + name;
} }
obj.CompleteExecResponse = function (resp) { obj.CompleteExecResponse = function (resp) {
if (resp && resp != null && resp.Body && (resp.Body["ReturnValue"] != undefined)) { resp.Body.ReturnValueStr = obj.AmtStatusToStr(resp.Body["ReturnValue"]); } if (resp && resp != null && resp.Body && (resp.Body['ReturnValue'] != undefined)) { resp.Body.ReturnValueStr = obj.AmtStatusToStr(resp.Body['ReturnValue']); }
return resp; return resp;
} }
obj.RequestPowerStateChange = function (PowerState, callback_func) { obj.RequestPowerStateChange = function (PowerState, callback_func) {
obj.CIM_PowerManagementService_RequestPowerStateChange(PowerState, "<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"CreationClassName\">CIM_ComputerSystem</Selector><Selector Name=\"Name\">ManagedSystem</Selector></SelectorSet></ReferenceParameters>", null, null, callback_func); obj.CIM_PowerManagementService_RequestPowerStateChange(PowerState, '<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>', null, null, callback_func);
} }
obj.RequestOSPowerStateChange = function (PowerState, callback_func) { obj.RequestOSPowerStateChange = function (PowerState, callback_func) {
obj.IPS_PowerManagementService_RequestOSPowerSavingStateChange(PowerState, "<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"CreationClassName\">CIM_ComputerSystem</Selector><Selector Name=\"Name\">ManagedSystem</Selector></SelectorSet></ReferenceParameters>", null, null, callback_func); obj.IPS_PowerManagementService_RequestOSPowerSavingStateChange(PowerState, '<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>', null, null, callback_func);
} }
obj.SetBootConfigRole = function (Role, callback_func) { obj.SetBootConfigRole = function (Role, callback_func) {
obj.CIM_BootService_SetBootConfigRole("<Address xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"><ResourceURI xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns=\"http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd\"><Selector Name=\"InstanceID\">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>", Role, callback_func); obj.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>', Role, callback_func);
} }
// Cancel all pending queries with given status // Cancel all pending queries with given status
@@ -184,270 +184,270 @@ function AmtStackCreateService(wsmanStack) {
} }
// Auto generated methods // Auto generated methods
obj.AMT_AgentPresenceWatchdog_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "RegisterAgent", {}, callback_func); } obj.AMT_AgentPresenceWatchdog_RegisterAgent = function (callback_func) { obj.Exec('AMT_AgentPresenceWatchdog', 'RegisterAgent', {}, callback_func); }
obj.AMT_AgentPresenceWatchdog_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); } obj.AMT_AgentPresenceWatchdog_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec('AMT_AgentPresenceWatchdog', 'AssertPresence', { 'SequenceNumber': SequenceNumber }, callback_func); }
obj.AMT_AgentPresenceWatchdog_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdog", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); } obj.AMT_AgentPresenceWatchdog_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec('AMT_AgentPresenceWatchdog', 'AssertShutdown', { 'SequenceNumber': SequenceNumber }, callback_func); }
obj.AMT_AgentPresenceWatchdog_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func, tag, pri, selectors); } obj.AMT_AgentPresenceWatchdog_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func, tag, pri, selectors) { obj.Exec('AMT_AgentPresenceWatchdog', 'AddAction', { 'OldState': OldState, 'NewState': NewState, 'EventOnTransition': EventOnTransition, 'ActionSd': ActionSd, 'ActionEac': ActionEac }, callback_func, tag, pri, selectors); }
obj.AMT_AgentPresenceWatchdog_DeleteAllActions = function (callback_func, tag, pri, selectors) { obj.Exec("AMT_AgentPresenceWatchdog", "DeleteAllActions", {}, callback_func, tag, pri, selectors); } obj.AMT_AgentPresenceWatchdog_DeleteAllActions = function (callback_func, tag, pri, selectors) { obj.Exec('AMT_AgentPresenceWatchdog', 'DeleteAllActions', {}, callback_func, tag, pri, selectors); }
obj.AMT_AgentPresenceWatchdogAction_GetActionEac = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogAction", "GetActionEac", {}, callback_func); } obj.AMT_AgentPresenceWatchdogAction_GetActionEac = function (callback_func) { obj.Exec('AMT_AgentPresenceWatchdogAction', 'GetActionEac', {}, callback_func); }
obj.AMT_AgentPresenceWatchdogVA_RegisterAgent = function (callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "RegisterAgent", {}, callback_func); } obj.AMT_AgentPresenceWatchdogVA_RegisterAgent = function (callback_func) { obj.Exec('AMT_AgentPresenceWatchdogVA', 'RegisterAgent', {}, callback_func); }
obj.AMT_AgentPresenceWatchdogVA_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertPresence", { "SequenceNumber": SequenceNumber }, callback_func); } obj.AMT_AgentPresenceWatchdogVA_AssertPresence = function (SequenceNumber, callback_func) { obj.Exec('AMT_AgentPresenceWatchdogVA', 'AssertPresence', { 'SequenceNumber': SequenceNumber }, callback_func); }
obj.AMT_AgentPresenceWatchdogVA_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AssertShutdown", { "SequenceNumber": SequenceNumber }, callback_func); } obj.AMT_AgentPresenceWatchdogVA_AssertShutdown = function (SequenceNumber, callback_func) { obj.Exec('AMT_AgentPresenceWatchdogVA', 'AssertShutdown', { 'SequenceNumber': SequenceNumber }, callback_func); }
obj.AMT_AgentPresenceWatchdogVA_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "AddAction", { "OldState": OldState, "NewState": NewState, "EventOnTransition": EventOnTransition, "ActionSd": ActionSd, "ActionEac": ActionEac }, callback_func); } obj.AMT_AgentPresenceWatchdogVA_AddAction = function (OldState, NewState, EventOnTransition, ActionSd, ActionEac, callback_func) { obj.Exec('AMT_AgentPresenceWatchdogVA', 'AddAction', { 'OldState': OldState, 'NewState': NewState, 'EventOnTransition': EventOnTransition, 'ActionSd': ActionSd, 'ActionEac': ActionEac }, callback_func); }
obj.AMT_AgentPresenceWatchdogVA_DeleteAllActions = function (_method_dummy, callback_func) { obj.Exec("AMT_AgentPresenceWatchdogVA", "DeleteAllActions", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_AgentPresenceWatchdogVA_DeleteAllActions = function (_method_dummy, callback_func) { obj.Exec('AMT_AgentPresenceWatchdogVA', 'DeleteAllActions', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_AuditLog_ClearLog = function (callback_func) { obj.Exec("AMT_AuditLog", "ClearLog", {}, callback_func); } obj.AMT_AuditLog_ClearLog = function (callback_func) { obj.Exec('AMT_AuditLog', 'ClearLog', {}, callback_func); }
obj.AMT_AuditLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_AuditLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.AMT_AuditLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('AMT_AuditLog', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.AMT_AuditLog_ReadRecords = function (StartIndex, callback_func, tag) { obj.Exec("AMT_AuditLog", "ReadRecords", { "StartIndex": StartIndex }, callback_func, tag); } obj.AMT_AuditLog_ReadRecords = function (StartIndex, callback_func, tag) { obj.Exec('AMT_AuditLog', 'ReadRecords', { 'StartIndex': StartIndex }, callback_func, tag); }
obj.AMT_AuditLog_SetAuditLock = function (LockTimeoutInSeconds, Flag, Handle, callback_func) { obj.Exec("AMT_AuditLog", "SetAuditLock", { "LockTimeoutInSeconds": LockTimeoutInSeconds, "Flag": Flag, "Handle": Handle }, callback_func); } obj.AMT_AuditLog_SetAuditLock = function (LockTimeoutInSeconds, Flag, Handle, callback_func) { obj.Exec('AMT_AuditLog', 'SetAuditLock', { 'LockTimeoutInSeconds': LockTimeoutInSeconds, 'Flag': Flag, 'Handle': Handle }, callback_func); }
obj.AMT_AuditLog_ExportAuditLogSignature = function (SigningMechanism, callback_func) { obj.Exec("AMT_AuditLog", "ExportAuditLogSignature", { "SigningMechanism": SigningMechanism }, callback_func); } obj.AMT_AuditLog_ExportAuditLogSignature = function (SigningMechanism, callback_func) { obj.Exec('AMT_AuditLog', 'ExportAuditLogSignature', { 'SigningMechanism': SigningMechanism }, callback_func); }
obj.AMT_AuditLog_SetSigningKeyMaterial = function (SigningMechanismType, SigningKey, LengthOfCertificates, Certificates, callback_func) { obj.Exec("AMT_AuditLog", "SetSigningKeyMaterial", { "SigningMechanismType": SigningMechanismType, "SigningKey": SigningKey, "LengthOfCertificates": LengthOfCertificates, "Certificates": Certificates }, callback_func); } obj.AMT_AuditLog_SetSigningKeyMaterial = function (SigningMechanismType, SigningKey, LengthOfCertificates, Certificates, callback_func) { obj.Exec('AMT_AuditLog', 'SetSigningKeyMaterial', { 'SigningMechanismType': SigningMechanismType, 'SigningKey': SigningKey, 'LengthOfCertificates': LengthOfCertificates, 'Certificates': Certificates }, callback_func); }
obj.AMT_AuditPolicyRule_SetAuditPolicy = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicy", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); } obj.AMT_AuditPolicyRule_SetAuditPolicy = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec('AMT_AuditPolicyRule', 'SetAuditPolicy', { 'Enable': Enable, 'AuditedAppID': AuditedAppID, 'EventID': EventID, 'PolicyType': PolicyType }, callback_func); }
obj.AMT_AuditPolicyRule_SetAuditPolicyBulk = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec("AMT_AuditPolicyRule", "SetAuditPolicyBulk", { "Enable": Enable, "AuditedAppID": AuditedAppID, "EventID": EventID, "PolicyType": PolicyType }, callback_func); } obj.AMT_AuditPolicyRule_SetAuditPolicyBulk = function (Enable, AuditedAppID, EventID, PolicyType, callback_func) { obj.Exec('AMT_AuditPolicyRule', 'SetAuditPolicyBulk', { 'Enable': Enable, 'AuditedAppID': AuditedAppID, 'EventID': EventID, 'PolicyType': PolicyType }, callback_func); }
obj.AMT_AuthorizationService_AddUserAclEntryEx = function (DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "AddUserAclEntryEx", { "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); } obj.AMT_AuthorizationService_AddUserAclEntryEx = function (DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec('AMT_AuthorizationService', 'AddUserAclEntryEx', { 'DigestUsername': DigestUsername, 'DigestPassword': DigestPassword, 'KerberosUserSid': KerberosUserSid, 'AccessPermission': AccessPermission, 'Realms': Realms }, callback_func); }
obj.AMT_AuthorizationService_EnumerateUserAclEntries = function (StartIndex, callback_func) { obj.Exec("AMT_AuthorizationService", "EnumerateUserAclEntries", { "StartIndex": StartIndex }, callback_func); } obj.AMT_AuthorizationService_EnumerateUserAclEntries = function (StartIndex, callback_func) { obj.Exec('AMT_AuthorizationService', 'EnumerateUserAclEntries', { 'StartIndex': StartIndex }, callback_func); }
obj.AMT_AuthorizationService_GetUserAclEntryEx = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetUserAclEntryEx", { "Handle": Handle }, callback_func, tag); } obj.AMT_AuthorizationService_GetUserAclEntryEx = function (Handle, callback_func, tag) { obj.Exec('AMT_AuthorizationService', 'GetUserAclEntryEx', { 'Handle': Handle }, callback_func, tag); }
obj.AMT_AuthorizationService_UpdateUserAclEntryEx = function (Handle, DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec("AMT_AuthorizationService", "UpdateUserAclEntryEx", { "Handle": Handle, "DigestUsername": DigestUsername, "DigestPassword": DigestPassword, "KerberosUserSid": KerberosUserSid, "AccessPermission": AccessPermission, "Realms": Realms }, callback_func); } obj.AMT_AuthorizationService_UpdateUserAclEntryEx = function (Handle, DigestUsername, DigestPassword, KerberosUserSid, AccessPermission, Realms, callback_func) { obj.Exec('AMT_AuthorizationService', 'UpdateUserAclEntryEx', { 'Handle': Handle, 'DigestUsername': DigestUsername, 'DigestPassword': DigestPassword, 'KerberosUserSid': KerberosUserSid, 'AccessPermission': AccessPermission, 'Realms': Realms }, callback_func); }
obj.AMT_AuthorizationService_RemoveUserAclEntry = function (Handle, callback_func) { obj.Exec("AMT_AuthorizationService", "RemoveUserAclEntry", { "Handle": Handle }, callback_func); } obj.AMT_AuthorizationService_RemoveUserAclEntry = function (Handle, callback_func) { obj.Exec('AMT_AuthorizationService', 'RemoveUserAclEntry', { 'Handle': Handle }, callback_func); }
obj.AMT_AuthorizationService_SetAdminAclEntryEx = function (Username, DigestPassword, callback_func) { obj.Exec("AMT_AuthorizationService", "SetAdminAclEntryEx", { "Username": Username, "DigestPassword": DigestPassword }, callback_func); } obj.AMT_AuthorizationService_SetAdminAclEntryEx = function (Username, DigestPassword, callback_func) { obj.Exec('AMT_AuthorizationService', 'SetAdminAclEntryEx', { 'Username': Username, 'DigestPassword': DigestPassword }, callback_func); }
obj.AMT_AuthorizationService_GetAdminAclEntry = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntry", {}, callback_func); } obj.AMT_AuthorizationService_GetAdminAclEntry = function (callback_func) { obj.Exec('AMT_AuthorizationService', 'GetAdminAclEntry', {}, callback_func); }
obj.AMT_AuthorizationService_GetAdminAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminAclEntryStatus", {}, callback_func); } obj.AMT_AuthorizationService_GetAdminAclEntryStatus = function (callback_func) { obj.Exec('AMT_AuthorizationService', 'GetAdminAclEntryStatus', {}, callback_func); }
obj.AMT_AuthorizationService_GetAdminNetAclEntryStatus = function (callback_func) { obj.Exec("AMT_AuthorizationService", "GetAdminNetAclEntryStatus", {}, callback_func); } obj.AMT_AuthorizationService_GetAdminNetAclEntryStatus = function (callback_func) { obj.Exec('AMT_AuthorizationService', 'GetAdminNetAclEntryStatus', {}, callback_func); }
obj.AMT_AuthorizationService_SetAclEnabledState = function (Handle, Enabled, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "SetAclEnabledState", { "Handle": Handle, "Enabled": Enabled }, callback_func, tag); } obj.AMT_AuthorizationService_SetAclEnabledState = function (Handle, Enabled, callback_func, tag) { obj.Exec('AMT_AuthorizationService', 'SetAclEnabledState', { 'Handle': Handle, 'Enabled': Enabled }, callback_func, tag); }
obj.AMT_AuthorizationService_GetAclEnabledState = function (Handle, callback_func, tag) { obj.Exec("AMT_AuthorizationService", "GetAclEnabledState", { "Handle": Handle }, callback_func, tag); } obj.AMT_AuthorizationService_GetAclEnabledState = function (Handle, callback_func, tag) { obj.Exec('AMT_AuthorizationService', 'GetAclEnabledState', { 'Handle': Handle }, callback_func, tag); }
obj.AMT_EndpointAccessControlService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.AMT_EndpointAccessControlService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.AMT_EndpointAccessControlService_GetPosture = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPosture", { "PostureType": PostureType }, callback_func); } obj.AMT_EndpointAccessControlService_GetPosture = function (PostureType, callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'GetPosture', { 'PostureType': PostureType }, callback_func); }
obj.AMT_EndpointAccessControlService_GetPostureHash = function (PostureType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetPostureHash", { "PostureType": PostureType }, callback_func); } obj.AMT_EndpointAccessControlService_GetPostureHash = function (PostureType, callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'GetPostureHash', { 'PostureType': PostureType }, callback_func); }
obj.AMT_EndpointAccessControlService_UpdatePostureState = function (UpdateType, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "UpdatePostureState", { "UpdateType": UpdateType }, callback_func); } obj.AMT_EndpointAccessControlService_UpdatePostureState = function (UpdateType, callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'UpdatePostureState', { 'UpdateType': UpdateType }, callback_func); }
obj.AMT_EndpointAccessControlService_GetEacOptions = function (callback_func) { obj.Exec("AMT_EndpointAccessControlService", "GetEacOptions", {}, callback_func); } obj.AMT_EndpointAccessControlService_GetEacOptions = function (callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'GetEacOptions', {}, callback_func); }
obj.AMT_EndpointAccessControlService_SetEacOptions = function (EacVendors, PostureHashAlgorithm, callback_func) { obj.Exec("AMT_EndpointAccessControlService", "SetEacOptions", { "EacVendors": EacVendors, "PostureHashAlgorithm": PostureHashAlgorithm }, callback_func); } obj.AMT_EndpointAccessControlService_SetEacOptions = function (EacVendors, PostureHashAlgorithm, callback_func) { obj.Exec('AMT_EndpointAccessControlService', 'SetEacOptions', { 'EacVendors': EacVendors, 'PostureHashAlgorithm': PostureHashAlgorithm }, callback_func); }
obj.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy = function (Policy, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "SetSystemDefensePolicy", { "Policy": Policy }, callback_func); } obj.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy = function (Policy, callback_func) { obj.Exec('AMT_EnvironmentDetectionSettingData', 'SetSystemDefensePolicy', { 'Policy': Policy }, callback_func); }
obj.AMT_EnvironmentDetectionSettingData_EnableVpnRouting = function (Enable, callback_func) { obj.Exec("AMT_EnvironmentDetectionSettingData", "EnableVpnRouting", { "Enable": Enable }, callback_func); } obj.AMT_EnvironmentDetectionSettingData_EnableVpnRouting = function (Enable, callback_func) { obj.Exec('AMT_EnvironmentDetectionSettingData', 'EnableVpnRouting', { 'Enable': Enable }, callback_func); }
obj.AMT_EthernetPortSettings_SetLinkPreference = function (LinkPreference, Timeout, callback_func) { obj.Exec("AMT_EthernetPortSettings", "SetLinkPreference", { "LinkPreference": LinkPreference, "Timeout": Timeout }, callback_func); } obj.AMT_EthernetPortSettings_SetLinkPreference = function (LinkPreference, Timeout, callback_func) { obj.Exec('AMT_EthernetPortSettings', 'SetLinkPreference', { 'LinkPreference': LinkPreference, 'Timeout': Timeout }, callback_func); }
obj.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("AMT_HeuristicPacketFilterStatistics", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); } obj.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec('AMT_HeuristicPacketFilterStatistics', 'ResetSelectedStats', { 'SelectedStatistics': SelectedStatistics }, callback_func); }
obj.AMT_KerberosSettingData_GetCredentialCacheState = function (callback_func) { obj.Exec("AMT_KerberosSettingData", "GetCredentialCacheState", {}, callback_func); } obj.AMT_KerberosSettingData_GetCredentialCacheState = function (callback_func) { obj.Exec('AMT_KerberosSettingData', 'GetCredentialCacheState', {}, callback_func); }
obj.AMT_KerberosSettingData_SetCredentialCacheState = function (Enable, callback_func) { obj.Exec("AMT_KerberosSettingData", "SetCredentialCacheState", { "Enable": Enable }, callback_func); } obj.AMT_KerberosSettingData_SetCredentialCacheState = function (Enable, callback_func) { obj.Exec('AMT_KerberosSettingData', 'SetCredentialCacheState', { 'Enable': Enable }, callback_func); }
obj.AMT_MessageLog_CancelIteration = function (IterationIdentifier, callback_func) { obj.Exec("AMT_MessageLog", "CancelIteration", { "IterationIdentifier": IterationIdentifier }, callback_func); } obj.AMT_MessageLog_CancelIteration = function (IterationIdentifier, callback_func) { obj.Exec('AMT_MessageLog', 'CancelIteration', { 'IterationIdentifier': IterationIdentifier }, callback_func); }
obj.AMT_MessageLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_MessageLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.AMT_MessageLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('AMT_MessageLog', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.AMT_MessageLog_ClearLog = function (callback_func) { obj.Exec("AMT_MessageLog", "ClearLog", { }, callback_func); } obj.AMT_MessageLog_ClearLog = function (callback_func) { obj.Exec('AMT_MessageLog', 'ClearLog', { }, callback_func); }
obj.AMT_MessageLog_GetRecords = function (IterationIdentifier, MaxReadRecords, callback_func, tag) { obj.Exec("AMT_MessageLog", "GetRecords", { "IterationIdentifier": IterationIdentifier, "MaxReadRecords": MaxReadRecords }, callback_func, tag); } obj.AMT_MessageLog_GetRecords = function (IterationIdentifier, MaxReadRecords, callback_func, tag) { obj.Exec('AMT_MessageLog', 'GetRecords', { 'IterationIdentifier': IterationIdentifier, 'MaxReadRecords': MaxReadRecords }, callback_func, tag); }
obj.AMT_MessageLog_GetRecord = function (IterationIdentifier, PositionToNext, callback_func) { obj.Exec("AMT_MessageLog", "GetRecord", { "IterationIdentifier": IterationIdentifier, "PositionToNext": PositionToNext }, callback_func); } obj.AMT_MessageLog_GetRecord = function (IterationIdentifier, PositionToNext, callback_func) { obj.Exec('AMT_MessageLog', 'GetRecord', { 'IterationIdentifier': IterationIdentifier, 'PositionToNext': PositionToNext }, callback_func); }
obj.AMT_MessageLog_PositionAtRecord = function (IterationIdentifier, MoveAbsolute, RecordNumber, callback_func) { obj.Exec("AMT_MessageLog", "PositionAtRecord", { "IterationIdentifier": IterationIdentifier, "MoveAbsolute": MoveAbsolute, "RecordNumber": RecordNumber }, callback_func); } obj.AMT_MessageLog_PositionAtRecord = function (IterationIdentifier, MoveAbsolute, RecordNumber, callback_func) { obj.Exec('AMT_MessageLog', 'PositionAtRecord', { 'IterationIdentifier': IterationIdentifier, 'MoveAbsolute': MoveAbsolute, 'RecordNumber': RecordNumber }, callback_func); }
obj.AMT_MessageLog_PositionToFirstRecord = function (callback_func, tag) { obj.Exec("AMT_MessageLog", "PositionToFirstRecord", {}, callback_func, tag); } obj.AMT_MessageLog_PositionToFirstRecord = function (callback_func, tag) { obj.Exec('AMT_MessageLog', 'PositionToFirstRecord', {}, callback_func, tag); }
obj.AMT_MessageLog_FreezeLog = function (Freeze, callback_func) { obj.Exec("AMT_MessageLog", "FreezeLog", { "Freeze": Freeze }, callback_func); } obj.AMT_MessageLog_FreezeLog = function (Freeze, callback_func) { obj.Exec('AMT_MessageLog', 'FreezeLog', { 'Freeze': Freeze }, callback_func); }
obj.AMT_PublicKeyManagementService_AddCRL = function (Url, SerialNumbers, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCRL", { "Url": Url, "SerialNumbers": SerialNumbers }, callback_func); } obj.AMT_PublicKeyManagementService_AddCRL = function (Url, SerialNumbers, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'AddCRL', { 'Url': Url, 'SerialNumbers': SerialNumbers }, callback_func); }
obj.AMT_PublicKeyManagementService_ResetCRLList = function (_method_dummy, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "ResetCRLList", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_PublicKeyManagementService_ResetCRLList = function (_method_dummy, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'ResetCRLList', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_PublicKeyManagementService_AddCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddCertificate", { "CertificateBlob": CertificateBlob }, callback_func); } obj.AMT_PublicKeyManagementService_AddCertificate = function (CertificateBlob, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'AddCertificate', { 'CertificateBlob': CertificateBlob }, callback_func); }
obj.AMT_PublicKeyManagementService_AddTrustedRootCertificate = function (CertificateBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddTrustedRootCertificate", { "CertificateBlob": CertificateBlob }, callback_func); } obj.AMT_PublicKeyManagementService_AddTrustedRootCertificate = function (CertificateBlob, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'AddTrustedRootCertificate', { 'CertificateBlob': CertificateBlob }, callback_func); }
obj.AMT_PublicKeyManagementService_AddKey = function (KeyBlob, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "AddKey", { "KeyBlob": KeyBlob }, callback_func); } obj.AMT_PublicKeyManagementService_AddKey = function (KeyBlob, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'AddKey', { 'KeyBlob': KeyBlob }, callback_func); }
obj.AMT_PublicKeyManagementService_GeneratePKCS10Request = function (KeyPair, DNName, Usage, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10Request", { "KeyPair": KeyPair, "DNName": DNName, "Usage": Usage }, callback_func); } obj.AMT_PublicKeyManagementService_GeneratePKCS10Request = function (KeyPair, DNName, Usage, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'GeneratePKCS10Request', { 'KeyPair': KeyPair, 'DNName': DNName, 'Usage': Usage }, callback_func); }
obj.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx = function (KeyPair, SigningAlgorithm, NullSignedCertificateRequest, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GeneratePKCS10RequestEx", { "KeyPair": KeyPair, "SigningAlgorithm": SigningAlgorithm, "NullSignedCertificateRequest": NullSignedCertificateRequest }, callback_func); } obj.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx = function (KeyPair, SigningAlgorithm, NullSignedCertificateRequest, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'GeneratePKCS10RequestEx', { 'KeyPair': KeyPair, 'SigningAlgorithm': SigningAlgorithm, 'NullSignedCertificateRequest': NullSignedCertificateRequest }, callback_func); }
obj.AMT_PublicKeyManagementService_GenerateKeyPair = function (KeyAlgorithm, KeyLength, callback_func) { obj.Exec("AMT_PublicKeyManagementService", "GenerateKeyPair", { "KeyAlgorithm": KeyAlgorithm, "KeyLength": KeyLength }, callback_func); } obj.AMT_PublicKeyManagementService_GenerateKeyPair = function (KeyAlgorithm, KeyLength, callback_func) { obj.Exec('AMT_PublicKeyManagementService', 'GenerateKeyPair', { 'KeyAlgorithm': KeyAlgorithm, 'KeyLength': KeyLength }, callback_func); }
obj.AMT_RedirectionService_RequestStateChange = function (RequestedState, callback_func) { obj.Exec("AMT_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState }, callback_func); } obj.AMT_RedirectionService_RequestStateChange = function (RequestedState, callback_func) { obj.Exec('AMT_RedirectionService', 'RequestStateChange', { 'RequestedState': RequestedState }, callback_func); }
obj.AMT_RedirectionService_TerminateSession = function (SessionType, callback_func) { obj.Exec("AMT_RedirectionService", "TerminateSession", { "SessionType": SessionType }, callback_func); } obj.AMT_RedirectionService_TerminateSession = function (SessionType, callback_func) { obj.Exec('AMT_RedirectionService', 'TerminateSession', { 'SessionType': SessionType }, callback_func); }
obj.AMT_RemoteAccessService_AddMpServer = function (AccessInfo, InfoFormat, Port, AuthMethod, Certificate, Username, Password, CN, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddMpServer", { "AccessInfo": AccessInfo, "InfoFormat": InfoFormat, "Port": Port, "AuthMethod": AuthMethod, "Certificate": Certificate, "Username": Username, "Password": Password, "CN": CN }, callback_func); } obj.AMT_RemoteAccessService_AddMpServer = function (AccessInfo, InfoFormat, Port, AuthMethod, Certificate, Username, Password, CN, callback_func) { obj.Exec('AMT_RemoteAccessService', 'AddMpServer', { 'AccessInfo': AccessInfo, 'InfoFormat': InfoFormat, 'Port': Port, 'AuthMethod': AuthMethod, 'Certificate': Certificate, 'Username': Username, 'Password': Password, 'CN': CN }, callback_func); }
obj.AMT_RemoteAccessService_AddRemoteAccessPolicyRule = function (Trigger, TunnelLifeTime, ExtendedData, MpServer, InternalMpServer, callback_func) { obj.Exec("AMT_RemoteAccessService", "AddRemoteAccessPolicyRule", { "Trigger": Trigger, "TunnelLifeTime": TunnelLifeTime, "ExtendedData": ExtendedData, "MpServer": MpServer, "InternalMpServer": InternalMpServer }, callback_func); } obj.AMT_RemoteAccessService_AddRemoteAccessPolicyRule = function (Trigger, TunnelLifeTime, ExtendedData, MpServer, InternalMpServer, callback_func) { obj.Exec('AMT_RemoteAccessService', 'AddRemoteAccessPolicyRule', { 'Trigger': Trigger, 'TunnelLifeTime': TunnelLifeTime, 'ExtendedData': ExtendedData, 'MpServer': MpServer, 'InternalMpServer': InternalMpServer }, callback_func); }
obj.AMT_RemoteAccessService_CloseRemoteAccessConnection = function (_method_dummy, callback_func) { obj.Exec("AMT_RemoteAccessService", "CloseRemoteAccessConnection", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_RemoteAccessService_CloseRemoteAccessConnection = function (_method_dummy, callback_func) { obj.Exec('AMT_RemoteAccessService', 'CloseRemoteAccessConnection', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_SetupAndConfigurationService_CommitChanges = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "CommitChanges", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_SetupAndConfigurationService_CommitChanges = function (_method_dummy, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'CommitChanges', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_SetupAndConfigurationService_Unprovision = function (ProvisioningMode, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "Unprovision", { "ProvisioningMode": ProvisioningMode }, callback_func); } obj.AMT_SetupAndConfigurationService_Unprovision = function (ProvisioningMode, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'Unprovision', { 'ProvisioningMode': ProvisioningMode }, callback_func); }
obj.AMT_SetupAndConfigurationService_PartialUnprovision = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "PartialUnprovision", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_SetupAndConfigurationService_PartialUnprovision = function (_method_dummy, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'PartialUnprovision', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection = function (_method_dummy, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ResetFlashWearOutProtection", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection = function (_method_dummy, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'ResetFlashWearOutProtection', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod = function (Duration, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "ExtendProvisioningPeriod", { "Duration": Duration }, callback_func); } obj.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod = function (Duration, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'ExtendProvisioningPeriod', { 'Duration': Duration }, callback_func); }
obj.AMT_SetupAndConfigurationService_SetMEBxPassword = function (Password, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetMEBxPassword", { "Password": Password }, callback_func); } obj.AMT_SetupAndConfigurationService_SetMEBxPassword = function (Password, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'SetMEBxPassword', { 'Password': Password }, callback_func); }
obj.AMT_SetupAndConfigurationService_SetTLSPSK = function (PID, PPS, callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "SetTLSPSK", { "PID": PID, "PPS": PPS }, callback_func); } obj.AMT_SetupAndConfigurationService_SetTLSPSK = function (PID, PPS, callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'SetTLSPSK', { 'PID': PID, 'PPS': PPS }, callback_func); }
obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecord", {}, callback_func); } obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord = function (callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'GetProvisioningAuditRecord', {}, callback_func); }
obj.AMT_SetupAndConfigurationService_GetUuid = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUuid", {}, callback_func); } obj.AMT_SetupAndConfigurationService_GetUuid = function (callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'GetUuid', {}, callback_func); }
obj.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetUnprovisionBlockingComponents", {}, callback_func); } obj.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents = function (callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'GetUnprovisionBlockingComponents', {}, callback_func); }
obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2 = function (callback_func) { obj.Exec("AMT_SetupAndConfigurationService", "GetProvisioningAuditRecordV2", {}, callback_func); } obj.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2 = function (callback_func) { obj.Exec('AMT_SetupAndConfigurationService', 'GetProvisioningAuditRecordV2', {}, callback_func); }
obj.AMT_SystemDefensePolicy_GetTimeout = function (callback_func) { obj.Exec("AMT_SystemDefensePolicy", "GetTimeout", {}, callback_func); } obj.AMT_SystemDefensePolicy_GetTimeout = function (callback_func) { obj.Exec('AMT_SystemDefensePolicy', 'GetTimeout', {}, callback_func); }
obj.AMT_SystemDefensePolicy_SetTimeout = function (Timeout, callback_func) { obj.Exec("AMT_SystemDefensePolicy", "SetTimeout", { "Timeout": Timeout }, callback_func); } obj.AMT_SystemDefensePolicy_SetTimeout = function (Timeout, callback_func) { obj.Exec('AMT_SystemDefensePolicy', 'SetTimeout', { 'Timeout': Timeout }, callback_func); }
obj.AMT_SystemDefensePolicy_UpdateStatistics = function (NetworkInterface, ResetOnRead, callback_func, tag, pri, selectors) { obj.Exec("AMT_SystemDefensePolicy", "UpdateStatistics", { "NetworkInterface": NetworkInterface, "ResetOnRead": ResetOnRead }, callback_func, tag, pri, selectors); } obj.AMT_SystemDefensePolicy_UpdateStatistics = function (NetworkInterface, ResetOnRead, callback_func, tag, pri, selectors) { obj.Exec('AMT_SystemDefensePolicy', 'UpdateStatistics', { 'NetworkInterface': NetworkInterface, 'ResetOnRead': ResetOnRead }, callback_func, tag, pri, selectors); }
obj.AMT_SystemPowerScheme_SetPowerScheme = function (callback_func, schemeInstanceId, tag) { obj.Exec("AMT_SystemPowerScheme", "SetPowerScheme", {}, callback_func, tag, 0, { "InstanceID": schemeInstanceId }); } obj.AMT_SystemPowerScheme_SetPowerScheme = function (callback_func, schemeInstanceId, tag) { obj.Exec('AMT_SystemPowerScheme', 'SetPowerScheme', {}, callback_func, tag, 0, { 'InstanceID': schemeInstanceId }); }
obj.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch = function (callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "GetLowAccuracyTimeSynch", {}, callback_func, tag); } obj.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch = function (callback_func, tag) { obj.Exec('AMT_TimeSynchronizationService', 'GetLowAccuracyTimeSynch', {}, callback_func, tag); }
obj.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch = function (Ta0, Tm1, Tm2, callback_func, tag) { obj.Exec("AMT_TimeSynchronizationService", "SetHighAccuracyTimeSynch", { "Ta0": Ta0, "Tm1": Tm1, "Tm2": Tm2 }, callback_func, tag); } obj.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch = function (Ta0, Tm1, Tm2, callback_func, tag) { obj.Exec('AMT_TimeSynchronizationService', 'SetHighAccuracyTimeSynch', { 'Ta0': Ta0, 'Tm1': Tm1, 'Tm2': Tm2 }, callback_func, tag); }
obj.AMT_UserInitiatedConnectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_UserInitiatedConnectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.AMT_UserInitiatedConnectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('AMT_UserInitiatedConnectionService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.AMT_WebUIService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("AMT_WebUIService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.AMT_WebUIService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('AMT_WebUIService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.AMT_WiFiPortConfigurationService_AddWiFiSettings = function (WiFiEndpoint, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "AddWiFiSettings", { "WiFiEndpoint": WiFiEndpoint, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); } obj.AMT_WiFiPortConfigurationService_AddWiFiSettings = function (WiFiEndpoint, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml('AMT_WiFiPortConfigurationService', 'AddWiFiSettings', { 'WiFiEndpoint': WiFiEndpoint, 'WiFiEndpointSettingsInput': WiFiEndpointSettingsInput, 'IEEE8021xSettingsInput': IEEE8021xSettingsInput, 'ClientCredential': ClientCredential, 'CACredential': CACredential }, callback_func); }
obj.AMT_WiFiPortConfigurationService_UpdateWiFiSettings = function (WiFiEndpointSettings, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml("AMT_WiFiPortConfigurationService", "UpdateWiFiSettings", { "WiFiEndpointSettings": WiFiEndpointSettings, "WiFiEndpointSettingsInput": WiFiEndpointSettingsInput, "IEEE8021xSettingsInput": IEEE8021xSettingsInput, "ClientCredential": ClientCredential, "CACredential": CACredential }, callback_func); } obj.AMT_WiFiPortConfigurationService_UpdateWiFiSettings = function (WiFiEndpointSettings, WiFiEndpointSettingsInput, IEEE8021xSettingsInput, ClientCredential, CACredential, callback_func) { obj.ExecWithXml('AMT_WiFiPortConfigurationService', 'UpdateWiFiSettings', { 'WiFiEndpointSettings': WiFiEndpointSettings, 'WiFiEndpointSettingsInput': WiFiEndpointSettingsInput, 'IEEE8021xSettingsInput': IEEE8021xSettingsInput, 'ClientCredential': ClientCredential, 'CACredential': CACredential }, callback_func); }
obj.AMT_WiFiPortConfigurationService_DeleteAllITProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllITProfiles", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_WiFiPortConfigurationService_DeleteAllITProfiles = function (_method_dummy, callback_func) { obj.Exec('AMT_WiFiPortConfigurationService', 'DeleteAllITProfiles', { '_method_dummy': _method_dummy }, callback_func); }
obj.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles = function (_method_dummy, callback_func) { obj.Exec("AMT_WiFiPortConfigurationService", "DeleteAllUserProfiles", { "_method_dummy": _method_dummy }, callback_func); } obj.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles = function (_method_dummy, callback_func) { obj.Exec('AMT_WiFiPortConfigurationService', 'DeleteAllUserProfiles', { '_method_dummy': _method_dummy }, callback_func); }
obj.CIM_Account_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Account", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_Account_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_Account', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_AccountManagementService_CreateAccount = function (System, AccountTemplate, callback_func) { obj.Exec("CIM_AccountManagementService", "CreateAccount", { "System": System, "AccountTemplate": AccountTemplate }, callback_func); } obj.CIM_AccountManagementService_CreateAccount = function (System, AccountTemplate, callback_func) { obj.Exec('CIM_AccountManagementService', 'CreateAccount', { 'System': System, 'AccountTemplate': AccountTemplate }, callback_func); }
obj.CIM_BootConfigSetting_ChangeBootOrder = function (Source, callback_func) { obj.Exec("CIM_BootConfigSetting", "ChangeBootOrder", { "Source": Source }, callback_func); } obj.CIM_BootConfigSetting_ChangeBootOrder = function (Source, callback_func) { obj.Exec('CIM_BootConfigSetting', 'ChangeBootOrder', { 'Source': Source }, callback_func); }
obj.CIM_BootService_SetBootConfigRole = function (BootConfigSetting, Role, callback_func) { obj.Exec("CIM_BootService", "SetBootConfigRole", { "BootConfigSetting": BootConfigSetting, "Role": Role }, callback_func, 0, 1); } obj.CIM_BootService_SetBootConfigRole = function (BootConfigSetting, Role, callback_func) { obj.Exec('CIM_BootService', 'SetBootConfigRole', { 'BootConfigSetting': BootConfigSetting, 'Role': Role }, callback_func, 0, 1); }
obj.CIM_Card_ConnectorPower = function (Connector, PoweredOn, callback_func) { obj.Exec("CIM_Card", "ConnectorPower", { "Connector": Connector, "PoweredOn": PoweredOn }, callback_func); } obj.CIM_Card_ConnectorPower = function (Connector, PoweredOn, callback_func) { obj.Exec('CIM_Card', 'ConnectorPower', { 'Connector': Connector, 'PoweredOn': PoweredOn }, callback_func); }
obj.CIM_Card_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Card", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); } obj.CIM_Card_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec('CIM_Card', 'IsCompatible', { 'ElementToCheck': ElementToCheck }, callback_func); }
obj.CIM_Chassis_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_Chassis", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); } obj.CIM_Chassis_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec('CIM_Chassis', 'IsCompatible', { 'ElementToCheck': ElementToCheck }, callback_func); }
obj.CIM_Fan_SetSpeed = function (DesiredSpeed, callback_func) { obj.Exec("CIM_Fan", "SetSpeed", { "DesiredSpeed": DesiredSpeed }, callback_func); } obj.CIM_Fan_SetSpeed = function (DesiredSpeed, callback_func) { obj.Exec('CIM_Fan', 'SetSpeed', { 'DesiredSpeed': DesiredSpeed }, callback_func); }
obj.CIM_KVMRedirectionSAP_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_KVMRedirectionSAP", "RequestStateChange", { "RequestedState": RequestedState/*, "TimeoutPeriod": TimeoutPeriod */}, callback_func); } obj.CIM_KVMRedirectionSAP_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_KVMRedirectionSAP', 'RequestStateChange', { 'RequestedState': RequestedState/*, 'TimeoutPeriod': TimeoutPeriod */}, callback_func); }
obj.CIM_MediaAccessDevice_LockMedia = function (Lock, callback_func) { obj.Exec("CIM_MediaAccessDevice", "LockMedia", { "Lock": Lock }, callback_func); } obj.CIM_MediaAccessDevice_LockMedia = function (Lock, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'LockMedia', { 'Lock': Lock }, callback_func); }
obj.CIM_MediaAccessDevice_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_MediaAccessDevice", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_MediaAccessDevice_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_MediaAccessDevice_Reset = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "Reset", {}, callback_func); } obj.CIM_MediaAccessDevice_Reset = function (callback_func) { obj.Exec('CIM_MediaAccessDevice', 'Reset', {}, callback_func); }
obj.CIM_MediaAccessDevice_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_MediaAccessDevice", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_MediaAccessDevice_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_MediaAccessDevice_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_MediaAccessDevice", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_MediaAccessDevice_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_MediaAccessDevice_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_MediaAccessDevice", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_MediaAccessDevice_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_MediaAccessDevice_SaveProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "SaveProperties", {}, callback_func); } obj.CIM_MediaAccessDevice_SaveProperties = function (callback_func) { obj.Exec('CIM_MediaAccessDevice', 'SaveProperties', {}, callback_func); }
obj.CIM_MediaAccessDevice_RestoreProperties = function (callback_func) { obj.Exec("CIM_MediaAccessDevice", "RestoreProperties", {}, callback_func); } obj.CIM_MediaAccessDevice_RestoreProperties = function (callback_func) { obj.Exec('CIM_MediaAccessDevice', 'RestoreProperties', {}, callback_func); }
obj.CIM_MediaAccessDevice_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_MediaAccessDevice", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_MediaAccessDevice_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_MediaAccessDevice', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_PhysicalFrame_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalFrame", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); } obj.CIM_PhysicalFrame_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec('CIM_PhysicalFrame', 'IsCompatible', { 'ElementToCheck': ElementToCheck }, callback_func); }
obj.CIM_PhysicalPackage_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec("CIM_PhysicalPackage", "IsCompatible", { "ElementToCheck": ElementToCheck }, callback_func); } obj.CIM_PhysicalPackage_IsCompatible = function (ElementToCheck, callback_func) { obj.Exec('CIM_PhysicalPackage', 'IsCompatible', { 'ElementToCheck': ElementToCheck }, callback_func); }
obj.CIM_PowerManagementService_RequestPowerStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerManagementService", "RequestPowerStateChange", { "PowerState": PowerState, "ManagedElement": ManagedElement, "Time": Time, "TimeoutPeriod": TimeoutPeriod }, callback_func, 0, 1); } obj.CIM_PowerManagementService_RequestPowerStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec('CIM_PowerManagementService', 'RequestPowerStateChange', { 'PowerState': PowerState, 'ManagedElement': ManagedElement, 'Time': Time, 'TimeoutPeriod': TimeoutPeriod }, callback_func, 0, 1); }
obj.CIM_PowerSupply_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_PowerSupply", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_PowerSupply_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_PowerSupply', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_PowerSupply_Reset = function (callback_func) { obj.Exec("CIM_PowerSupply", "Reset", {}, callback_func); } obj.CIM_PowerSupply_Reset = function (callback_func) { obj.Exec('CIM_PowerSupply', 'Reset', {}, callback_func); }
obj.CIM_PowerSupply_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_PowerSupply", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_PowerSupply_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_PowerSupply', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_PowerSupply_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_PowerSupply", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_PowerSupply_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_PowerSupply', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_PowerSupply_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_PowerSupply", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_PowerSupply_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_PowerSupply', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_PowerSupply_SaveProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "SaveProperties", {}, callback_func); } obj.CIM_PowerSupply_SaveProperties = function (callback_func) { obj.Exec('CIM_PowerSupply', 'SaveProperties', {}, callback_func); }
obj.CIM_PowerSupply_RestoreProperties = function (callback_func) { obj.Exec("CIM_PowerSupply", "RestoreProperties", {}, callback_func); } obj.CIM_PowerSupply_RestoreProperties = function (callback_func) { obj.Exec('CIM_PowerSupply', 'RestoreProperties', {}, callback_func); }
obj.CIM_PowerSupply_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_PowerSupply", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_PowerSupply_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_PowerSupply', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_Processor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Processor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_Processor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_Processor', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_Processor_Reset = function (callback_func) { obj.Exec("CIM_Processor", "Reset", {}, callback_func); } obj.CIM_Processor_Reset = function (callback_func) { obj.Exec('CIM_Processor', 'Reset', {}, callback_func); }
obj.CIM_Processor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Processor", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_Processor_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_Processor', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_Processor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Processor", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_Processor_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_Processor', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_Processor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Processor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_Processor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_Processor', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_Processor_SaveProperties = function (callback_func) { obj.Exec("CIM_Processor", "SaveProperties", {}, callback_func); } obj.CIM_Processor_SaveProperties = function (callback_func) { obj.Exec('CIM_Processor', 'SaveProperties', {}, callback_func); }
obj.CIM_Processor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Processor", "RestoreProperties", {}, callback_func); } obj.CIM_Processor_RestoreProperties = function (callback_func) { obj.Exec('CIM_Processor', 'RestoreProperties', {}, callback_func); }
obj.CIM_Processor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Processor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_Processor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_Processor', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_RecordLog_ClearLog = function (callback_func) { obj.Exec("CIM_RecordLog", "ClearLog", {}, callback_func); } obj.CIM_RecordLog_ClearLog = function (callback_func) { obj.Exec('CIM_RecordLog', 'ClearLog', {}, callback_func); }
obj.CIM_RecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_RecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_RecordLog', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_RedirectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_RedirectionService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_RedirectionService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_RedirectionService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_Sensor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Sensor", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_Sensor_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_Sensor', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_Sensor_Reset = function (callback_func) { obj.Exec("CIM_Sensor", "Reset", {}, callback_func); } obj.CIM_Sensor_Reset = function (callback_func) { obj.Exec('CIM_Sensor', 'Reset', {}, callback_func); }
obj.CIM_Sensor_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Sensor", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_Sensor_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_Sensor', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_Sensor_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Sensor", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_Sensor_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_Sensor', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_Sensor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Sensor", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_Sensor_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_Sensor', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_Sensor_SaveProperties = function (callback_func) { obj.Exec("CIM_Sensor", "SaveProperties", {}, callback_func); } obj.CIM_Sensor_SaveProperties = function (callback_func) { obj.Exec('CIM_Sensor', 'SaveProperties', {}, callback_func); }
obj.CIM_Sensor_RestoreProperties = function (callback_func) { obj.Exec("CIM_Sensor", "RestoreProperties", {}, callback_func); } obj.CIM_Sensor_RestoreProperties = function (callback_func) { obj.Exec('CIM_Sensor', 'RestoreProperties', {}, callback_func); }
obj.CIM_Sensor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Sensor", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_Sensor_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_Sensor', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_StatisticalData_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec("CIM_StatisticalData", "ResetSelectedStats", { "SelectedStatistics": SelectedStatistics }, callback_func); } obj.CIM_StatisticalData_ResetSelectedStats = function (SelectedStatistics, callback_func) { obj.Exec('CIM_StatisticalData', 'ResetSelectedStats', { 'SelectedStatistics': SelectedStatistics }, callback_func); }
obj.CIM_Watchdog_KeepAlive = function (callback_func) { obj.Exec("CIM_Watchdog", "KeepAlive", {}, callback_func); } obj.CIM_Watchdog_KeepAlive = function (callback_func) { obj.Exec('CIM_Watchdog', 'KeepAlive', {}, callback_func); }
obj.CIM_Watchdog_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_Watchdog", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_Watchdog_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_Watchdog', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_Watchdog_Reset = function (callback_func) { obj.Exec("CIM_Watchdog", "Reset", {}, callback_func); } obj.CIM_Watchdog_Reset = function (callback_func) { obj.Exec('CIM_Watchdog', 'Reset', {}, callback_func); }
obj.CIM_Watchdog_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_Watchdog", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_Watchdog_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_Watchdog', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_Watchdog_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_Watchdog", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_Watchdog_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_Watchdog', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_Watchdog_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_Watchdog", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_Watchdog_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_Watchdog', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_Watchdog_SaveProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "SaveProperties", {}, callback_func); } obj.CIM_Watchdog_SaveProperties = function (callback_func) { obj.Exec('CIM_Watchdog', 'SaveProperties', {}, callback_func); }
obj.CIM_Watchdog_RestoreProperties = function (callback_func) { obj.Exec("CIM_Watchdog", "RestoreProperties", {}, callback_func); } obj.CIM_Watchdog_RestoreProperties = function (callback_func) { obj.Exec('CIM_Watchdog', 'RestoreProperties', {}, callback_func); }
obj.CIM_Watchdog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_Watchdog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_Watchdog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_Watchdog', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.CIM_WiFiPort_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec("CIM_WiFiPort", "SetPowerState", { "PowerState": PowerState, "Time": Time }, callback_func); } obj.CIM_WiFiPort_SetPowerState = function (PowerState, Time, callback_func) { obj.Exec('CIM_WiFiPort', 'SetPowerState', { 'PowerState': PowerState, 'Time': Time }, callback_func); }
obj.CIM_WiFiPort_Reset = function (callback_func) { obj.Exec("CIM_WiFiPort", "Reset", {}, callback_func); } obj.CIM_WiFiPort_Reset = function (callback_func) { obj.Exec('CIM_WiFiPort', 'Reset', {}, callback_func); }
obj.CIM_WiFiPort_EnableDevice = function (Enabled, callback_func) { obj.Exec("CIM_WiFiPort", "EnableDevice", { "Enabled": Enabled }, callback_func); } obj.CIM_WiFiPort_EnableDevice = function (Enabled, callback_func) { obj.Exec('CIM_WiFiPort', 'EnableDevice', { 'Enabled': Enabled }, callback_func); }
obj.CIM_WiFiPort_OnlineDevice = function (Online, callback_func) { obj.Exec("CIM_WiFiPort", "OnlineDevice", { "Online": Online }, callback_func); } obj.CIM_WiFiPort_OnlineDevice = function (Online, callback_func) { obj.Exec('CIM_WiFiPort', 'OnlineDevice', { 'Online': Online }, callback_func); }
obj.CIM_WiFiPort_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec("CIM_WiFiPort", "QuiesceDevice", { "Quiesce": Quiesce }, callback_func); } obj.CIM_WiFiPort_QuiesceDevice = function (Quiesce, callback_func) { obj.Exec('CIM_WiFiPort', 'QuiesceDevice', { 'Quiesce': Quiesce }, callback_func); }
obj.CIM_WiFiPort_SaveProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "SaveProperties", {}, callback_func); } obj.CIM_WiFiPort_SaveProperties = function (callback_func) { obj.Exec('CIM_WiFiPort', 'SaveProperties', {}, callback_func); }
obj.CIM_WiFiPort_RestoreProperties = function (callback_func) { obj.Exec("CIM_WiFiPort", "RestoreProperties", {}, callback_func); } obj.CIM_WiFiPort_RestoreProperties = function (callback_func) { obj.Exec('CIM_WiFiPort', 'RestoreProperties', {}, callback_func); }
obj.CIM_WiFiPort_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("CIM_WiFiPort", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.CIM_WiFiPort_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('CIM_WiFiPort', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.IPS_HostBasedSetupService_Setup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, Certificate, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "Setup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "Certificate": Certificate, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); } obj.IPS_HostBasedSetupService_Setup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, Certificate, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec('IPS_HostBasedSetupService', 'Setup', { 'NetAdminPassEncryptionType': NetAdminPassEncryptionType, 'NetworkAdminPassword': NetworkAdminPassword, 'McNonce': McNonce, 'Certificate': Certificate, 'SigningAlgorithm': SigningAlgorithm, 'DigitalSignature': DigitalSignature }, callback_func); }
obj.IPS_HostBasedSetupService_AddNextCertInChain = function (NextCertificate, IsLeafCertificate, IsRootCertificate, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AddNextCertInChain", { "NextCertificate": NextCertificate, "IsLeafCertificate": IsLeafCertificate, "IsRootCertificate": IsRootCertificate }, callback_func); } obj.IPS_HostBasedSetupService_AddNextCertInChain = function (NextCertificate, IsLeafCertificate, IsRootCertificate, callback_func) { obj.Exec('IPS_HostBasedSetupService', 'AddNextCertInChain', { 'NextCertificate': NextCertificate, 'IsLeafCertificate': IsLeafCertificate, 'IsRootCertificate': IsRootCertificate }, callback_func); }
obj.IPS_HostBasedSetupService_AdminSetup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "AdminSetup", { "NetAdminPassEncryptionType": NetAdminPassEncryptionType, "NetworkAdminPassword": NetworkAdminPassword, "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); } obj.IPS_HostBasedSetupService_AdminSetup = function (NetAdminPassEncryptionType, NetworkAdminPassword, McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec('IPS_HostBasedSetupService', 'AdminSetup', { 'NetAdminPassEncryptionType': NetAdminPassEncryptionType, 'NetworkAdminPassword': NetworkAdminPassword, 'McNonce': McNonce, 'SigningAlgorithm': SigningAlgorithm, 'DigitalSignature': DigitalSignature }, callback_func); }
obj.IPS_HostBasedSetupService_UpgradeClientToAdmin = function (McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec("IPS_HostBasedSetupService", "UpgradeClientToAdmin", { "McNonce": McNonce, "SigningAlgorithm": SigningAlgorithm, "DigitalSignature": DigitalSignature }, callback_func); } obj.IPS_HostBasedSetupService_UpgradeClientToAdmin = function (McNonce, SigningAlgorithm, DigitalSignature, callback_func) { obj.Exec('IPS_HostBasedSetupService', 'UpgradeClientToAdmin', { 'McNonce': McNonce, 'SigningAlgorithm': SigningAlgorithm, 'DigitalSignature': DigitalSignature }, callback_func); }
obj.IPS_HostBasedSetupService_DisableClientControlMode = function (_method_dummy, callback_func) { obj.Exec("IPS_HostBasedSetupService", "DisableClientControlMode", { "_method_dummy": _method_dummy }, callback_func); } obj.IPS_HostBasedSetupService_DisableClientControlMode = function (_method_dummy, callback_func) { obj.Exec('IPS_HostBasedSetupService', 'DisableClientControlMode', { '_method_dummy': _method_dummy }, callback_func); }
obj.IPS_KVMRedirectionSettingData_TerminateSession = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "TerminateSession", {}, callback_func); } obj.IPS_KVMRedirectionSettingData_TerminateSession = function (callback_func) { obj.Exec('IPS_KVMRedirectionSettingData', 'TerminateSession', {}, callback_func); }
obj.IPS_KVMRedirectionSettingData_DataChannelRead = function (callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelRead", {}, callback_func); } obj.IPS_KVMRedirectionSettingData_DataChannelRead = function (callback_func) { obj.Exec('IPS_KVMRedirectionSettingData', 'DataChannelRead', {}, callback_func); }
obj.IPS_KVMRedirectionSettingData_DataChannelWrite = function (Data, callback_func) { obj.Exec("IPS_KVMRedirectionSettingData", "DataChannelWrite", { "DataMessage": Data }, callback_func); } obj.IPS_KVMRedirectionSettingData_DataChannelWrite = function (Data, callback_func) { obj.Exec('IPS_KVMRedirectionSettingData', 'DataChannelWrite', { 'DataMessage': Data }, callback_func); }
obj.IPS_OptInService_StartOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "StartOptIn", {}, callback_func); } obj.IPS_OptInService_StartOptIn = function (callback_func) { obj.Exec('IPS_OptInService', 'StartOptIn', {}, callback_func); }
obj.IPS_OptInService_CancelOptIn = function (callback_func) { obj.Exec("IPS_OptInService", "CancelOptIn", {}, callback_func); } obj.IPS_OptInService_CancelOptIn = function (callback_func) { obj.Exec('IPS_OptInService', 'CancelOptIn', {}, callback_func); }
obj.IPS_OptInService_SendOptInCode = function (OptInCode, callback_func) { obj.Exec("IPS_OptInService", "SendOptInCode", { "OptInCode": OptInCode }, callback_func); } obj.IPS_OptInService_SendOptInCode = function (OptInCode, callback_func) { obj.Exec('IPS_OptInService', 'SendOptInCode', { 'OptInCode': OptInCode }, callback_func); }
obj.IPS_OptInService_StartService = function (callback_func) { obj.Exec("IPS_OptInService", "StartService", {}, callback_func); } obj.IPS_OptInService_StartService = function (callback_func) { obj.Exec('IPS_OptInService', 'StartService', {}, callback_func); }
obj.IPS_OptInService_StopService = function (callback_func) { obj.Exec("IPS_OptInService", "StopService", {}, callback_func); } obj.IPS_OptInService_StopService = function (callback_func) { obj.Exec('IPS_OptInService', 'StopService', {}, callback_func); }
obj.IPS_OptInService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_OptInService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.IPS_OptInService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('IPS_OptInService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.IPS_PowerManagementService_RequestOSPowerSavingStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec("IPS_PowerManagementService", "RequestOSPowerSavingStateChange", { "OSPowerSavingState": PowerState, "ManagedElement": ManagedElement, "Time": Time, "TimeoutPeriod": TimeoutPeriod }, callback_func, 0, 1); } obj.IPS_PowerManagementService_RequestOSPowerSavingStateChange = function (PowerState, ManagedElement, Time, TimeoutPeriod, callback_func) { obj.Exec('IPS_PowerManagementService', 'RequestOSPowerSavingStateChange', { 'OSPowerSavingState': PowerState, 'ManagedElement': ManagedElement, 'Time': Time, 'TimeoutPeriod': TimeoutPeriod }, callback_func, 0, 1); }
obj.IPS_ProvisioningRecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.IPS_ProvisioningRecordLog_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('IPS_ProvisioningRecordLog', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.IPS_ProvisioningRecordLog_ClearLog = function (_method_dummy, callback_func) { obj.Exec("IPS_ProvisioningRecordLog", "ClearLog", { "_method_dummy": _method_dummy }, callback_func); } obj.IPS_ProvisioningRecordLog_ClearLog = function (_method_dummy, callback_func) { obj.Exec('IPS_ProvisioningRecordLog', 'ClearLog', { '_method_dummy': _method_dummy }, callback_func); }
obj.IPS_ScreenConfigurationService_SetSessionState = function (SessionState, ConsecutiveRebootsNum, callback_func) { obj.Exec("IPS_ScreenConfigurationService", "SetSessionState", { "SessionState": SessionState, "ConsecutiveRebootsNum": ConsecutiveRebootsNum }, callback_func); } obj.IPS_ScreenConfigurationService_SetSessionState = function (SessionState, ConsecutiveRebootsNum, callback_func) { obj.Exec('IPS_ScreenConfigurationService', 'SetSessionState', { 'SessionState': SessionState, 'ConsecutiveRebootsNum': ConsecutiveRebootsNum }, callback_func); }
obj.IPS_SecIOService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec("IPS_SecIOService", "RequestStateChange", { "RequestedState": RequestedState, "TimeoutPeriod": TimeoutPeriod }, callback_func); } obj.IPS_SecIOService_RequestStateChange = function (RequestedState, TimeoutPeriod, callback_func) { obj.Exec('IPS_SecIOService', 'RequestStateChange', { 'RequestedState': RequestedState, 'TimeoutPeriod': TimeoutPeriod }, callback_func); }
obj.IPS_HTTPProxyService_AddProxyAccessPoint = function (AccessInfo, InfoFormat, Port, NetworkDnsSuffix, callback_func) { obj.Exec("IPS_HTTPProxyService", "AddProxyAccessPoint", { "AccessInfo": AccessInfo, "InfoFormat": InfoFormat, "Port": Port, "NetworkDnsSuffix": NetworkDnsSuffix }, callback_func); } obj.IPS_HTTPProxyService_AddProxyAccessPoint = function (AccessInfo, InfoFormat, Port, NetworkDnsSuffix, callback_func) { obj.Exec('IPS_HTTPProxyService', 'AddProxyAccessPoint', { 'AccessInfo': AccessInfo, 'InfoFormat': InfoFormat, 'Port': Port, 'NetworkDnsSuffix': NetworkDnsSuffix }, callback_func); }
obj.AmtStatusToStr = function (code) { if (obj.AmtStatusCodes[code]) return obj.AmtStatusCodes[code]; else return "UNKNOWN_ERROR" } obj.AmtStatusToStr = function (code) { if (obj.AmtStatusCodes[code]) return obj.AmtStatusCodes[code]; else return 'UNKNOWN_ERROR' }
obj.AmtStatusCodes = { obj.AmtStatusCodes = {
0x0000: "SUCCESS", 0x0000: 'SUCCESS',
0x0001: "INTERNAL_ERROR", 0x0001: 'INTERNAL_ERROR',
0x0002: "NOT_READY", 0x0002: 'NOT_READY',
0x0003: "INVALID_PT_MODE", 0x0003: 'INVALID_PT_MODE',
0x0004: "INVALID_MESSAGE_LENGTH", 0x0004: 'INVALID_MESSAGE_LENGTH',
0x0005: "TABLE_FINGERPRINT_NOT_AVAILABLE", 0x0005: 'TABLE_FINGERPRINT_NOT_AVAILABLE',
0x0006: "INTEGRITY_CHECK_FAILED", 0x0006: 'INTEGRITY_CHECK_FAILED',
0x0007: "UNSUPPORTED_ISVS_VERSION", 0x0007: 'UNSUPPORTED_ISVS_VERSION',
0x0008: "APPLICATION_NOT_REGISTERED", 0x0008: 'APPLICATION_NOT_REGISTERED',
0x0009: "INVALID_REGISTRATION_DATA", 0x0009: 'INVALID_REGISTRATION_DATA',
0x000A: "APPLICATION_DOES_NOT_EXIST", 0x000A: 'APPLICATION_DOES_NOT_EXIST',
0x000B: "NOT_ENOUGH_STORAGE", 0x000B: 'NOT_ENOUGH_STORAGE',
0x000C: "INVALID_NAME", 0x000C: 'INVALID_NAME',
0x000D: "BLOCK_DOES_NOT_EXIST", 0x000D: 'BLOCK_DOES_NOT_EXIST',
0x000E: "INVALID_BYTE_OFFSET", 0x000E: 'INVALID_BYTE_OFFSET',
0x000F: "INVALID_BYTE_COUNT", 0x000F: 'INVALID_BYTE_COUNT',
0x0010: "NOT_PERMITTED", 0x0010: 'NOT_PERMITTED',
0x0011: "NOT_OWNER", 0x0011: 'NOT_OWNER',
0x0012: "BLOCK_LOCKED_BY_OTHER", 0x0012: 'BLOCK_LOCKED_BY_OTHER',
0x0013: "BLOCK_NOT_LOCKED", 0x0013: 'BLOCK_NOT_LOCKED',
0x0014: "INVALID_GROUP_PERMISSIONS", 0x0014: 'INVALID_GROUP_PERMISSIONS',
0x0015: "GROUP_DOES_NOT_EXIST", 0x0015: 'GROUP_DOES_NOT_EXIST',
0x0016: "INVALID_MEMBER_COUNT", 0x0016: 'INVALID_MEMBER_COUNT',
0x0017: "MAX_LIMIT_REACHED", 0x0017: 'MAX_LIMIT_REACHED',
0x0018: "INVALID_AUTH_TYPE", 0x0018: 'INVALID_AUTH_TYPE',
0x0019: "AUTHENTICATION_FAILED", 0x0019: 'AUTHENTICATION_FAILED',
0x001A: "INVALID_DHCP_MODE", 0x001A: 'INVALID_DHCP_MODE',
0x001B: "INVALID_IP_ADDRESS", 0x001B: 'INVALID_IP_ADDRESS',
0x001C: "INVALID_DOMAIN_NAME", 0x001C: 'INVALID_DOMAIN_NAME',
0x001D: "UNSUPPORTED_VERSION", 0x001D: 'UNSUPPORTED_VERSION',
0x001E: "REQUEST_UNEXPECTED", 0x001E: 'REQUEST_UNEXPECTED',
0x001F: "INVALID_TABLE_TYPE", 0x001F: 'INVALID_TABLE_TYPE',
0x0020: "INVALID_PROVISIONING_STATE", 0x0020: 'INVALID_PROVISIONING_STATE',
0x0021: "UNSUPPORTED_OBJECT", 0x0021: 'UNSUPPORTED_OBJECT',
0x0022: "INVALID_TIME", 0x0022: 'INVALID_TIME',
0x0023: "INVALID_INDEX", 0x0023: 'INVALID_INDEX',
0x0024: "INVALID_PARAMETER", 0x0024: 'INVALID_PARAMETER',
0x0025: "INVALID_NETMASK", 0x0025: 'INVALID_NETMASK',
0x0026: "FLASH_WRITE_LIMIT_EXCEEDED", 0x0026: 'FLASH_WRITE_LIMIT_EXCEEDED',
0x0027: "INVALID_IMAGE_LENGTH", 0x0027: 'INVALID_IMAGE_LENGTH',
0x0028: "INVALID_IMAGE_SIGNATURE", 0x0028: 'INVALID_IMAGE_SIGNATURE',
0x0029: "PROPOSE_ANOTHER_VERSION", 0x0029: 'PROPOSE_ANOTHER_VERSION',
0x002A: "INVALID_PID_FORMAT", 0x002A: 'INVALID_PID_FORMAT',
0x002B: "INVALID_PPS_FORMAT", 0x002B: 'INVALID_PPS_FORMAT',
0x002C: "BIST_COMMAND_BLOCKED", 0x002C: 'BIST_COMMAND_BLOCKED',
0x002D: "CONNECTION_FAILED", 0x002D: 'CONNECTION_FAILED',
0x002E: "CONNECTION_TOO_MANY", 0x002E: 'CONNECTION_TOO_MANY',
0x002F: "RNG_GENERATION_IN_PROGRESS", 0x002F: 'RNG_GENERATION_IN_PROGRESS',
0x0030: "RNG_NOT_READY", 0x0030: 'RNG_NOT_READY',
0x0031: "CERTIFICATE_NOT_READY", 0x0031: 'CERTIFICATE_NOT_READY',
0x0400: "DISABLED_BY_POLICY", 0x0400: 'DISABLED_BY_POLICY',
0x0800: "NETWORK_IF_ERROR_BASE", 0x0800: 'NETWORK_IF_ERROR_BASE',
0x0801: "UNSUPPORTED_OEM_NUMBER", 0x0801: 'UNSUPPORTED_OEM_NUMBER',
0x0802: "UNSUPPORTED_BOOT_OPTION", 0x0802: 'UNSUPPORTED_BOOT_OPTION',
0x0803: "INVALID_COMMAND", 0x0803: 'INVALID_COMMAND',
0x0804: "INVALID_SPECIAL_COMMAND", 0x0804: 'INVALID_SPECIAL_COMMAND',
0x0805: "INVALID_HANDLE", 0x0805: 'INVALID_HANDLE',
0x0806: "INVALID_PASSWORD", 0x0806: 'INVALID_PASSWORD',
0x0807: "INVALID_REALM", 0x0807: 'INVALID_REALM',
0x0808: "STORAGE_ACL_ENTRY_IN_USE", 0x0808: 'STORAGE_ACL_ENTRY_IN_USE',
0x0809: "DATA_MISSING", 0x0809: 'DATA_MISSING',
0x080A: "DUPLICATE", 0x080A: 'DUPLICATE',
0x080B: "EVENTLOG_FROZEN", 0x080B: 'EVENTLOG_FROZEN',
0x080C: "PKI_MISSING_KEYS", 0x080C: 'PKI_MISSING_KEYS',
0x080D: "PKI_GENERATING_KEYS", 0x080D: 'PKI_GENERATING_KEYS',
0x080E: "INVALID_KEY", 0x080E: 'INVALID_KEY',
0x080F: "INVALID_CERT", 0x080F: 'INVALID_CERT',
0x0810: "CERT_KEY_NOT_MATCH", 0x0810: 'CERT_KEY_NOT_MATCH',
0x0811: "MAX_KERB_DOMAIN_REACHED", 0x0811: 'MAX_KERB_DOMAIN_REACHED',
0x0812: "UNSUPPORTED", 0x0812: 'UNSUPPORTED',
0x0813: "INVALID_PRIORITY", 0x0813: 'INVALID_PRIORITY',
0x0814: "NOT_FOUND", 0x0814: 'NOT_FOUND',
0x0815: "INVALID_CREDENTIALS", 0x0815: 'INVALID_CREDENTIALS',
0x0816: "INVALID_PASSPHRASE", 0x0816: 'INVALID_PASSPHRASE',
0x0818: "NO_ASSOCIATION", 0x0818: 'NO_ASSOCIATION',
0x081B: "AUDIT_FAIL", 0x081B: 'AUDIT_FAIL',
0x081C: "BLOCKING_COMPONENT", 0x081C: 'BLOCKING_COMPONENT',
0x0821: "USER_CONSENT_REQUIRED", 0x0821: 'USER_CONSENT_REQUIRED',
0x1000: "APP_INTERNAL_ERROR", 0x1000: 'APP_INTERNAL_ERROR',
0x1001: "NOT_INITIALIZED", 0x1001: 'NOT_INITIALIZED',
0x1002: "LIB_VERSION_UNSUPPORTED", 0x1002: 'LIB_VERSION_UNSUPPORTED',
0x1003: "INVALID_PARAM", 0x1003: 'INVALID_PARAM',
0x1004: "RESOURCES", 0x1004: 'RESOURCES',
0x1005: "HARDWARE_ACCESS_ERROR", 0x1005: 'HARDWARE_ACCESS_ERROR',
0x1006: "REQUESTOR_NOT_REGISTERED", 0x1006: 'REQUESTOR_NOT_REGISTERED',
0x1007: "NETWORK_ERROR", 0x1007: 'NETWORK_ERROR',
0x1008: "PARAM_BUFFER_TOO_SHORT", 0x1008: 'PARAM_BUFFER_TOO_SHORT',
0x1009: "COM_NOT_INITIALIZED_IN_THREAD", 0x1009: 'COM_NOT_INITIALIZED_IN_THREAD',
0x100A: "URL_REQUIRED" 0x100A: 'URL_REQUIRED'
} }
// //
@@ -459,7 +459,7 @@ function AmtStackCreateService(wsmanStack) {
} }
function _GetMessageLog0(stack, name, responses, status, tag) { function _GetMessageLog0(stack, name, responses, status, tag) {
if (status != 200 || responses.Body['ReturnValue'] != '0') { tag[0](obj, null, tag[2]); return; } if (status != 200 || responses.Body['ReturnValue'] != '0') { tag[0](obj, null, tag[2]); return; }
obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, tag); obj.AMT_MessageLog_GetRecords(responses.Body['IterationIdentifier'], 390, _GetMessageLog1, tag);
} }
function _GetMessageLog1(stack, name, responses, status, tag) { function _GetMessageLog1(stack, name, responses, status, tag) {
if (status != 200 || responses.Body['ReturnValue'] != '0') { tag[0](obj, null, tag[2]); return; } if (status != 200 || responses.Body['ReturnValue'] != '0') { tag[0](obj, null, tag[2]); return; }
@@ -485,13 +485,13 @@ function AmtStackCreateService(wsmanStack) {
for (j = 13; j < 21; j++) { x['EventData'].push(e.charCodeAt(j)); } for (j = 13; j < 21; j++) { x['EventData'].push(e.charCodeAt(j)); }
x['EntityStr'] = _SystemEntityTypes[x['Entity']]; x['EntityStr'] = _SystemEntityTypes[x['Entity']];
x['Desc'] = _GetEventDetailStr(x['EventSensorType'], x['EventOffset'], x['EventData'], x['Entity']); x['Desc'] = _GetEventDetailStr(x['EventSensorType'], x['EventOffset'], x['EventData'], x['Entity']);
if (!x['EntityStr']) x['EntityStr'] = "Unknown"; if (!x['EntityStr']) x['EntityStr'] = 'Unknown';
AmtMessages.push(x); AmtMessages.push(x);
} }
} }
} }
if (responses.Body["NoMoreRecords"] != true) { obj.AMT_MessageLog_GetRecords(responses.Body["IterationIdentifier"], 390, _GetMessageLog1, [tag[0], AmtMessages, tag[2]]); } else { tag[0](obj, AmtMessages, tag[2]); } if (responses.Body['NoMoreRecords'] != true) { obj.AMT_MessageLog_GetRecords(responses.Body['IterationIdentifier'], 390, _GetMessageLog1, [tag[0], AmtMessages, tag[2]]); } else { tag[0](obj, AmtMessages, tag[2]); }
} }
var _EventTrapSourceTypes = "Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split('|'); var _EventTrapSourceTypes = "Platform firmware (e.g. BIOS)|SMI handler|ISV system management software|Alert ASIC|IPMI|BIOS vendor|System board set vendor|System integrator|Third party add-in|OSV|NIC|System management card".split('|');
@@ -499,7 +499,7 @@ function AmtStackCreateService(wsmanStack) {
var _SystemFirmwareProgress = "Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split('|'); var _SystemFirmwareProgress = "Unspecified.|Memory initialization.|Starting hard-disk initialization and test|Secondary processor(s) initialization|User authentication|User-initiated system setup|USB resource configuration|PCI resource configuration|Option ROM initialization|Video initialization|Cache initialization|SM Bus initialization|Keyboard controller initialization|Embedded controller/management controller initialization|Docking station attachment|Enabling docking station|Docking station ejection|Disabling docking station|Calling operating system wake-up vector|Starting operating system boot process|Baseboard or motherboard initialization|reserved|Floppy initialization|Keyboard test|Pointing device test|Primary processor initialization".split('|');
var _SystemEntityTypes = "Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split('|'); var _SystemEntityTypes = "Unspecified|Other|Unknown|Processor|Disk|Peripheral|System management module|System board|Memory module|Processor module|Power supply|Add in card|Front panel board|Back panel board|Power system board|Drive backplane|System internal expansion board|Other system board|Processor board|Power unit|Power module|Power management board|Chassis back panel board|System chassis|Sub chassis|Other chassis board|Disk drive bay|Peripheral bay|Device bay|Fan cooling|Cooling unit|Cable interconnect|Memory device|System management software|BIOS|Intel(r) ME|System bus|Group|Intel(r) ME|External environment|Battery|Processing blade|Connectivity switch|Processor/memory module|I/O module|Processor I/O module|Management controller firmware|IPMI channel|PCI bus|PCI express bus|SCSI bus|SATA/SAS bus|Processor front side bus".split('|');
obj.RealmNames = "||Redirection||Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split('|'); obj.RealmNames = "||Redirection||Hardware Asset|Remote Control|Storage|Event Manager|Storage Admin|Agent Presence Local|Agent Presence Remote|Circuit Breaker|Network Time|General Information|Firmware Update|EIT|LocalUN|Endpoint Access Control|Endpoint Access Control Admin|Event Log Reader|Audit Log|ACL Realm|||Local System".split('|');
obj.WatchdogCurrentStates = { 1: 'Not Started', 2: 'Stopped', 4: 'Running', 8: 'Expired', 16: 'Suspended' }; obj.WatchdogCurrentStates = { 1: "Not Started", 2: "Stopped", 4: "Running", 8: "Expired", 16: "Suspended" };
function _GetEventDetailStr(eventSensorType, eventOffset, eventDataField, entity) { function _GetEventDetailStr(eventSensorType, eventOffset, eventDataField, entity) {
@@ -510,7 +510,7 @@ function AmtStackCreateService(wsmanStack) {
} }
if ((eventSensorType == 18) && (eventDataField[0] == 170)) { // System watchdog event if ((eventSensorType == 18) && (eventDataField[0] == 170)) { // System watchdog event
return "Agent watchdog " + char2hex(eventDataField[4]) + char2hex(eventDataField[3]) + char2hex(eventDataField[2]) + char2hex(eventDataField[1]) + "-" + char2hex(eventDataField[6]) + char2hex(eventDataField[5]) + "-... changed to " + obj.WatchdogCurrentStates[eventDataField[7]]; return "Agent watchdog " + char2hex(eventDataField[4]) + char2hex(eventDataField[3]) + char2hex(eventDataField[2]) + char2hex(eventDataField[1]) + '-' + char2hex(eventDataField[6]) + char2hex(eventDataField[5]) + '-...' + " changed to " + obj.WatchdogCurrentStates[eventDataField[7]];
} }
if ((eventSensorType == 5) && (eventOffset == 0)) { // System chassis if ((eventSensorType == 5) && (eventOffset == 0)) { // System chassis
@@ -527,7 +527,7 @@ function AmtStackCreateService(wsmanStack) {
if (eventSensorType == 36) { if (eventSensorType == 36) {
var handle = (eventDataField[1] << 24) + (eventDataField[2] << 16) + (eventDataField[3] << 8) + eventDataField[4]; var handle = (eventDataField[1] << 24) + (eventDataField[2] << 16) + (eventDataField[3] << 8) + eventDataField[4];
var nic = "#" + eventDataField[0]; var nic = '#' + eventDataField[0];
if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless ***** if (eventDataField[0] == 0xAA) nic = "wired"; // TODO: Add wireless *****
//if (eventDataField[0] == 0xAA) nic = "wireless"; //if (eventDataField[0] == 0xAA) nic = "wireless";
@@ -546,7 +546,7 @@ function AmtStackCreateService(wsmanStack) {
if (eventSensorType == 193) { if (eventSensorType == 193) {
if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x30) && (eventDataField[2] == 0x00) && (eventDataField[3] == 0x00)) { return "User request for remote connection."; } if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x30) && (eventDataField[2] == 0x00) && (eventDataField[3] == 0x00)) { return "User request for remote connection."; }
if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x03) && (eventDataField[3] == 0x01)) { return "EAC error: attempt to get posture while NAC in Intel<65> AMT is disabled."; } // eventDataField = 0xAA20030100000000 if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x03) && (eventDataField[3] == 0x01)) { return "EAC error: attempt to get posture while NAC in Intel<65> AMT is disabled."; } // eventDataField = 0xAA20030100000000
if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x04) && (eventDataField[3] == 0x00)) { return "HWA Error: general error"; } // Used to be "Certificate revoked." but don't know the source of this. if ((eventDataField[0] == 0xAA) && (eventDataField[1] == 0x20) && (eventDataField[2] == 0x04) && (eventDataField[3] == 0x00)) { return "HWA Error: general error"; } // Used to be "Certificate revoked." but don"t know the source of this.
} }
if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack."; if (eventSensorType == 6) return "Authentication failed " + (eventDataField[1] + (eventDataField[2] << 8)) + " times. The system may be under attack.";
@@ -563,110 +563,110 @@ function AmtStackCreateService(wsmanStack) {
var _AmtAuditStringTable = var _AmtAuditStringTable =
{ {
16: 'Security Admin', 16: "Security Admin",
17: 'RCO', 17: "RCO",
18: 'Redirection Manager', 18: "Redirection Manager",
19: 'Firmware Update Manager', 19: "Firmware Update Manager",
20: 'Security Audit Log', 20: "Security Audit Log",
21: 'Network Time', 21: "Network Time",
22: 'Network Administration', 22: "Network Administration",
23: 'Storage Administration', 23: "Storage Administration",
24: 'Event Manager', 24: "Event Manager",
25: 'Circuit Breaker Manager', 25: "Circuit Breaker Manager",
26: 'Agent Presence Manager', 26: "Agent Presence Manager",
27: 'Wireless Configuration', 27: "Wireless Configuration",
28: 'EAC', 28: "EAC",
29: 'KVM', 29: "KVM",
30: 'User Opt-In Events', 30: "User Opt-In Events",
32: 'Screen Blanking', 32: "Screen Blanking",
33: 'Watchdog Events', 33: "Watchdog Events",
1600: 'Provisioning Started', 1600: "Provisioning Started",
1601: 'Provisioning Completed', 1601: "Provisioning Completed",
1602: 'ACL Entry Added', 1602: "ACL Entry Added",
1603: 'ACL Entry Modified', 1603: "ACL Entry Modified",
1604: 'ACL Entry Removed', 1604: "ACL Entry Removed",
1605: 'ACL Access with Invalid Credentials', 1605: "ACL Access with Invalid Credentials",
1606: 'ACL Entry State', 1606: "ACL Entry State",
1607: 'TLS State Changed', 1607: "TLS State Changed",
1608: 'TLS Server Certificate Set', 1608: "TLS Server Certificate Set",
1609: 'TLS Server Certificate Remove', 1609: "TLS Server Certificate Remove",
1610: 'TLS Trusted Root Certificate Added', 1610: "TLS Trusted Root Certificate Added",
1611: 'TLS Trusted Root Certificate Removed', 1611: "TLS Trusted Root Certificate Removed",
1612: 'TLS Preshared Key Set', 1612: "TLS Preshared Key Set",
1613: 'Kerberos Settings Modified', 1613: "Kerberos Settings Modified",
1614: 'Kerberos Master Key Modified', 1614: "Kerberos Master Key Modified",
1615: 'Flash Wear out Counters Reset', 1615: "Flash Wear out Counters Reset",
1616: 'Power Package Modified', 1616: "Power Package Modified",
1617: 'Set Realm Authentication Mode', 1617: "Set Realm Authentication Mode",
1618: 'Upgrade Client to Admin Control Mode', 1618: "Upgrade Client to Admin Control Mode",
1619: 'Unprovisioning Started', 1619: "Unprovisioning Started",
1700: 'Performed Power Up', 1700: "Performed Power Up",
1701: 'Performed Power Down', 1701: "Performed Power Down",
1702: 'Performed Power Cycle', 1702: "Performed Power Cycle",
1703: 'Performed Reset', 1703: "Performed Reset",
1704: 'Set Boot Options', 1704: "Set Boot Options",
1800: 'IDER Session Opened', 1800: "IDER Session Opened",
1801: 'IDER Session Closed', 1801: "IDER Session Closed",
1802: 'IDER Enabled', 1802: "IDER Enabled",
1803: 'IDER Disabled', 1803: "IDER Disabled",
1804: 'SoL Session Opened', 1804: "SoL Session Opened",
1805: 'SoL Session Closed', 1805: "SoL Session Closed",
1806: 'SoL Enabled', 1806: "SoL Enabled",
1807: 'SoL Disabled', 1807: "SoL Disabled",
1808: 'KVM Session Started', 1808: "KVM Session Started",
1809: 'KVM Session Ended', 1809: "KVM Session Ended",
1810: 'KVM Enabled', 1810: "KVM Enabled",
1811: 'KVM Disabled', 1811: "KVM Disabled",
1812: 'VNC Password Failed 3 Times', 1812: "VNC Password Failed 3 Times",
1900: 'Firmware Updated', 1900: "Firmware Updated",
1901: 'Firmware Update Failed', 1901: "Firmware Update Failed",
2000: 'Security Audit Log Cleared', 2000: "Security Audit Log Cleared",
2001: 'Security Audit Policy Modified', 2001: "Security Audit Policy Modified",
2002: 'Security Audit Log Disabled', 2002: "Security Audit Log Disabled",
2003: 'Security Audit Log Enabled', 2003: "Security Audit Log Enabled",
2004: 'Security Audit Log Exported', 2004: "Security Audit Log Exported",
2005: 'Security Audit Log Recovered', 2005: "Security Audit Log Recovered",
2100: 'Intel&reg; ME Time Set', 2100: "Intel&reg; ME Time Set",
2200: 'TCPIP Parameters Set', 2200: "TCPIP Parameters Set",
2201: 'Host Name Set', 2201: "Host Name Set",
2202: 'Domain Name Set', 2202: "Domain Name Set",
2203: 'VLAN Parameters Set', 2203: "VLAN Parameters Set",
2204: 'Link Policy Set', 2204: "Link Policy Set",
2205: 'IPv6 Parameters Set', 2205: "IPv6 Parameters Set",
2300: 'Global Storage Attributes Set', 2300: "Global Storage Attributes Set",
2301: 'Storage EACL Modified', 2301: "Storage EACL Modified",
2302: 'Storage FPACL Modified', 2302: "Storage FPACL Modified",
2303: 'Storage Write Operation', 2303: "Storage Write Operation",
2400: 'Alert Subscribed', 2400: "Alert Subscribed",
2401: 'Alert Unsubscribed', 2401: "Alert Unsubscribed",
2402: 'Event Log Cleared', 2402: "Event Log Cleared",
2403: 'Event Log Frozen', 2403: "Event Log Frozen",
2500: 'CB Filter Added', 2500: "CB Filter Added",
2501: 'CB Filter Removed', 2501: "CB Filter Removed",
2502: 'CB Policy Added', 2502: "CB Policy Added",
2503: 'CB Policy Removed', 2503: "CB Policy Removed",
2504: 'CB Default Policy Set', 2504: "CB Default Policy Set",
2505: 'CB Heuristics Option Set', 2505: "CB Heuristics Option Set",
2506: 'CB Heuristics State Cleared', 2506: "CB Heuristics State Cleared",
2600: 'Agent Watchdog Added', 2600: "Agent Watchdog Added",
2601: 'Agent Watchdog Removed', 2601: "Agent Watchdog Removed",
2602: 'Agent Watchdog Action Set', 2602: "Agent Watchdog Action Set",
2700: 'Wireless Profile Added', 2700: "Wireless Profile Added",
2701: 'Wireless Profile Removed', 2701: "Wireless Profile Removed",
2702: 'Wireless Profile Updated', 2702: "Wireless Profile Updated",
2800: 'EAC Posture Signer SET', 2800: "EAC Posture Signer SET",
2801: 'EAC Enabled', 2801: "EAC Enabled",
2802: 'EAC Disabled', 2802: "EAC Disabled",
2803: 'EAC Posture State', 2803: "EAC Posture State",
2804: 'EAC Set Options', 2804: "EAC Set Options",
2900: 'KVM Opt-in Enabled', 2900: "KVM Opt-in Enabled",
2901: 'KVM Opt-in Disabled', 2901: "KVM Opt-in Disabled",
2902: 'KVM Password Changed', 2902: "KVM Password Changed",
2903: 'KVM Consent Succeeded', 2903: "KVM Consent Succeeded",
2904: 'KVM Consent Failed', 2904: "KVM Consent Failed",
3000: 'Opt-In Policy Change', 3000: "Opt-In Policy Change",
3001: 'Send Consent Code Event', 3001: "Send Consent Code Event",
3002: 'Start Opt-In Blocked Event' 3002: "Start Opt-In Blocked Event"
} }
// Return human readable extended audit log data // Return human readable extended audit log data
@@ -680,7 +680,7 @@ function AmtStackCreateService(wsmanStack) {
if (id == 1607) { return "Remote " + ["NoAuth", "ServerAuth", "MutualAuth"][data.charCodeAt(0)] + ", Local " + ["NoAuth", "ServerAuth", "MutualAuth"][data.charCodeAt(1)]; } // TLS State Changed if (id == 1607) { return "Remote " + ["NoAuth", "ServerAuth", "MutualAuth"][data.charCodeAt(0)] + ", Local " + ["NoAuth", "ServerAuth", "MutualAuth"][data.charCodeAt(1)]; } // TLS State Changed
if (id == 1617) { return obj.RealmNames[ReadInt(data, 0)] + ", " + ["NoAuth", "Auth", "Disabled"][data.charCodeAt(4)]; } // Set Realm Authentication Mode if (id == 1617) { return obj.RealmNames[ReadInt(data, 0)] + ", " + ["NoAuth", "Auth", "Disabled"][data.charCodeAt(4)]; } // Set Realm Authentication Mode
if (id == 1619) { return ["BIOS", "MEBx", "Local MEI", "Local WSMAN", "Remote WSAMN"][data.charCodeAt(0)]; } // Intel AMT Unprovisioning Started if (id == 1619) { return ["BIOS", "MEBx", "Local MEI", "Local WSMAN", "Remote WSAMN"][data.charCodeAt(0)]; } // Intel AMT Unprovisioning Started
if (id == 1900) { return "From " + ReadShort(data, 0) + "." + ReadShort(data, 2) + "." + ReadShort(data, 4) + "." + ReadShort(data, 6) + " to " + ReadShort(data, 8) + "." + ReadShort(data, 10) + "." + ReadShort(data, 12) + "." + ReadShort(data, 14); } // Firmware Updated if (id == 1900) { return "From " + ReadShort(data, 0) + '.' + ReadShort(data, 2) + '.' + ReadShort(data, 4) + '.' + ReadShort(data, 6) + " to " + ReadShort(data, 8) + '.' + ReadShort(data, 10) + '.' + ReadShort(data, 12) + '.' + ReadShort(data, 14); } // Firmware Updated
if (id == 2100) { var t4 = new Date(); t4.setTime(ReadInt(data, 0) * 1000 + (new Date().getTimezoneOffset() * 60000)); return t4.toLocaleString(); } // Intel AMT Time Set if (id == 2100) { var t4 = new Date(); t4.setTime(ReadInt(data, 0) * 1000 + (new Date().getTimezoneOffset() * 60000)); return t4.toLocaleString(); } // Intel AMT Time Set
if (id == 3000) { return "From " + ["None", "KVM", "All"][data.charCodeAt(0)] + " to " + ["None", "KVM", "All"][data.charCodeAt(1)]; } // Opt-In Policy Change if (id == 3000) { return "From " + ["None", "KVM", "All"][data.charCodeAt(0)] + " to " + ["None", "KVM", "All"][data.charCodeAt(1)]; } // Opt-In Policy Change
if (id == 3001) { return ["Success", "Failed 3 times"][data.charCodeAt(0)]; } // Send Consent Code Event if (id == 3001) { return ["Success", "Failed 3 times"][data.charCodeAt(0)]; } // Send Consent Code Event
@@ -726,12 +726,12 @@ function AmtStackCreateService(wsmanStack) {
} }
if (x['InitiatorType'] == 2) { if (x['InitiatorType'] == 2) {
// Local // Local
x['Initiator'] = '<i>Local</i>'; x['Initiator'] = '<i>' + "Local" + '</i>';
ptr = 5; ptr = 5;
} }
if (x['InitiatorType'] == 3) { if (x['InitiatorType'] == 3) {
// KVM Default Port // KVM Default Port
x['Initiator'] = '<i>KVM Default Port</i>'; x['Initiator'] = '<i>' + "KVM Default Port" + '</i>';
ptr = 5; ptr = 5;
} }
@@ -962,8 +962,8 @@ function referenceToXml(referenceName, inReference) {
// Convert a byte array of SID into string // Convert a byte array of SID into string
function GetSidString(sid) { function GetSidString(sid) {
var r = "S-" + sid.charCodeAt(0) + "-" + sid.charCodeAt(7); var r = 'S-' + sid.charCodeAt(0) + '-' + sid.charCodeAt(7);
for (var i = 2; i < (sid.length / 4) ; i++) r += "-" + ReadIntX(sid, i * 4); for (var i = 2; i < (sid.length / 4) ; i++) r += '-' + ReadIntX(sid, i * 4);
return r; return r;
} }

View File

@@ -91,16 +91,16 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
if ((obj.state == 0) && (obj.acc.byteLength >= 12)) { if ((obj.state == 0) && (obj.acc.byteLength >= 12)) {
// Getting handshake & version // Getting handshake & version
cmdsize = 12; cmdsize = 12;
//if (obj.acc.substring(0, 4) != "RFB ") { return obj.Stop(); } //if (obj.acc.substring(0, 4) != 'RFB ') { return obj.Stop(); }
//var version = parseFloat(obj.acc.substring(4, 11)); //var version = parseFloat(obj.acc.substring(4, 11));
//console.log("KVersion: " + version); //console.log('KVersion: ' + version);
obj.state = 1; obj.state = 1;
obj.send('RFB 003.008\n'); obj.send('RFB 003.008\n');
} }
else if ((obj.state == 1) && (obj.acc.byteLength >= 1)) { else if ((obj.state == 1) && (obj.acc.byteLength >= 1)) {
// Getting security options // Getting security options
cmdsize = obj.acc[0] + 1; cmdsize = obj.acc[0] + 1;
obj.send(String.fromCharCode(1)); // Send the "None" security type. Since we already authenticated using redirection digest auth, we don't need to do this again. obj.send(String.fromCharCode(1)); // Send the 'None' security type. Since we already authenticated using redirection digest auth, we don't need to do this again.
obj.state = 2; obj.state = 2;
} }
else if ((obj.state == 2) && (obj.acc.byteLength >= 4)) { else if ((obj.state == 2) && (obj.acc.byteLength >= 4)) {
@@ -135,14 +135,14 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.gsh = obj.acc[15]; obj.gsh = obj.acc[15];
obj.bsh = obj.acc[16]; obj.bsh = obj.acc[16];
var name = obj.acc.substring(24, 24 + namelen); var name = obj.acc.substring(24, 24 + namelen);
console.log("name: " + name); console.log('name: ' + name);
console.log("width: " + obj.width + ", height: " + obj.height); console.log('width: ' + obj.width + ', height: ' + obj.height);
console.log("bits-per-pixel: " + obj.xbpp); console.log('bits-per-pixel: ' + obj.xbpp);
console.log("depth: " + obj.depth); console.log('depth: ' + obj.depth);
console.log("big-endian-flag: " + obj.bigend); console.log('big-endian-flag: ' + obj.bigend);
console.log("true-colour-flag: " + obj.truecolor); console.log('true-colour-flag: ' + obj.truecolor);
console.log("rgb max: " + obj.rmax + "," + obj.gmax + "," + obj.bmax); console.log('rgb max: ' + obj.rmax + ',' + obj.gmax + ',' + obj.bmax);
console.log("rgb shift: " + obj.rsh + "," + obj.gsh + "," + obj.bsh); console.log('rgb shift: ' + obj.rsh + ',' + obj.gsh + ',' + obj.bsh);
*/ */
// SetEncodings, with AMT we can't omit RAW, must be specified. // SetEncodings, with AMT we can't omit RAW, must be specified.
@@ -199,7 +199,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
encoding = accview.getUint32(8); encoding = accview.getUint32(8);
if (encoding < 17) { if (encoding < 17) {
if ((width < 1) || (width > 64) || (height < 1) || (height > 64)) { console.log("Invalid tile size (" + width + "," + height + "), disconnecting."); return obj.Stop(); } if ((width < 1) || (width > 64) || (height < 1) || (height > 64)) { console.log('Invalid tile size (' + width + ',' + height + '), disconnecting.'); return obj.Stop(); }
// Set the spare bitmap to the right size if it's not already. This allows us to recycle the spare most if not all the time. // Set the spare bitmap to the right size if it's not already. This allows us to recycle the spare most if not all the time.
if ((obj.sparew != width) || (obj.spareh != height)) { if ((obj.sparew != width) || (obj.spareh != height)) {
@@ -225,7 +225,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest obj.send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest
cmdsize = 12; cmdsize = 12;
if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); } if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); }
//console.log("New desktop width: " + obj.width + ", height: " + obj.height); //console.log('New desktop width: ' + obj.width + ', height: ' + obj.height);
} else if (encoding == 0) { } else if (encoding == 0) {
// RAW encoding // RAW encoding
var ptr = 12, cs = 12 + (s * obj.bpp); var ptr = 12, cs = 12 + (s * obj.bpp);
@@ -256,7 +256,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
else { else {
// This is compressed ZLib data, decompress and process it. (TODO: This need to be optimized, remove str/arr conversions) // This is compressed ZLib data, decompress and process it. (TODO: This need to be optimized, remove str/arr conversions)
var str = obj.inflate.inflate(arrToStr(new Uint8Array(obj.acc.buffer.slice(ptr, ptr + datalen - dx)))); var str = obj.inflate.inflate(arrToStr(new Uint8Array(obj.acc.buffer.slice(ptr, ptr + datalen - dx))));
if (str.length > 0) { _decodeLRE(strToArr(str), 0, x, y, width, height, s, str.length); } else { console.log("Invalid deflate data"); } if (str.length > 0) { _decodeLRE(strToArr(str), 0, x, y, width, height, s, str.length); } else { console.log('Invalid deflate data'); }
} }
// ###END###{Inflate} // ###END###{Inflate}
@@ -595,66 +595,66 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.send = function (x) { if (obj.parent) { obj.parent.send(x); } } obj.send = function (x) { if (obj.parent) { obj.parent.send(x); } }
var convertAmtKeyCodeTable = { var convertAmtKeyCodeTable = {
"Pause": 19, 'Pause': 19,
"CapsLock": 20, 'CapsLock': 20,
"Space": 32, 'Space': 32,
"Quote": 39, 'Quote': 39,
"Minus": 45, 'Minus': 45,
"NumpadMultiply": 42, 'NumpadMultiply': 42,
"NumpadAdd": 43, 'NumpadAdd': 43,
"PrintScreen": 44, 'PrintScreen': 44,
"Comma": 44, 'Comma': 44,
"NumpadSubtract": 45, 'NumpadSubtract': 45,
"NumpadDecimal": 46, 'NumpadDecimal': 46,
"Period": 46, 'Period': 46,
"Slash": 47, 'Slash': 47,
"NumpadDivide": 47, 'NumpadDivide': 47,
"Semicolon": 59, 'Semicolon': 59,
"Equal": 61, 'Equal': 61,
"OSLeft": 91, 'OSLeft': 91,
"BracketLeft": 91, 'BracketLeft': 91,
"OSRight": 91, 'OSRight': 91,
"Backslash": 92, 'Backslash': 92,
"BracketRight": 93, 'BracketRight': 93,
"ContextMenu": 93, 'ContextMenu': 93,
"Backquote": 96, 'Backquote': 96,
"NumLock": 144, 'NumLock': 144,
"ScrollLock": 145, 'ScrollLock': 145,
"Backspace": 0xff08, 'Backspace': 0xff08,
"Tab": 0xff09, 'Tab': 0xff09,
"Enter": 0xff0d, 'Enter': 0xff0d,
"NumpadEnter": 0xff0d, 'NumpadEnter': 0xff0d,
"Escape": 0xff1b, 'Escape': 0xff1b,
"Delete": 0xffff, 'Delete': 0xffff,
"Home": 0xff50, 'Home': 0xff50,
"PageUp": 0xff55, 'PageUp': 0xff55,
"PageDown": 0xff56, 'PageDown': 0xff56,
"ArrowLeft": 0xff51, 'ArrowLeft': 0xff51,
"ArrowUp": 0xff52, 'ArrowUp': 0xff52,
"ArrowRight": 0xff53, 'ArrowRight': 0xff53,
"ArrowDown": 0xff54, 'ArrowDown': 0xff54,
"End": 0xff57, 'End': 0xff57,
"Insert": 0xff63, 'Insert': 0xff63,
"F1": 0xffbe, 'F1': 0xffbe,
"F2": 0xffbf, 'F2': 0xffbf,
"F3": 0xffc0, 'F3': 0xffc0,
"F4": 0xffc1, 'F4': 0xffc1,
"F5": 0xffc2, 'F5': 0xffc2,
"F6": 0xffc3, 'F6': 0xffc3,
"F7": 0xffc4, 'F7': 0xffc4,
"F8": 0xffc5, 'F8': 0xffc5,
"F9": 0xffc6, 'F9': 0xffc6,
"F10": 0xffc7, 'F10': 0xffc7,
"F11": 0xffc8, 'F11': 0xffc8,
"F12": 0xffc9, 'F12': 0xffc9,
"ShiftLeft": 0xffe1, 'ShiftLeft': 0xffe1,
"ShiftRight": 0xffe2, 'ShiftRight': 0xffe2,
"ControlLeft": 0xffe3, 'ControlLeft': 0xffe3,
"ControlRight": 0xffe4, 'ControlRight': 0xffe4,
"AltLeft": 0xffe9, 'AltLeft': 0xffe9,
"AltRight": 0xffea, 'AltRight': 0xffea,
"MetaLeft": 0xffe7, 'MetaLeft': 0xffe7,
"MetaRight": 0xffe8 'MetaRight': 0xffe8
} }
function convertAmtKeyCode(e) { function convertAmtKeyCode(e) {
if (e.code.startsWith('Key') && e.code.length == 4) { return e.code.charCodeAt(3) + ((e.shiftKey == false) ? 32 : 0); } if (e.code.startsWith('Key') && e.code.length == 4) { return e.code.charCodeAt(3) + ((e.shiftKey == false) ? 32 : 0); }
@@ -723,7 +723,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
if (k == 220) kk = 92; // \ if (k == 220) kk = 92; // \
if (k == 221) kk = 93; // ] if (k == 221) kk = 93; // ]
if (k == 222) kk = 39; // ' if (k == 222) kk = 39; // '
//console.log('Key' + d + ": " + k + " = " + kk); //console.log('Key' + d + ': ' + k + ' = ' + kk);
obj.sendkey(kk, d); obj.sendkey(kk, d);
} }
return obj.haltEvent(e); return obj.haltEvent(e);
@@ -821,7 +821,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
obj.handleKeyDown = function (e) { return _keyevent(1, e); } obj.handleKeyDown = function (e) { return _keyevent(1, e); }
obj.haltEvent = function (e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; } obj.haltEvent = function (e) { if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return false; }
// RFB "PointerEvent" and mouse handlers // RFB 'PointerEvent' and mouse handlers
obj.mousedblclick = function (e) { } obj.mousedblclick = function (e) { }
obj.mousedown = function (e) { obj.buttonmask |= (1 << e.button); return obj.mousemove(e, 1); } obj.mousedown = function (e) { obj.buttonmask |= (1 << e.button); return obj.mousemove(e, 1); }
obj.mouseup = function (e) { obj.buttonmask &= (0xFFFF - (1 << e.button)); return obj.mousemove(e, 1); } obj.mouseup = function (e) { obj.buttonmask &= (0xFFFF - (1 << e.button)); return obj.mousemove(e, 1); }

View File

@@ -9,12 +9,17 @@ function CreateIMRSDKWrapper() {
var _IMRSDK; var _IMRSDK;
var _ImrSdkVersion; var _ImrSdkVersion;
var _ref = require("ref"); var _ref = require('ref');
var _ffi = require("ffi"); var _ffi = require('ffi');
var _struct = require('ref-struct'); var _struct = require('ref-struct');
var _arrayType = require('ref-array'); var _arrayType = require('ref-array');
obj.pendingData = {}; obj.pendingData = {};
// ###BEGIN###{IDERDebug}
var logFile = null
if (urlvars && urlvars['iderlog']) { logFile = require('fs').createWriteStream(urlvars['iderlog'], { flags: 'w' }); }
// ###END###{IDERDebug}
// Callback from the native lib back into js (StdCall) // Callback from the native lib back into js (StdCall)
var uintPtr = _ref.refType('uint'); var uintPtr = _ref.refType('uint');
var OpenHandlerCallBack = _ffi.Callback('int', ['uint', 'uint'], _ffi.FFI_STDCALL, function (clientID, conID) { obj.pendingData[conID] = ''; return 0; }); var OpenHandlerCallBack = _ffi.Callback('int', ['uint', 'uint'], _ffi.FFI_STDCALL, function (clientID, conID) { obj.pendingData[conID] = ''; return 0; });
@@ -24,7 +29,10 @@ function CreateIMRSDKWrapper() {
var bufferLen = lengthPtr.readUInt32LE(0), buffer = _ref.reinterpret(bufferPtr, bufferLen); var bufferLen = lengthPtr.readUInt32LE(0), buffer = _ref.reinterpret(bufferPtr, bufferLen);
lengthPtr.writeUInt32LE(obj.pendingData[conID].length, 0); lengthPtr.writeUInt32LE(obj.pendingData[conID].length, 0);
for (var i = 0; i < obj.pendingData[conID].length; i++) { buffer[i] = obj.pendingData[conID].charCodeAt(i); } for (var i = 0; i < obj.pendingData[conID].length; i++) { buffer[i] = obj.pendingData[conID].charCodeAt(i); }
//console.log("ReceiveHandlerCallBack(conID: " + conID + ", Len: " + obj.pendingData[conID].length + ")"); // ###BEGIN###{IDERDebug}
//console.log('ReceiveHandlerCallBack(conID: ' + conID + ', Len: ' + obj.pendingData[conID].length + ')');
if (logFile != null) { logFile.write('IDERRECV: ' + rstr2hex(obj.pendingData[conID]) + '\r\n'); }
// ###END###{IDERDebug}
obj.pendingData[conID] = ''; obj.pendingData[conID] = '';
} catch (e) { console.log(e); } } catch (e) { console.log(e); }
return 0; return 0;
@@ -33,7 +41,10 @@ function CreateIMRSDKWrapper() {
try { try {
var buffer = _ref.reinterpret(ptr, length), str = ''; var buffer = _ref.reinterpret(ptr, length), str = '';
for (var i = 0; i < length; i++) { str += String.fromCharCode(buffer[i]); } for (var i = 0; i < length; i++) { str += String.fromCharCode(buffer[i]); }
//console.log("SendHandlerCallBack(conID: " + conID + ", Len: " + length + ")"); // ###BEGIN###{IDERDebug}
//console.log('SendHandlerCallBack(conID: ' + conID + ', Len: ' + length + ')');
if (logFile != null) { logFile.write('IDERSEND: ' + rstr2hex(str) + '\r\n'); }
// ###END###{IDERDebug}
obj.client.write(str, 'binary'); obj.client.write(str, 'binary');
} catch (e) { console.log(e); } } catch (e) { console.log(e); }
return 0; return 0;
@@ -80,29 +91,29 @@ function CreateIMRSDKWrapper() {
function _Setup(lib) { function _Setup(lib) {
try { try {
_IMRSDK = _ffi.Library(lib, { _IMRSDK = _ffi.Library(lib, {
"IMR_Init": ['uint', [_IMRVersionPtr, 'string']], // IMRResult IMR_Init(IMRVersion *version, char *ini_file); 'IMR_Init': ['uint', [_IMRVersionPtr, 'string']], // IMRResult IMR_Init(IMRVersion *version, char *ini_file);
"IMR_InitEx": ['uint', [_IMRVersionPtr, 'string', _SockCallBacksPtr]], // IMRResult IMR_Init(IMRVersion *version, char *ini_file, void *funcPtrs); 'IMR_InitEx': ['uint', [_IMRVersionPtr, 'string', _SockCallBacksPtr]], // IMRResult IMR_Init(IMRVersion *version, char *ini_file, void *funcPtrs);
"IMR_ReadyReadSock": ['uint', ['uint']], // IMRResult IMR_ReadyReadSock(uint conid); 'IMR_ReadyReadSock': ['uint', ['uint']], // IMRResult IMR_ReadyReadSock(uint conid);
"IMR_Close": ['uint', []], // IMRResult IMR_Close(); 'IMR_Close': ['uint', []], // IMRResult IMR_Close();
"IMR_GetErrorStringLen": ['uint', ['uint', _intPtr]], // IMRResult IMR_GetErrorStringLen(IMRResult, int * str_len); 'IMR_GetErrorStringLen': ['uint', ['uint', _intPtr]], // IMRResult IMR_GetErrorStringLen(IMRResult, int * str_len);
"IMR_GetErrorString": ['uint', ['uint', 'pointer']], // IMRResult IMR_GetErrorString(IMRResult, char * str); 'IMR_GetErrorString': ['uint', ['uint', 'pointer']], // IMRResult IMR_GetErrorString(IMRResult, char * str);
"IMR_SetCertificateInfo": ['uint', ['string', 'string', 'string']], // IMRResult IMR_SetCertificateInfo(const char *root_cert, const char *private_cert, const char *cert_pass); 'IMR_SetCertificateInfo': ['uint', ['string', 'string', 'string']], // IMRResult IMR_SetCertificateInfo(const char *root_cert, const char *private_cert, const char *cert_pass);
"IMR_SetClientCertificate": ['uint', ['string']], // IMRResult IMR_SetClientCertificate(const char *common_name); 'IMR_SetClientCertificate': ['uint', ['string']], // IMRResult IMR_SetClientCertificate(const char *common_name);
"IMR_AddClient": ['uint', ['int', 'string', 'pointer', _intPtr]], // IMRResult IMR_AddClient(ClientType new_client_type, char * client_ip, GUIDType client_guid, ClientID * new_client_id); 'IMR_AddClient': ['uint', ['int', 'string', 'pointer', _intPtr]], // IMRResult IMR_AddClient(ClientType new_client_type, char * client_ip, GUIDType client_guid, ClientID * new_client_id);
"IMR_RemoveClient": ['uint', ['int']], // IMRResult IMR_RemoveClient(ClientID client_id); 'IMR_RemoveClient': ['uint', ['int']], // IMRResult IMR_RemoveClient(ClientID client_id);
"IMR_RemoveAllClients": ['uint', []], // IMRResult IMR_RemoveAllClients(); 'IMR_RemoveAllClients': ['uint', []], // IMRResult IMR_RemoveAllClients();
"IMR_GetAllClients": ['uint', [_arrayType('int'), _intPtr]], // IMRResult IMR_GetAllClients(ClientID * client_list, int * client_list_size); 'IMR_GetAllClients': ['uint', [_arrayType('int'), _intPtr]], // IMRResult IMR_GetAllClients(ClientID * client_list, int * client_list_size);
"IMR_GetClientInfo": ['uint', ['int', _IMRClientInfoPtr]], // IMRResult IMR_GetClientInfo(ClientID client_id, ClientInfo *); 'IMR_GetClientInfo': ['uint', ['int', _IMRClientInfoPtr]], // IMRResult IMR_GetClientInfo(ClientID client_id, ClientInfo *);
"IMR_IDEROpenTCPSession": ['uint', ['int', _TCPSessionParamsPtr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSession(ClientID client_id, TCPSessionParams * params, IDERTout * touts, char * drive0, char * drive1); 'IMR_IDEROpenTCPSession': ['uint', ['int', _TCPSessionParamsPtr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSession(ClientID client_id, TCPSessionParams * params, IDERTout * touts, char * drive0, char * drive1);
"IMR_IDEROpenTCPSessionEx": ['uint', ['int', _TCPSessionParamsExPtr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSessionEx(ClientID client_id, TCPSessionParamsEx * params, IDERTout * touts, char * drive0, char * drive1); 'IMR_IDEROpenTCPSessionEx': ['uint', ['int', _TCPSessionParamsExPtr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSessionEx(ClientID client_id, TCPSessionParamsEx * params, IDERTout * touts, char * drive0, char * drive1);
"IMR_IDEROpenTCPSessionEx2": ['uint', ['int', _TCPSessionParamsEx2Ptr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSessionEx2(ClientID client_id, TCPSessionParamsEx2 * params, IDERTout * touts, char * drive0, char * drive1); 'IMR_IDEROpenTCPSessionEx2': ['uint', ['int', _TCPSessionParamsEx2Ptr, _IDERToutPtr, 'string', 'string']], // IMRResult IMR_IDEROpenTCPSessionEx2(ClientID client_id, TCPSessionParamsEx2 * params, IDERTout * touts, char * drive0, char * drive1);
"IMR_IDERCloseSession": ['uint', ['int']], // IMRResult IMR_IDERCloseSession(ClientID client_id); 'IMR_IDERCloseSession': ['uint', ['int']], // IMRResult IMR_IDERCloseSession(ClientID client_id);
"IMR_IDERClientFeatureSupported" : ['uint', ['int', _FeaturesSupportedPtr]], // IMRResult IMR_IDERClientFeatureSupported(ClientID client_id, FeaturesSupported * supported); 'IMR_IDERClientFeatureSupported' : ['uint', ['int', _FeaturesSupportedPtr]], // IMRResult IMR_IDERClientFeatureSupported(ClientID client_id, FeaturesSupported * supported);
"IMR_IDERGetDeviceState" : ['uint', ['int', _IDERDeviceStatePtr]], // IMRResult IMR_IDERGetDeviceState(ClientID client_id, IDERDeviceState * state); 'IMR_IDERGetDeviceState' : ['uint', ['int', _IDERDeviceStatePtr]], // IMRResult IMR_IDERGetDeviceState(ClientID client_id, IDERDeviceState * state);
"IMR_IDERSetDeviceState" : ['uint', ['int', _IDERDeviceCmdPtr, _IDERDeviceResultPtr]], // IMRResult IMR_IDERSetDeviceState(ClientID client_id, IDERDeviceCmd * cmd, IDERDeviceResult * result); 'IMR_IDERSetDeviceState' : ['uint', ['int', _IDERDeviceCmdPtr, _IDERDeviceResultPtr]], // IMRResult IMR_IDERSetDeviceState(ClientID client_id, IDERDeviceCmd * cmd, IDERDeviceResult * result);
"IMR_IDERGetSessionStatistics": ['uint', ['int', _IDERStatisticsPtr]], // IMRResult IMR_IDERGetSessionStatistics(ClientID client_id, IDERStatistics * stat); 'IMR_IDERGetSessionStatistics': ['uint', ['int', _IDERStatisticsPtr]], // IMRResult IMR_IDERGetSessionStatistics(ClientID client_id, IDERStatistics * stat);
"IMR_SetOpt": ['uint', ['int', 'string', 'string', 'int']], // IMRResult IMR_SetOpt(/*IN*/ClientID id, /*IN*/int optname, /*IN*/ const char *optval, /*IN*/ int optlen); 'IMR_SetOpt': ['uint', ['int', 'string', 'string', 'int']], // IMRResult IMR_SetOpt(/*IN*/ClientID id, /*IN*/int optname, /*IN*/ const char *optval, /*IN*/ int optlen);
"IMR_GetOpt": ['uint', ['int', 'string', 'pointer', _intPtr]], // IMRResult IMR_GetOpt(/*IN*/ClientID id, /*IN*/int optname, /*OUT*/ char *optval, /*OUT*/ int* optlen); 'IMR_GetOpt': ['uint', ['int', 'string', 'pointer', _intPtr]], // IMRResult IMR_GetOpt(/*IN*/ClientID id, /*IN*/int optname, /*OUT*/ char *optval, /*OUT*/ int* optlen);
}); });
} catch (e) { return false; } } catch (e) { return false; }
return true; return true;
@@ -114,7 +125,7 @@ function CreateIMRSDKWrapper() {
// IMR_Init // IMR_Init
obj.Init = function() { obj.Init = function() {
var version = new _IMRVersion(); var version = new _IMRVersion();
var error = _IMRSDK.IMR_Init(version.ref(), "imrsdk.ini"); var error = _IMRSDK.IMR_Init(version.ref(), 'imrsdk.ini');
if (error == 4) return _ImrSdkVersion; // If already initialized, return previous version information. if (error == 4) return _ImrSdkVersion; // If already initialized, return previous version information.
if (error != 0) { throw obj.GetErrorString(error); } if (error != 0) { throw obj.GetErrorString(error); }
_ImrSdkVersion = { major: version.major, minor: version.minor }; _ImrSdkVersion = { major: version.major, minor: version.minor };
@@ -131,7 +142,7 @@ function CreateIMRSDKWrapper() {
callbacks.SendHandler = SendHandlerCallBack; callbacks.SendHandler = SendHandlerCallBack;
obj.client = client; obj.client = client;
var error = _IMRSDK.IMR_InitEx(version.ref(), "imrsdk.ini", callbacks.ref()); var error = _IMRSDK.IMR_InitEx(version.ref(), 'imrsdk.ini', callbacks.ref());
if (error == 4) return _ImrSdkVersion; // If already initialized, return previous version information. if (error == 4) return _ImrSdkVersion; // If already initialized, return previous version information.
if (error != 0) { throw obj.GetErrorString(error); } if (error != 0) { throw obj.GetErrorString(error); }
_ImrSdkVersion = { major: version.major, minor: version.minor }; _ImrSdkVersion = { major: version.major, minor: version.minor };
@@ -331,9 +342,9 @@ var CreateAmtRemoteIderIMR = function () {
if (obj.m.onDialogPrompt) { if (obj.m.onDialogPrompt) {
if (require('os').platform() == 'win32') { if (require('os').platform() == 'win32') {
obj.m.onDialogPrompt(obj.m, { 'html': '<br>Select a CDROM and Floppy disk image to start the disk redirection.<br><br><br><div style=height:26px;margin-bottom:6px><select style=float:right;width:300px id=storagesourceoption onchange=onIderSourceChange()><option value=0 selected>ISO & IMG from file</option><option value=1>ISO from drive, IMG from file</option><option value=2>ISO from file, IMG from drive</option><option value=3>ISO & IMG from drive</option></select><div>Source</div></div><div style=height:20px><input type=file id=iderisofile accept=.iso style=float:right;width:300px><select style=float:right;width:300px;display:none id=iderisodrive><option>D:</option><option>E:</option><option>F:</option><option>G:</option><option>H:</option><option>I:</option></select><div>.ISO file</div></div><br><div style=height:20px><input type=file id=iderimgfile accept=.img style=float:right;width:300px><select style=float:right;width:300px;display:none id=iderimgdrive><option>A:</option><option>B:</option></select><div>.IMG file</div></div><br /><div style=height:26px><select style=float:right;width:300px id=storageserveroption><option value=0>On Reset</option><option value=1 selected>Gracefully</option><option value=2>Immediately</option></select><div>Start</div></div>' }); obj.m.onDialogPrompt(obj.m, { 'html': '<br>' + "Select a CDROM and Floppy disk image to start the disk redirection." + '<br><br><br><div style=height:26px;margin-bottom:6px><select style=float:right;width:300px id=storagesourceoption onchange=onIderSourceChange()><option value=0 selected>' + "ISO & IMG from file" + '</option><option value=1>' + "ISO from drive, IMG from file" + '</option><option value=2>' + "ISO from file, IMG from drive" + '</option><option value=3>' + "ISO & IMG from drive" + '</option></select><div>' + "Source" + '</div></div><div style=height:20px><input type=file id=iderisofile accept=.iso style=float:right;width:300px><select style=float:right;width:300px;display:none id=iderisodrive><option>D:</option><option>E:</option><option>F:</option><option>G:</option><option>H:</option><option>I:</option></select><div>' + ".ISO file" + '</div></div><br><div style=height:20px><input type=file id=iderimgfile accept=.img style=float:right;width:300px><select style=float:right;width:300px;display:none id=iderimgdrive><option>A:</option><option>B:</option></select><div>' + ".IMG file" + '</div></div><br /><div style=height:26px><select style=float:right;width:300px id=storageserveroption><option value=0>' + "On Reset" + '</option><option value=1 selected>' + "Gracefully" + '</option><option value=2>' + "Immediately" + '</option></select><div>' + "Start" + '</div></div>' });
} else { } else {
obj.m.onDialogPrompt(obj.m, { 'html': '<br>Select a CDROM and Floppy disk image to start the disk redirection.<br><br><br><div style=height:20px><input type=file id=iderisofile accept=.iso style=float:right;width:300px><div>.ISO file</div></div><br><div style=height:20px><input type=file id=iderimgfile accept=.img style=float:right;width:300px><div>.IMG file</div></div><br /><div style=height:26px><select style=float:right;width:300px id=storageserveroption><option value=0>On Reset</option><option value=1 selected>Gracefully</option><option value=2>Immediately</option></select><div>Start</div></div>' }); obj.m.onDialogPrompt(obj.m, { 'html': '<br>' + "Select a CDROM and Floppy disk image to start the disk redirection." + '<br><br><br><div style=height:20px><input type=file id=iderisofile accept=.iso style=float:right;width:300px><div>.ISO file</div></div><br><div style=height:20px><input type=file id=iderimgfile accept=.img style=float:right;width:300px><div>' + ".IMG file" + '</div></div><br /><div style=height:26px><select style=float:right;width:300px id=storageserveroption><option value=0>' + "On Reset" + '</option><option value=1 selected>' + "Gracefully" + '</option><option value=2>' + "Immediately" + '</option></select><div>' + "Start" + '</div></div>' });
} }
} }
} }
@@ -405,7 +416,7 @@ var CreateAmtRemoteIderIMR = function () {
function startIderSession(userConsentFunc) { function startIderSession(userConsentFunc) {
if (globalIderPendingCalls != 0) { console.log('Incomplete IDER cleanup (' + globalIderPendingCalls + ').'); return; } if (globalIderPendingCalls != 0) { console.log('Incomplete IDER cleanup (' + globalIderPendingCalls + ').'); return; }
try { try {
//console.log("IDER-Start"); //console.log('IDER-Start');
if (obj.m.xtlsoptions && obj.m.xtlsoptions.meshServerConnect) { if (obj.m.xtlsoptions && obj.m.xtlsoptions.meshServerConnect) {
// Open thru MeshCentral websocket wrapper // Open thru MeshCentral websocket wrapper
obj.m.client = CreateWebSocketWrapper(obj.m.xtlsoptions.host, obj.m.xtlsoptions.port, '/webrelay.ashx?user=' + encodeURIComponent(obj.m.xtlsoptions.username) + '&pass=' + encodeURIComponent(obj.m.xtlsoptions.password) + '&host=' + encodeURIComponent(obj.m.host) + '&p=2', obj.m.xtlsoptions.xtlsFingerprint); obj.m.client = CreateWebSocketWrapper(obj.m.xtlsoptions.host, obj.m.xtlsoptions.port, '/webrelay.ashx?user=' + encodeURIComponent(obj.m.xtlsoptions.username) + '&pass=' + encodeURIComponent(obj.m.xtlsoptions.password) + '&host=' + encodeURIComponent(obj.m.host) + '&p=2', obj.m.xtlsoptions.xtlsFingerprint);
@@ -429,7 +440,7 @@ var CreateAmtRemoteIderIMR = function () {
// Check the Intel AMT certificate, it must be the same as the one used for WSMAN. If not, disconnect. // Check the Intel AMT certificate, it must be the same as the one used for WSMAN. If not, disconnect.
var iderTlsCertificate = obj.m.client.getPeerCertificate(); var iderTlsCertificate = obj.m.client.getPeerCertificate();
if ((iderTlsCertificate == null) || (obj.m.wsmanCert == null) || (iderTlsCertificate.fingerprint != obj.m.wsmanCert.fingerprint)) { if ((iderTlsCertificate == null) || (obj.m.wsmanCert == null) || (iderTlsCertificate.fingerprint != obj.m.wsmanCert.fingerprint)) {
console.log("Invalid IDER certificate, disconnecting.", iderTlsCertificate); console.log('Invalid IDER certificate, disconnecting.', iderTlsCertificate);
obj.m.Stop(); obj.m.Stop();
} else { } else {
startIderSessionEx(userConsentFunc) startIderSessionEx(userConsentFunc)
@@ -440,7 +451,7 @@ var CreateAmtRemoteIderIMR = function () {
obj.m.client.setEncoding('binary'); obj.m.client.setEncoding('binary');
obj.m.client.on('data', function (data) { obj.m.client.on('data', function (data) {
//console.log("IDER-RECV(" + data.length + ", " + obj.receivedCount + "): " + rstr2hex(data)); //console.log('IDER-RECV(' + data.length + ', ' + obj.receivedCount + '): ' + rstr2hex(data));
if (obj.m.imrsdk == null) { return; } if (obj.m.imrsdk == null) { return; }
@@ -470,7 +481,7 @@ var CreateAmtRemoteIderIMR = function () {
function startIderSessionEx(userConsentFunc) { function startIderSessionEx(userConsentFunc) {
try { try {
//console.log("IDER-StartEx"); //console.log('IDER-StartEx');
obj.m.userConsentFunc = userConsentFunc; obj.m.userConsentFunc = userConsentFunc;
obj.m.imrsdk = CreateIMRSDKWrapper(); obj.m.imrsdk = CreateIMRSDKWrapper();
obj.m.imrsdk.InitEx(obj.m.client); obj.m.imrsdk.InitEx(obj.m.client);

View File

@@ -30,19 +30,19 @@ var CreateAmtRemoteServerIder = function () {
// Private method, called by parent when it change state // Private method, called by parent when it change state
obj.xxStateChange = function (newstate) { obj.xxStateChange = function (newstate) {
if (obj.state == newstate) return; if (obj.state == newstate) return;
debug("SIDER-StateChange", newstate); debug('SIDER-StateChange', newstate);
obj.state = newstate; obj.state = newstate;
if (obj.onStateChanged != null) { obj.onStateChanged(obj, obj.state); } if (obj.onStateChanged != null) { obj.onStateChanged(obj, obj.state); }
} }
obj.Start = function (host, port, user, pass, tls) { obj.Start = function (host, port, user, pass, tls) {
debug("SIDER-Start", host, port, user, pass, tls); debug('SIDER-Start', host, port, user, pass, tls);
obj.host = host; obj.host = host;
obj.port = port; obj.port = port;
obj.user = user; obj.user = user;
obj.pass = pass; obj.pass = pass;
obj.connectstate = 0; obj.connectstate = 0;
obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webider.ashx?host=" + host + "&port=" + port + "&tls=" + tls + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "") + "&tls1only=" + obj.tlsv1only); obj.socket = new WebSocket(window.location.protocol.replace('http', 'ws') + '//' + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/webider.ashx?host=' + host + '&port=' + port + '&tls=' + tls + ((user == '*') ? '&serverauth=1' : '') + ((typeof pass === 'undefined') ? ('&serverauth=1&user=' + user) : '') + '&tls1only=' + obj.tlsv1only);
obj.socket.onopen = obj.xxOnSocketConnected; obj.socket.onopen = obj.xxOnSocketConnected;
obj.socket.onmessage = obj.xxOnMessage; obj.socket.onmessage = obj.xxOnMessage;
obj.socket.onclose = obj.xxOnSocketClosed; obj.socket.onclose = obj.xxOnSocketClosed;
@@ -50,7 +50,7 @@ var CreateAmtRemoteServerIder = function () {
} }
obj.Stop = function () { obj.Stop = function () {
debug("SIDER-Stop"); debug('SIDER-Stop');
if (obj.socket != null) { obj.socket.close(); obj.socket = null; } if (obj.socket != null) { obj.socket.close(); obj.socket = null; }
obj.xxStateChange(0); obj.xxStateChange(0);
} }
@@ -81,7 +81,7 @@ var CreateAmtRemoteServerIder = function () {
break; break;
} }
case 'error': { case 'error': {
var iderErrorStrings = ["", "Floppy disk image does not exist", "Invalid floppy disk image", "Unable to open floppy disk image", "CDROM disk image does not exist", "Invalid CDROM disk image", "Unable to open CDROM disk image", "Can't perform IDER with no disk images"]; var iderErrorStrings = ['', "Floppy disk image does not exist", "Invalid floppy disk image", "Unable to open floppy disk image", "CDROM disk image does not exist", "Invalid CDROM disk image", "Unable to open CDROM disk image", "Can't perform IDER with no disk images"];
console.log('IDER Error: ' + iderErrorStrings[msg.code]); console.log('IDER Error: ' + iderErrorStrings[msg.code]);
// TODO: Display dialog box this error. // TODO: Display dialog box this error.
break; break;

View File

@@ -14,7 +14,7 @@ var CreateAmtRemoteIder = function () {
obj.tx_timeout = 0; // Default 0 obj.tx_timeout = 0; // Default 0
obj.heartbeat = 20000; // Default 20000 obj.heartbeat = 20000; // Default 20000
obj.version = 1; obj.version = 1;
obj.acc = ""; obj.acc = '';
obj.inSequence = 0; obj.inSequence = 0;
obj.outSequence = 0; obj.outSequence = 0;
obj.iderinfo = null; obj.iderinfo = null;
@@ -31,6 +31,8 @@ var CreateAmtRemoteIder = function () {
// Private method // Private method
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
var logFile = null;
if (urlvars && urlvars['iderlog']) { logFile = require('fs').createWriteStream(urlvars['iderlog'], { flags: 'w' }); }
function debug() { if (urlvars && urlvars['idertrace']) { console.log(arguments); } } function debug() { if (urlvars && urlvars['idertrace']) { console.log(arguments); } }
// ###END###{IDERDebug} // ###END###{IDERDebug}
@@ -66,7 +68,7 @@ var CreateAmtRemoteIder = function () {
// Private method, called by parent when it change state // Private method, called by parent when it change state
obj.xxStateChange = function (newstate) { obj.xxStateChange = function (newstate) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("IDER-StateChange", newstate); debug('IDER-StateChange', newstate);
// ###END###{IDERDebug} // ###END###{IDERDebug}
if (newstate == 0) { obj.Stop(); } if (newstate == 0) { obj.Stop(); }
if (newstate == 3) { obj.Start(); } if (newstate == 3) { obj.Start(); }
@@ -74,7 +76,7 @@ var CreateAmtRemoteIder = function () {
obj.Start = function () { obj.Start = function () {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("IDER-Start"); debug('IDER-Start');
debug(obj.floppy, obj.cdrom); debug(obj.floppy, obj.cdrom);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.bytesToAmt = 0; obj.bytesToAmt = 0;
@@ -100,7 +102,7 @@ var CreateAmtRemoteIder = function () {
obj.Stop = function () { obj.Stop = function () {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("IDER-Stop"); debug('IDER-Stop');
// ###END###{IDERDebug} // ###END###{IDERDebug}
//if (obj.pingTimer) { clearInterval(obj.pingTimer); obj.pingTimer = null; } //if (obj.pingTimer) { clearInterval(obj.pingTimer); obj.pingTimer = null; }
obj.parent.Stop(); obj.parent.Stop();
@@ -111,6 +113,7 @@ var CreateAmtRemoteIder = function () {
obj.bytesFromAmt += data.length; obj.bytesFromAmt += data.length;
obj.acc += data; obj.acc += data;
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
if (logFile != null) { logFile.write('IDERRECV: ' + rstr2hex(data) + '\r\n'); }
debug('IDER-ProcessData', obj.acc.length, rstr2hex(obj.acc)); debug('IDER-ProcessData', obj.acc.length, rstr2hex(obj.acc));
// ###END###{IDERDebug} // ###END###{IDERDebug}
@@ -139,6 +142,7 @@ var CreateAmtRemoteIder = function () {
obj.parent.xxSend(x); obj.parent.xxSend(x);
obj.bytesToAmt += x.length; obj.bytesToAmt += x.length;
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
if (logFile != null) { logFile.write('IDERSEND: ' + rstr2hex(x) + '\r\n'); }
if (cmdid != 0x4B) { debug('IDER-SendData', x.length, rstr2hex(x)); } if (cmdid != 0x4B) { debug('IDER-SendData', x.length, rstr2hex(x)); }
// ###END###{IDERDebug} // ###END###{IDERDebug}
} }
@@ -195,19 +199,19 @@ var CreateAmtRemoteIder = function () {
if (obj.iderinfo.proto != 0) { if (obj.iderinfo.proto != 0) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("Unknown proto", obj.iderinfo.proto); debug('Unknown proto', obj.iderinfo.proto);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.Stop(); obj.Stop();
} }
if (obj.iderinfo.readbfr > 8192) { if (obj.iderinfo.readbfr > 8192) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("Illegal read buffer size", obj.iderinfo.readbfr); debug('Illegal read buffer size', obj.iderinfo.readbfr);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.Stop(); obj.Stop();
} }
if (obj.iderinfo.writebfr > 8192) { if (obj.iderinfo.writebfr > 8192) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("Illegal write buffer size", obj.iderinfo.writebfr); debug('Illegal write buffer size', obj.iderinfo.writebfr);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.Stop(); obj.Stop();
} }
@@ -267,13 +271,13 @@ var CreateAmtRemoteIder = function () {
case 2: // REGS_STATUS case 2: // REGS_STATUS
obj.enabled = (value & 2) ? true : false; obj.enabled = (value & 2) ? true : false;
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("IDER Status: " + obj.enabled); debug('IDER Status: ' + obj.enabled);
// ###END###{IDERDebug} // ###END###{IDERDebug}
break; break;
case 3: // REGS_TOGGLE case 3: // REGS_TOGGLE
if (value != 1) { if (value != 1) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("Register toggle failure"); debug('Register toggle failure');
// ###END###{IDERDebug} // ###END###{IDERDebug}
} //else { obj.SendDisableEnableFeatures(2); } } //else { obj.SendDisableEnableFeatures(2); }
break; break;
@@ -330,7 +334,7 @@ var CreateAmtRemoteIder = function () {
{ {
case 0x00: // TEST_UNIT_READY: case 0x00: // TEST_UNIT_READY:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: TEST_UNIT_READY", dev); debug('SCSI: TEST_UNIT_READY', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
switch (dev) { switch (dev) {
case 0xA0: // DEV_FLOPPY case 0xA0: // DEV_FLOPPY
@@ -343,7 +347,7 @@ var CreateAmtRemoteIder = function () {
break; break;
default: default:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI Internal error 3", dev); debug('SCSI Internal error 3', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
return -1; return -1;
} }
@@ -354,7 +358,7 @@ var CreateAmtRemoteIder = function () {
len = cdb.charCodeAt(4); len = cdb.charCodeAt(4);
if (len == 0) { len = 256; } if (len == 0) { len = 256; }
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_6", dev, lba, len); debug('SCSI: READ_6', dev, lba, len);
// ###END###{IDERDebug} // ###END###{IDERDebug}
sendDiskData(dev, lba, len, featureRegister); sendDiskData(dev, lba, len, featureRegister);
break; break;
@@ -363,21 +367,21 @@ var CreateAmtRemoteIder = function () {
len = cdb.charCodeAt(4); len = cdb.charCodeAt(4);
if (len == 0) { len = 256; } if (len == 0) { len = 256; }
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: WRITE_6", dev, lba, len); debug('SCSI: WRITE_6', dev, lba, len);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); // Write is not supported, remote no medium. obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); // Write is not supported, remote no medium.
return -1; return -1;
/* /*
case 0x15: // MODE_SELECT_6: case 0x15: // MODE_SELECT_6:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI ERROR: MODE_SELECT_6", dev); debug('SCSI ERROR: MODE_SELECT_6', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00);
return -1; return -1;
*/ */
case 0x1a: // MODE_SENSE_6 case 0x1a: // MODE_SENSE_6
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: MODE_SENSE_6", dev); debug('SCSI: MODE_SENSE_6', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
if ((cdb.charCodeAt(2) == 0x3f) && (cdb.charCodeAt(3) == 0x00)) { if ((cdb.charCodeAt(2) == 0x3f) && (cdb.charCodeAt(3) == 0x00)) {
var a = 0, b = 0; var a = 0, b = 0;
@@ -394,7 +398,7 @@ var CreateAmtRemoteIder = function () {
break; break;
default: default:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI Internal error 6", dev); debug('SCSI Internal error 6', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
return -1; return -1;
} }
@@ -411,7 +415,7 @@ var CreateAmtRemoteIder = function () {
break; break;
case 0x1e: // LOCK_UNLOCK - ALLOW_MEDIUM_REMOVAL case 0x1e: // LOCK_UNLOCK - ALLOW_MEDIUM_REMOVAL
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: ALLOW_MEDIUM_REMOVAL", dev); debug('SCSI: ALLOW_MEDIUM_REMOVAL', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
if ((dev == 0xA0) && (obj.floppy == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; } if ((dev == 0xA0) && (obj.floppy == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
if ((dev == 0xB0) && (obj.cdrom == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; } if ((dev == 0xB0) && (obj.cdrom == null)) { obj.SendCommandEndResponse(1, 0x02, dev, 0x3a, 0x00); return -1; }
@@ -419,7 +423,7 @@ var CreateAmtRemoteIder = function () {
break; break;
case 0x23: // READ_FORMAT_CAPACITIES (Floppy only) case 0x23: // READ_FORMAT_CAPACITIES (Floppy only)
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_FORMAT_CAPACITIES", dev); debug('SCSI: READ_FORMAT_CAPACITIES', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
var buflen = ReadShort(cdb, 7); var buflen = ReadShort(cdb, 7);
var mediaStatus = 0, sectors; var mediaStatus = 0, sectors;
@@ -436,7 +440,7 @@ var CreateAmtRemoteIder = function () {
break; break;
default: default:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI Internal error 4", dev); debug('SCSI Internal error 4', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
return -1; return -1;
} }
@@ -445,7 +449,7 @@ var CreateAmtRemoteIder = function () {
break; break;
case 0x25: // READ_CAPACITY case 0x25: // READ_CAPACITY
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_CAPACITY", dev); debug('SCSI: READ_CAPACITY', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
var len = 0; var len = 0;
switch(dev) switch(dev)
@@ -466,13 +470,13 @@ var CreateAmtRemoteIder = function () {
break; break;
default: default:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI Internal error 4", dev); debug('SCSI Internal error 4', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
return -1; return -1;
} }
//if (dev == 0xA0) { dev = 0x00; } else { dev = 0x10; } // Weird but seems to work. //if (dev == 0xA0) { dev = 0x00; } else { dev = 0x10; } // Weird but seems to work.
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_CAPACITY2", dev, deviceFlags); debug('SCSI: READ_CAPACITY2', dev, deviceFlags);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendDataToHost(deviceFlags, true, IntToStr(len) + String.fromCharCode(0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0), featureRegister & 1); obj.SendDataToHost(deviceFlags, true, IntToStr(len) + String.fromCharCode(0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0), featureRegister & 1);
break; break;
@@ -480,7 +484,7 @@ var CreateAmtRemoteIder = function () {
lba = ReadInt(cdb, 2); lba = ReadInt(cdb, 2);
len = ReadShort(cdb, 7); len = ReadShort(cdb, 7);
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_10", dev, lba, len); debug('SCSI: READ_10', dev, lba, len);
// ###END###{IDERDebug} // ###END###{IDERDebug}
sendDiskData(dev, lba, len, featureRegister); sendDiskData(dev, lba, len, featureRegister);
break; break;
@@ -489,7 +493,7 @@ var CreateAmtRemoteIder = function () {
lba = ReadInt(cdb, 2); lba = ReadInt(cdb, 2);
len = ReadShort(cdb, 7); len = ReadShort(cdb, 7);
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: WRITE_10", dev, lba, len); debug('SCSI: WRITE_10', dev, lba, len);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendGetDataFromHost(dev, 512 * len); // Floppy writes only, accept sectors of 512 bytes obj.SendGetDataFromHost(dev, 512 * len); // Floppy writes only, accept sectors of 512 bytes
break; break;
@@ -499,7 +503,7 @@ var CreateAmtRemoteIder = function () {
var format = cdb.charCodeAt(2) & 0x07; var format = cdb.charCodeAt(2) & 0x07;
if (format == 0) { format = cdb.charCodeAt(9) >> 6; } if (format == 0) { format = cdb.charCodeAt(9) >> 6; }
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: READ_TOC, dev=" + dev + ", buflen=" + buflen + ", msf=" + msf + ", format=" + format); debug('SCSI: READ_TOC, dev=' + dev + ', buflen=' + buflen + ', msf=' + msf + ', format=' + format);
// ###END###{IDERDebug} // ###END###{IDERDebug}
switch (dev) { switch (dev) {
@@ -511,7 +515,7 @@ var CreateAmtRemoteIder = function () {
break; break;
default: default:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI Internal error 9", dev); debug('SCSI Internal error 9', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
return -1; return -1;
} }
@@ -531,7 +535,7 @@ var CreateAmtRemoteIder = function () {
var buflen = ReadShort(cdb, 7); var buflen = ReadShort(cdb, 7);
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: GET_CONFIGURATION", dev, sendall, firstcode, buflen); debug('SCSI: GET_CONFIGURATION', dev, sendall, firstcode, buflen);
// ###END###{IDERDebug} // ###END###{IDERDebug}
if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct.
@@ -561,7 +565,7 @@ var CreateAmtRemoteIder = function () {
//var buflen = (cdb.charCodeAt(7) << 8) + cdb.charCodeAt(8); //var buflen = (cdb.charCodeAt(7) << 8) + cdb.charCodeAt(8);
//if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct. //if (buflen == 0) { obj.SendDataToHost(dev, true, IntToStr(0x003c) + IntToStr(0x0008), featureRegister & 1); return -1; } // TODO: Fixed this return, it's not correct.
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: GET_EVENT_STATUS_NOTIFICATION", dev, cdb.charCodeAt(1), cdb.charCodeAt(4), cdb.charCodeAt(9)); debug('SCSI: GET_EVENT_STATUS_NOTIFICATION', dev, cdb.charCodeAt(1), cdb.charCodeAt(4), cdb.charCodeAt(9));
// ###END###{IDERDebug} // ###END###{IDERDebug}
if ((cdb.charCodeAt(1) != 0x01) && (cdb.charCodeAt(4) != 0x10)) { if ((cdb.charCodeAt(1) != 0x01) && (cdb.charCodeAt(4) != 0x10)) {
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
@@ -580,19 +584,19 @@ var CreateAmtRemoteIder = function () {
break; break;
case 0x51: // READ_DISC_INFO case 0x51: // READ_DISC_INFO
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI READ_DISC_INFO", dev); debug('SCSI READ_DISC_INFO', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); // Correct obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); // Correct
return -1; return -1;
case 0x55: // MODE_SELECT_10: case 0x55: // MODE_SELECT_10:
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI ERROR: MODE_SELECT_10", dev); debug('SCSI ERROR: MODE_SELECT_10', dev);
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00); obj.SendCommandEndResponse(1, 0x05, dev, 0x20, 0x00);
return -1; return -1;
case 0x5a: // MODE_SENSE_10 case 0x5a: // MODE_SENSE_10
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("SCSI: MODE_SENSE_10", dev, cdb.charCodeAt(2) & 0x3f); debug('SCSI: MODE_SENSE_10', dev, cdb.charCodeAt(2) & 0x3f);
// ###END###{IDERDebug} // ###END###{IDERDebug}
var buflen = ReadShort(cdb, 7); var buflen = ReadShort(cdb, 7);
//var pc = cdb.charCodeAt(2) & 0xc0; //var pc = cdb.charCodeAt(2) & 0xc0;
@@ -627,7 +631,7 @@ var CreateAmtRemoteIder = function () {
break; break;
default: // UNKNOWN COMMAND default: // UNKNOWN COMMAND
// ###BEGIN###{IDERDebug} // ###BEGIN###{IDERDebug}
debug("IDER: Unknown SCSI command", cdb.charCodeAt(0)); debug('IDER: Unknown SCSI command', cdb.charCodeAt(0));
// ###END###{IDERDebug} // ###END###{IDERDebug}
obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00); obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00);
return -1; return -1;

View File

@@ -14,7 +14,7 @@ var CreateLmsControl = function () {
// Private method // Private method
obj.Start = function () { obj.Start = function () {
socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + "/lms.ashx"); socket = new WebSocket(window.location.protocol.replace('http', 'ws') + '//' + window.location.host + '/lms.ashx');
socket.onopen = _OnSocketConnected; socket.onopen = _OnSocketConnected;
socket.onmessage = _OnMessage; socket.onmessage = _OnMessage;
socket.onclose = obj.Stop; socket.onclose = obj.Stop;
@@ -49,7 +49,7 @@ var CreateLmsControl = function () {
fileReader.readAsArrayBuffer(e.data); fileReader.readAsArrayBuffer(e.data);
} else { } else {
// IE10, readAsBinaryString does not exist, use an alternative. // IE10, readAsBinaryString does not exist, use an alternative.
var binary = "", bytes = new Uint8Array(e.data), length = bytes.byteLength; var binary = '', bytes = new Uint8Array(e.data), length = bytes.byteLength;
for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
_OnSocketData(binary); _OnSocketData(binary);
} }
@@ -63,7 +63,7 @@ var CreateLmsControl = function () {
if (typeof data === 'object') { if (typeof data === 'object') {
// This is an ArrayBuffer, convert it to a string array (used in IE) // This is an ArrayBuffer, convert it to a string array (used in IE)
var binary = ""; var binary = '';
var bytes = new Uint8Array(data); var bytes = new Uint8Array(data);
var length = bytes.byteLength; var length = bytes.byteLength;
for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
@@ -85,7 +85,7 @@ var CreateLmsControl = function () {
obj.SendCmd = function (cmdid, data) { obj.SendCmd = function (cmdid, data) {
if (socket == null || obj.State != 2) return; if (socket == null || obj.State != 2) return;
if (!data || data == null) data = ""; if (!data || data == null) data = '';
_Send(ShortToStrX(cmdid) + data); _Send(ShortToStrX(cmdid) + data);
} }

View File

@@ -85,7 +85,7 @@ var CreateAmtRedirect = function (module) {
} }
if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CONNECTED'); } if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CONNECTED'); }
//obj.Debug("Socket Connected"); //obj.Debug('Socket Connected');
obj.xxStateChange(2); obj.xxStateChange(2);
if (obj.protocol == 1) obj.directSend(new Uint8Array([0x10, 0x00, 0x00, 0x00, 0x53, 0x4F, 0x4C, 0x20])); // SOL if (obj.protocol == 1) obj.directSend(new Uint8Array([0x10, 0x00, 0x00, 0x00, 0x53, 0x4F, 0x4C, 0x20])); // SOL
if (obj.protocol == 2) obj.directSend(new Uint8Array([0x10, 0x01, 0x00, 0x00, 0x4b, 0x56, 0x4d, 0x52])); // KVM if (obj.protocol == 2) obj.directSend(new Uint8Array([0x10, 0x01, 0x00, 0x00, 0x4b, 0x56, 0x4d, 0x52])); // KVM
@@ -265,7 +265,7 @@ var CreateAmtRedirect = function (module) {
obj.xxSend = function (x) { obj.xxSend = function (x) {
if (urlvars && urlvars['redirtrace']) { console.log('REDIR-SEND(' + x.length + '): ' + rstr2hex(x)); } if (urlvars && urlvars['redirtrace']) { console.log('REDIR-SEND(' + x.length + '): ' + rstr2hex(x)); }
//obj.Debug("Send(" + x.length + "): " + rstr2hex(x)); //obj.Debug('Send(' + x.length + '): ' + rstr2hex(x));
obj.socket.write(new Buffer(x, 'binary')); obj.socket.write(new Buffer(x, 'binary'));
} }
@@ -281,7 +281,7 @@ var CreateAmtRedirect = function (module) {
obj.xxOnSocketClosed = function () { obj.xxOnSocketClosed = function () {
if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); } if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); }
//obj.Debug("Socket Closed"); //obj.Debug('Socket Closed');
obj.Stop(); obj.Stop();
} }
@@ -294,7 +294,7 @@ var CreateAmtRedirect = function (module) {
obj.Stop = function () { obj.Stop = function () {
if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); } if (urlvars && urlvars['redirtrace']) { console.log('REDIR-CLOSED'); }
//obj.Debug("Socket Stopped"); //obj.Debug('Socket Stopped');
obj.xxStateChange(0); obj.xxStateChange(0);
obj.connectstate = -1; obj.connectstate = -1;
obj.amtaccumulator = ''; obj.amtaccumulator = '';

View File

@@ -55,7 +55,7 @@ var CreateAmtScanner = function (func) {
if (range == null || (range.min > range.max)) return false; if (range == null || (range.min > range.max)) return false;
var rangeinfo = { id: id, range: rangestr, min: range.min, max: range.max, results: {}, resultCount: 0 }; var rangeinfo = { id: id, range: rangestr, min: range.min, max: range.max, results: {}, resultCount: 0 };
obj.rserver[id] = rangeinfo; obj.rserver[id] = rangeinfo;
rangeinfo.server = obj.dgram.createSocket("udp4"); rangeinfo.server = obj.dgram.createSocket('udp4');
rangeinfo.server.bind(0); rangeinfo.server.bind(0);
rangeinfo.server.on('error', function(err) { console.log(err); }); rangeinfo.server.on('error', function(err) { console.log(err); });
rangeinfo.server.on('message', function(data, rinfo) { obj.parseRmcpPacket(data, rinfo, 0, func, rangeinfo); }); rangeinfo.server.on('message', function(data, rinfo) { obj.parseRmcpPacket(data, rinfo, 0, func, rangeinfo); });
@@ -74,7 +74,7 @@ var CreateAmtScanner = function (func) {
return true; return true;
} }
// Parse range, used to parse "ip", "ip/mask" or "ip-ip" notation. // Parse range, used to parse 'ip', 'ip/mask' or 'ip-ip' notation.
// Return the start and end value of the scan // Return the start and end value of the scan
obj.parseIpv4Range = function (range) { obj.parseIpv4Range = function (range) {
if (range == undefined || range == null) return null; if (range == undefined || range == null) return null;
@@ -225,10 +225,10 @@ var CreateAmtScanner = function (func) {
// throw failed upon timeout // throw failed upon timeout
timer = setTimeout(function () { timer = setTimeout(function () {
timer = null; // Ensure timer is nullified timer = null; // Ensure timer is nullified
doCallback(new Error("Timeout exceeded"), null); doCallback(new Error('Timeout exceeded'), null);
}, 3000); }, 3000);
require("dns").reverse(ip, doCallback); require('dns').reverse(ip, doCallback);
} }
return obj; return obj;

View File

@@ -126,7 +126,7 @@ function script_setup(binary, startvars) {
argval = argval.substring(1); argval = argval.substring(1);
if (argtyp < 2) { if (argtyp < 2) {
// Get the value and replace all {var} with variable values // Get the value and replace all {var} with variable values
while (argval.split("{").length > 1) { var t = argval.split("{").pop().split("}").shift(); argval = argval.replace('{' + t + '}', obj.getVar(t)); } while (argval.split('{').length > 1) { var t = argval.split('{').pop().split('}').shift(); argval = argval.replace('{' + t + '}', obj.getVar(t)); }
if (argtyp == 1) { obj.variables['__' + i] = decodeURI(argval); argval = '__' + i; } // If argtyp is 1, this is a literal. Store in temp variable. if (argtyp == 1) { obj.variables['__' + i] = decodeURI(argval); argval = '__' + i; } // If argtyp is 1, this is a literal. Store in temp variable.
args.push(argval); args.push(argval);
} }
@@ -250,12 +250,12 @@ function script_setup(binary, startvars) {
// ###BEGIN###{Certificates} // ###BEGIN###{Certificates}
obj.state = 2; obj.state = 2;
// DERKey, xxCaPrivateKey, certattributes, issuerattributes // DERKey, xxCaPrivateKey, certattributes, issuerattributes
amtcert_signWithCaKey(argsval[0], null, argsval[1], { 'CN': 'Untrusted Root Certificate' }, obj.xxSignWithDummyCaReturn); amtcert_signWithCaKey(argsval[0], null, argsval[1], { 'CN': "Untrusted Root Certificate" }, obj.xxSignWithDummyCaReturn);
// ###END###{Certificates} // ###END###{Certificates}
break; break;
default: { default: {
obj.state = 9; obj.state = 9;
console.error("Script Error, unknown command: " + cmdid); console.error('Script Error, unknown command: ' + cmdid);
} }
} }
} else { } else {
@@ -399,7 +399,7 @@ function script_decompile(binary, onecmd) {
var argcount = ReadShort(binary, ptr + 4); var argcount = ReadShort(binary, ptr + 4);
var argptr = ptr + 6; var argptr = ptr + 6;
var argstr = ''; var argstr = '';
if (!(onecmd >= 0)) r += ":label" + (ptr - 6) + "\n"; if (!(onecmd >= 0)) r += ':label' + (ptr - 6) + '\n';
// Loop on each argument, moving forward by the argument length each time // Loop on each argument, moving forward by the argument length each time
for (var i = 0; i < argcount; i++) { for (var i = 0; i < argcount; i++) {
var arglen = ReadShort(binary, argptr); var arglen = ReadShort(binary, argptr);
@@ -411,19 +411,19 @@ function script_decompile(binary, onecmd) {
else if (argtyp == 3) { // Label else if (argtyp == 3) { // Label
var target = ReadInt(argval, 1); var target = ReadInt(argval, 1);
var label = labels[target]; var label = labels[target];
if (!label) { label = ":label" + target; labels[label] = target; } if (!label) { label = ':label' + target; labels[label] = target; }
argstr += ' ' + label; argstr += ' ' + label;
} }
argptr += (2 + arglen); argptr += (2 + arglen);
} }
// Go in the script function table to decode the function // Go in the script function table to decode the function
if (cmdid < 10000) { if (cmdid < 10000) {
r += script_functionTable1[cmdid] + argstr + "\n"; r += script_functionTable1[cmdid] + argstr + '\n';
} else { } else {
if (cmdid >= 20000) { if (cmdid >= 20000) {
r += script_functionTable3[cmdid - 20000] + argstr + "\n"; // Optional methods r += script_functionTable3[cmdid - 20000] + argstr + '\n'; // Optional methods
} else { } else {
r += script_functionTable2[cmdid - 10000] + argstr + "\n"; r += script_functionTable2[cmdid - 10000] + argstr + '\n';
} }
} }
ptr += cmdlen; ptr += cmdlen;

View File

@@ -6,10 +6,10 @@
// Intel(R) AMT Setup.bin GUID's // Intel(R) AMT Setup.bin GUID's
var AmtSetupBinSetupGuids = [ var AmtSetupBinSetupGuids = [
"\xb5\x16\xfb\x71\x87\xcb\xf9\x4a\xb4\x41\xca\x7b\x38\x35\x78\xf9", // Version 1 '\xb5\x16\xfb\x71\x87\xcb\xf9\x4a\xb4\x41\xca\x7b\x38\x35\x78\xf9', // Version 1
"\x96\xb2\x81\x58\xcf\x6b\x72\x4c\x8b\x91\xa1\x5e\x51\x2e\x99\xc4", // Version 2 '\x96\xb2\x81\x58\xcf\x6b\x72\x4c\x8b\x91\xa1\x5e\x51\x2e\x99\xc4', // Version 2
"\xa7\xf7\xf6\xc6\x89\xc4\xf6\x47\x93\xed\xe2\xe5\x02\x0d\xa5\x1d", // Version 3 '\xa7\xf7\xf6\xc6\x89\xc4\xf6\x47\x93\xed\xe2\xe5\x02\x0d\xa5\x1d', // Version 3
"\xaa\xa9\x34\x52\xe1\x29\xa9\x44\x8d\x4d\x08\x1c\x07\xb9\x63\x53" // Version 4 '\xaa\xa9\x34\x52\xe1\x29\xa9\x44\x8d\x4d\x08\x1c\x07\xb9\x63\x53' // Version 4
]; ];
// Notes about version 2 of setup.bin: // Notes about version 2 of setup.bin:
@@ -205,12 +205,12 @@ var AmtSetupBinEncode = function (obj) {
r += IntToStrX(obj.records.length); r += IntToStrX(obj.records.length);
r += IntToStrX(obj.dataRecordsConsumed); r += IntToStrX(obj.dataRecordsConsumed);
r += ShortToStrX(obj.dataRecordChunkCount); r += ShortToStrX(obj.dataRecordChunkCount);
while (r.length < 512) { r += "\0"; } // Pad the header while (r.length < 512) { r += '\0'; } // Pad the header
out.push(r); out.push(r);
// Write each record // Write each record
for (var i in obj.records) { for (var i in obj.records) {
var r2 = "", rec = obj.records[i]; var r2 = '', rec = obj.records[i];
r2 += IntToStrX(rec.typeIdentifier); r2 += IntToStrX(rec.typeIdentifier);
r2 += IntToStrX(rec.flags); r2 += IntToStrX(rec.flags);
r2 += IntToStrX(0); // Reserved r2 += IntToStrX(0); // Reserved
@@ -231,7 +231,7 @@ var AmtSetupBinEncode = function (obj) {
// Write each variable // Write each variable
for (var j in rec.variables) { for (var j in rec.variables) {
var r3 = "", v = rec.variables[j], data = v.value; var r3 = '', v = rec.variables[j], data = v.value;
v.type = AmtSetupBinVarIds[v.moduleid][v.varid][0]; // Set the correct type if not alreay connect v.type = AmtSetupBinVarIds[v.moduleid][v.varid][0]; // Set the correct type if not alreay connect
if ((v.type > 0) && (v.type < 4)) { // If this is a numeric value, encode it correctly if ((v.type > 0) && (v.type < 4)) { // If this is a numeric value, encode it correctly
data = parseInt(data); data = parseInt(data);
@@ -245,11 +245,11 @@ var AmtSetupBinEncode = function (obj) {
r3 += ShortToStrX(data.length); // Variable Length r3 += ShortToStrX(data.length); // Variable Length
r3 += ShortToStrX(0); // Reserved r3 += ShortToStrX(0); // Reserved
r3 += data; // Variable Data r3 += data; // Variable Data
while (r3.length % 4 != 0) { r3 += "\0"; } // Pad the variable while (r3.length % 4 != 0) { r3 += '\0'; } // Pad the variable
r2 += r3; r2 += r3;
} }
while (r2.length < 512) { r2 += "\0"; } // Pad the record while (r2.length < 512) { r2 += '\0'; } // Pad the record
if ((rec.flags & 2) != 0) { r2 = r2.substring(0, 24) + AmtSetupBinScrambleRecordData(r2.substring(24)); } // Scramble the record starting at byte 24, after the header if ((rec.flags & 2) != 0) { r2 = r2.substring(0, 24) + AmtSetupBinScrambleRecordData(r2.substring(24)); } // Scramble the record starting at byte 24, after the header
out.push(r2); out.push(r2);
} }
@@ -266,8 +266,8 @@ function AmtSetupBinVariableCompare(a, b) {
} }
// Scramble and un-scramble records // Scramble and un-scramble records
function AmtSetupBinScrambleRecordData(data) { var out = ""; for (var i = 0; i < data.length; i++) { out += String.fromCharCode((data.charCodeAt(i) + 17) & 0xFF); } return out; } function AmtSetupBinScrambleRecordData(data) { var out = ''; for (var i = 0; i < data.length; i++) { out += String.fromCharCode((data.charCodeAt(i) + 17) & 0xFF); } return out; }
function AmtSetupBinDescrambleRecordData(data) { var out = ""; for (var i = 0; i < data.length; i++) { out += String.fromCharCode((data.charCodeAt(i) + 0xEF) & 0xFF); } return out; } function AmtSetupBinDescrambleRecordData(data) { var out = ''; for (var i = 0; i < data.length; i++) { out += String.fromCharCode((data.charCodeAt(i) + 0xEF) & 0xFF); } return out; }
// Find a moduleid/varid in the variable list, if found, move it to the top // Find a moduleid/varid in the variable list, if found, move it to the top
//function AmtSetupBinMoveToTop(variables, moduleid, varid) { var i = -1; for (var j in variables) { if ((variables[j].moduleid == moduleid) && (variables[j].varid == varid)) { i = j; } } if (i > 1) { ArrayElementMove(variables, i, 0); } } //function AmtSetupBinMoveToTop(variables, moduleid, varid) { var i = -1; for (var j in variables) { if ((variables[j].moduleid == moduleid) && (variables[j].varid == varid)) { i = j; } } if (i > 1) { ArrayElementMove(variables, i, 0); } }

View File

@@ -77,7 +77,7 @@ var CreateAmtRemoteTerminal = function (divid, options) {
} }
obj.ProcessData = function (str) { obj.ProcessData = function (str) {
if (obj.debugmode == 2) { console.log("TRecv(" + str.length + "): " + rstr2hex(str)); } if (obj.debugmode == 2) { console.log('TRecv(' + str.length + '): ' + rstr2hex(str)); }
if (obj.capture != null) obj.capture += str; if (obj.capture != null) obj.capture += str;
// ###BEGIN###{Terminal-Enumation-UTF8} // ###BEGIN###{Terminal-Enumation-UTF8}
try { str = decode_utf8(utf8decodeBuffer + str); } catch (ex) { utf8decodeBuffer += str; return; } // If we get data in the middle of a UTF-8 code, buffer it for next time. try { str = decode_utf8(utf8decodeBuffer + str); } catch (ex) { utf8decodeBuffer += str; return; } // If we get data in the middle of a UTF-8 code, buffer it for next time.
@@ -561,7 +561,7 @@ var CreateAmtRemoteTerminal = function (divid, options) {
break; break;
case '\t': // tab case '\t': // tab
var tab = 8 - (_termx % 8) var tab = 8 - (_termx % 8)
for (var x = 0; x < tab; x++) _ProcessVt100Char(" "); for (var x = 0; x < tab; x++) _ProcessVt100Char(' ');
break; break;
case '\n': // Linefeed case '\n': // Linefeed
_termy++; _termy++;
@@ -645,8 +645,8 @@ var CreateAmtRemoteTerminal = function (divid, options) {
} }
} }
obj.TermSendKeys = function (keys) { if (obj.debugmode == 2) { console.log("TSend(" + keys.length + "): " + rstr2hex(keys), keys); } if (obj.parent) { obj.parent.Send(keys); } } obj.TermSendKeys = function (keys) { if (obj.debugmode == 2) { console.log('TSend(' + keys.length + '): ' + rstr2hex(keys), keys); } if (obj.parent) { obj.parent.Send(keys); } }
obj.TermSendKey = function (key) { if (obj.debugmode == 2) { console.log("TSend(1): " + rstr2hex(String.fromCharCode(key)), key); } if (obj.parent) { obj.parent.Send(String.fromCharCode(key)); } } obj.TermSendKey = function (key) { if (obj.debugmode == 2) { console.log('TSend(1): ' + rstr2hex(String.fromCharCode(key)), key); } if (obj.parent) { obj.parent.Send(String.fromCharCode(key)); } }
function _TermMoveUp(linecount) { function _TermMoveUp(linecount) {
var x, y; var x, y;
@@ -710,7 +710,7 @@ var CreateAmtRemoteTerminal = function (divid, options) {
if (e.which == 45) { obj.TermSendKeys(String.fromCharCode(27, 91, 50, 126)); return true; }; // Insert if (e.which == 45) { obj.TermSendKeys(String.fromCharCode(27, 91, 50, 126)); return true; }; // Insert
if (e.which == 46) { obj.TermSendKeys(String.fromCharCode(27, 91, 51, 126)); return true; }; // Delete if (e.which == 46) { obj.TermSendKeys(String.fromCharCode(27, 91, 51, 126)); return true; }; // Delete
if (e.which == 9) { obj.TermSendKeys("\t"); if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return true; }; // TAB if (e.which == 9) { obj.TermSendKeys('\t'); if (e.preventDefault) e.preventDefault(); if (e.stopPropagation) e.stopPropagation(); return true; }; // TAB
// F1 to F12 keys // F1 to F12 keys
// ###BEGIN###{Terminal-FxEnumation-All} // ###BEGIN###{Terminal-FxEnumation-All}
@@ -764,7 +764,7 @@ var CreateAmtRemoteTerminal = function (divid, options) {
buf += '<span style="color:#' + _TermColors[(newat >> x1) & 0x3F] + ';background-color:#' + _TermColors[(newat >> x2) & 0x3F]; buf += '<span style="color:#' + _TermColors[(newat >> x1) & 0x3F] + ';background-color:#' + _TermColors[(newat >> x2) & 0x3F];
if (newat & _VTUNDERLINE) buf += ';text-decoration:underline'; if (newat & _VTUNDERLINE) buf += ';text-decoration:underline';
buf += ';">'; buf += ';">';
closetag = "</span>" + closetag; closetag = '</span>' + closetag;
oldat = newat; oldat = newat;
} }
@@ -791,7 +791,7 @@ var CreateAmtRemoteTerminal = function (divid, options) {
if (scrollBackBuffer.length > 800) { scrollBackBuffer = scrollBackBuffer.slice(scrollBackBuffer.length - 800); } if (scrollBackBuffer.length > 800) { scrollBackBuffer = scrollBackBuffer.slice(scrollBackBuffer.length - 800); }
var backbuffer = scrollBackBuffer.join(''); var backbuffer = scrollBackBuffer.join('');
obj.DivElement.innerHTML = "<font size='4'><b>" + backbuffer + buf + closetag + "</b></font>"; obj.DivElement.innerHTML = '<font size="4"><b>' + backbuffer + buf + closetag + '</b></font>';
obj.DivElement.scrollTop = obj.DivElement.scrollHeight; obj.DivElement.scrollTop = obj.DivElement.scrollHeight;
//if (obj.heightLock == 0) { setTimeout(obj.TermLockHeight, 10); } //if (obj.heightLock == 0) { setTimeout(obj.TermLockHeight, 10); }
} }

View File

@@ -17,7 +17,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) { obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; } if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; }
var wsresponse = obj.ParseWsman(data); var wsresponse = obj.ParseWsman(data);
if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header["ResourceURI"], wsresponse, 200, tag); } if (!wsresponse || wsresponse == null) { callback(obj, null, { Header: { HttpError: status } }, 601, tag); } else { callback(obj, wsresponse.Header['ResourceURI'], wsresponse, 200, tag); }
}, tag, pri); }, tag, pri);
} }
@@ -29,98 +29,98 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
// Get the last element of a URI string // Get the last element of a URI string
obj.GetNameFromUrl = function (resuri) { obj.GetNameFromUrl = function (resuri) {
var x = resuri.lastIndexOf("/"); var x = resuri.lastIndexOf('/');
return (x == -1)?resuri:resuri.substring(x + 1); return (x == -1)?resuri:resuri.substring(x + 1);
} }
// Perform a WSMAN Subscribe operation // Perform a WSMAN Subscribe operation
obj.ExecSubscribe = function (resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) { obj.ExecSubscribe = function (resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) {
var digest = "", digest2 = "", opaque = ""; var digest = '', digest2 = '', opaque = '';
if (user != null && pass != null) { digest = '<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>'; } if (user != null && pass != null) { digest = '<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>'; }
if (opaque != null) { opaque = '<a:ReferenceParameters><m:arg>' + opaque + '</m:arg></a:ReferenceParameters>'; } if (opaque != null) { opaque = '<a:ReferenceParameters><m:arg>' + opaque + '</m:arg></a:ReferenceParameters>'; }
if (delivery == 'PushWithAck') { delivery = 'dmtf.org/wbem/wsman/1/wsman/PushWithAck'; } else if (delivery == 'Push') { delivery = 'xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push'; } if (delivery == 'PushWithAck') { delivery = 'dmtf.org/wbem/wsman/1/wsman/PushWithAck'; } else if (delivery == 'Push') { delivery = 'xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push'; }
var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + digest + '</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.' + delivery + '"><e:NotifyTo><a:Address>' + url + '</a:Address>' + opaque + '</e:NotifyTo>' + digest2 + '</e:Delivery></e:Subscribe>'; var data = 'http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>' + _PutObjToSelectorsXml(selectors) + digest + '</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.' + delivery + '"><e:NotifyTo><a:Address>' + url + '</a:Address>' + opaque + '</e:NotifyTo>' + digest2 + '</e:Delivery></e:Subscribe>';
obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"'); obj.PerformAjax(data + '</Body></Envelope>', callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"');
} }
// Perform a WSMAN UnSubscribe operation // Perform a WSMAN UnSubscribe operation
obj.ExecUnSubscribe = function (resuri, callback, tag, pri, selectors) { obj.ExecUnSubscribe = function (resuri, callback, tag, pri, selectors) {
var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + '</Header><Body><e:Unsubscribe/>'; var data = 'http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>' + _PutObjToSelectorsXml(selectors) + '</Header><Body><e:Unsubscribe/>';
obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"'); obj.PerformAjax(data + '</Body></Envelope>', callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"');
} }
// Perform a WSMAN PUT operation // Perform a WSMAN PUT operation
obj.ExecPut = function (resuri, putobj, callback, tag, pri, selectors) { obj.ExecPut = function (resuri, putobj, callback, tag, pri, selectors) {
var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + '</Header><Body>' + _PutObjToBodyXml(resuri, putobj); var data = 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>' + _PutObjToSelectorsXml(selectors) + '</Header><Body>' + _PutObjToBodyXml(resuri, putobj);
obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri); obj.PerformAjax(data + '</Body></Envelope>', callback, tag, pri);
} }
// Perform a WSMAN CREATE operation // Perform a WSMAN CREATE operation
obj.ExecCreate = function (resuri, putobj, callback, tag, pri, selectors) { obj.ExecCreate = function (resuri, putobj, callback, tag, pri, selectors) {
var objname = obj.GetNameFromUrl(resuri); var objname = obj.GetNameFromUrl(resuri);
var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><g:" + objname + " xmlns:g=\"" + resuri + "\">"; var data = 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>' + _PutObjToSelectorsXml(selectors) + '</Header><Body><g:' + objname + ' xmlns:g="' + resuri + '">';
for (var n in putobj) { data += "<g:" + n + ">" + putobj[n] + "</g:" + n + ">" } for (var n in putobj) { data += '<g:' + n + '>' + putobj[n] + '</g:' + n + '>' }
obj.PerformAjax(data + "</g:" + objname + "></Body></Envelope>", callback, tag, pri); obj.PerformAjax(data + '</g:' + objname + '></Body></Envelope>', callback, tag, pri);
} }
// Perform a WSMAN DELETE operation // Perform a WSMAN DELETE operation
obj.ExecDelete = function (resuri, putobj, callback, tag, pri) { obj.ExecDelete = function (resuri, putobj, callback, tag, pri) {
var data = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(putobj) + "</Header><Body /></Envelope>"; var data = 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>' + _PutObjToSelectorsXml(putobj) + '</Header><Body /></Envelope>';
obj.PerformAjax(data, callback, tag, pri); obj.PerformAjax(data, callback, tag, pri);
} }
// Perform a WSMAN GET operation // Perform a WSMAN GET operation
obj.ExecGet = function (resuri, callback, tag, pri) { obj.ExecGet = function (resuri, callback, tag, pri) {
obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>", callback, tag, pri); obj.PerformAjax('http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>', callback, tag, pri);
} }
// Perform a WSMAN method call operation // Perform a WSMAN method call operation
obj.ExecMethod = function (resuri, method, args, callback, tag, pri, selectors) { obj.ExecMethod = function (resuri, method, args, callback, tag, pri, selectors) {
var argsxml = ""; var argsxml = '';
for (var i in args) { if (args[i] != null) { if (Array.isArray(args[i])) { for (var x in args[i]) { argsxml += "<r:" + i + ">" + args[i][x] + "</r:" + i + ">"; } } else { argsxml += "<r:" + i + ">" + args[i] + "</r:" + i + ">"; } } } for (var i in args) { if (args[i] != null) { if (Array.isArray(args[i])) { for (var x in args[i]) { argsxml += '<r:' + i + '>' + args[i][x] + '</r:' + i + '>'; } } else { argsxml += '<r:' + i + '>' + args[i] + '</r:' + i + '>'; } } }
obj.ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors); obj.ExecMethodXml(resuri, method, argsxml, callback, tag, pri, selectors);
} }
// Perform a WSMAN method call operation. The arguments are already formatted in XML. // Perform a WSMAN method call operation. The arguments are already formatted in XML.
obj.ExecMethodXml = function (resuri, method, argsxml, callback, tag, pri, selectors) { obj.ExecMethodXml = function (resuri, method, argsxml, callback, tag, pri, selectors) {
obj.PerformAjax(resuri + "/" + method + "</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>" + _PutObjToSelectorsXml(selectors) + "</Header><Body><r:" + method + '_INPUT' + " xmlns:r=\"" + resuri + "\">" + argsxml + "</r:" + method + "_INPUT></Body></Envelope>", callback, tag, pri); obj.PerformAjax(resuri + '/' + method + '</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>' + _PutObjToSelectorsXml(selectors) + '</Header><Body><r:' + method + '_INPUT' + ' xmlns:r="' + resuri + '">' + argsxml + '</r:' + method + '_INPUT></Body></Envelope>', callback, tag, pri);
} }
// Perform a WSMAN ENUM operation // Perform a WSMAN ENUM operation
obj.ExecEnum = function (resuri, callback, tag, pri) { obj.ExecEnum = function (resuri, callback, tag, pri) {
obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\" /></Body></Envelope>", callback, tag, pri); obj.PerformAjax('http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>', callback, tag, pri);
//obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT99S</w:OperationTimeout><w:MaxEnvelopeSize mustUnderstand=\"true\">51200</w:MaxEnvelopeSize></Header><Body><Enumerate xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\" /></Body></Envelope>", callback, tag, pri); //obj.PerformAjax('http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT99S</w:OperationTimeout><w:MaxEnvelopeSize mustUnderstand="true">51200</w:MaxEnvelopeSize></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>', callback, tag, pri);
} }
// Perform a WSMAN PULL operation // Perform a WSMAN PULL operation
obj.ExecPull = function (resuri, enumctx, callback, tag, pri) { obj.ExecPull = function (resuri, enumctx, callback, tag, pri) {
obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\"><EnumerationContext>" + enumctx + "</EnumerationContext></Pull></Body></Envelope>", callback, tag, pri); // </EnumerationContext>--<MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters>--</Pull> obj.PerformAjax('http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>' + enumctx + '</EnumerationContext></Pull></Body></Envelope>', callback, tag, pri); // </EnumerationContext>--<MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters>--</Pull>
//obj.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT99S</w:OperationTimeout><w:MaxEnvelopeSize mustUnderstand=\"true\">51200</w:MaxEnvelopeSize></Header><Body><Pull xmlns=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\"><EnumerationContext>" + enumctx + "</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>", callback, tag, pri); // </EnumerationContext>--<MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters>--</Pull> //obj.PerformAjax('http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>' + obj.Address + '</a:To><w:ResourceURI>' + resuri + '</w:ResourceURI><a:MessageID>' + (obj.NextMessageId++) + '</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT99S</w:OperationTimeout><w:MaxEnvelopeSize mustUnderstand="true">51200</w:MaxEnvelopeSize></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>' + enumctx + '</EnumerationContext><MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters></Pull></Body></Envelope>', callback, tag, pri); // </EnumerationContext>--<MaxElements>999</MaxElements><MaxCharacters>99999</MaxCharacters>--</Pull>
} }
// Private method // Private method
obj.ParseWsman = function (xml) { obj.ParseWsman = function (xml) {
try { try {
if (!xml.childNodes) xml = _turnToXml(xml); if (!xml.childNodes) xml = _turnToXml(xml);
var r = { Header:{} }, header = xml.getElementsByTagName("Header")[0], t; var r = { Header: {} }, header = xml.getElementsByTagName('Header')[0], t;
if (!header) header = xml.getElementsByTagName("a:Header")[0]; if (!header) header = xml.getElementsByTagName('a:Header')[0];
if (!header) return null; if (!header) return null;
for (var i = 0; i < header.childNodes.length; i++) { for (var i = 0; i < header.childNodes.length; i++) {
var child = header.childNodes[i]; var child = header.childNodes[i];
r.Header[child.localName] = child.textContent; r.Header[child.localName] = child.textContent;
} }
var body = xml.getElementsByTagName("Body")[0]; var body = xml.getElementsByTagName('Body')[0];
if (!body) body = xml.getElementsByTagName("a:Body")[0]; if (!body) body = xml.getElementsByTagName('a:Body')[0];
if (!body) return null; if (!body) return null;
if (body.childNodes.length > 0) { if (body.childNodes.length > 0) {
t = body.childNodes[0].localName; t = body.childNodes[0].localName;
if (t.indexOf("_OUTPUT") == t.length - 7) { t = t.substring(0, t.length - 7); } if (t.indexOf('_OUTPUT') == t.length - 7) { t = t.substring(0, t.length - 7); }
r.Header['Method'] = t; r.Header['Method'] = t;
r.Body = _ParseWsmanRec(body.childNodes[0]); r.Body = _ParseWsmanRec(body.childNodes[0]);
} }
return r; return r;
} catch (e) { } catch (e) {
console.log("Unable to parse XML: " + xml); console.log('Unable to parse XML: ' + xml);
return null; return null;
} }
} }
@@ -159,7 +159,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue; if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue;
if (putObj[prop] == null || typeof putObj[prop] === 'function') continue; if (putObj[prop] == null || typeof putObj[prop] === 'function') continue;
if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) { if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) {
result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']["ResourceURI"] + '</w:ResourceURI><w:SelectorSet>'; result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']['ResourceURI'] + '</w:ResourceURI><w:SelectorSet>';
var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector']; var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector'];
if (Array.isArray(selectorArray)) { if (Array.isArray(selectorArray)) {
for (var i=0; i< selectorArray.length; i++) { for (var i=0; i< selectorArray.length; i++) {
@@ -205,7 +205,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
function _PutObjToSelectorsXml(selectorSet) { function _PutObjToSelectorsXml(selectorSet) {
if (!selectorSet) return ''; if (!selectorSet) return '';
if (typeof selectorSet == 'string') return selectorSet; if (typeof selectorSet == 'string') return selectorSet;
if (selectorSet['InstanceID']) return "<w:SelectorSet><w:Selector Name=\"InstanceID\">" + selectorSet['InstanceID'] + "</w:Selector></w:SelectorSet>"; if (selectorSet['InstanceID']) return '<w:SelectorSet><w:Selector Name=\"InstanceID\">' + selectorSet['InstanceID'] + '</w:Selector></w:SelectorSet>';
var result = '<w:SelectorSet>'; var result = '<w:SelectorSet>';
for(var propName in selectorSet) { for(var propName in selectorSet) {
if (!selectorSet.hasOwnProperty(propName)) continue; if (!selectorSet.hasOwnProperty(propName)) continue;
@@ -235,17 +235,17 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
function _turnToXml(text) { function _turnToXml(text) {
// ###BEGIN###{!Mode-MeshCentral2} // ###BEGIN###{!Mode-MeshCentral2}
// NodeJS detection // NodeJS detection
var isNode = new Function("try {return this===global;}catch(e){return false;}"); var isNode = new Function('try {return this===global;}catch(e){return false;}');
if (isNode()) { if (isNode()) {
var XDOMParser = require('xmldom').DOMParser; var XDOMParser = require('xmldom').DOMParser;
return new XDOMParser().parseFromString(text, "text/xml"); return new XDOMParser().parseFromString(text, 'text/xml');
} }
// ###END###{!Mode-MeshCentral2} // ###END###{!Mode-MeshCentral2}
if (window.DOMParser) { if (window.DOMParser) {
return new DOMParser().parseFromString(text, "text/xml"); return new DOMParser().parseFromString(text, 'text/xml');
} else { } else {
// Internet Explorer // Internet Explorer
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false; xmlDoc.async = false;
xmlDoc.loadXML(text); xmlDoc.loadXML(text);
return xmlDoc; return xmlDoc;
@@ -254,7 +254,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
/* /*
// This is a drop-in replacement to _turnToXml() that works without xml parser dependency. // This is a drop-in replacement to _turnToXml() that works without xml parser dependency.
Object.defineProperty(Array.prototype, "peek", { value: function () { return (this.length > 0 ? this[this.length - 1] : null); } }); Object.defineProperty(Array.prototype, 'peek', { value: function () { return (this.length > 0 ? this[this.length - 1] : null); } });
function _treeBuilder() { function _treeBuilder() {
this.tree = []; this.tree = [];
this.push = function (element) { this.tree.push(element); }; this.push = function (element) { this.tree.push(element); };
@@ -276,7 +276,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
if ((elementName.length > 0) && (elementName[0] != '?')) { if ((elementName.length > 0) && (elementName[0] != '?')) {
if (elementName[0] != '/') { if (elementName[0] != '/') {
var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0]; var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0];
Object.defineProperty(attributes, "get", Object.defineProperty(attributes, 'get',
{ {
value: function () { value: function () {
if (arguments.length == 1) { if (arguments.length == 1) {

View File

@@ -36,7 +36,7 @@ var CreateWsmanComm = function (url) {
// Private method // Private method
obj.PerformAjaxEx = function (postdata, callback, tag, url, action) { obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
if (obj.FailAllError != 0) { if (obj.FailAllError != 999) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag]); } return; } if (obj.FailAllError != 0) { if (obj.FailAllError != 999) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag]); } return; }
// console.log("SEND: " + postdata); // DEBUG // console.log('SEND: ' + postdata); // DEBUG
// We are in a AJAX browser environment // We are in a AJAX browser environment
obj.ActiveAjaxCount++; obj.ActiveAjaxCount++;
@@ -44,7 +44,7 @@ var CreateWsmanComm = function (url) {
var xdr = null; // TODO: See if we should re-use this object and if we do, when should we do it. var xdr = null; // TODO: See if we should re-use this object and if we do, when should we do it.
try { xdr = new XDomainRequest(); } catch (e) { } try { xdr = new XDomainRequest(); } catch (e) { }
if (!xdr) xdr = new XMLHttpRequest(); if (!xdr) xdr = new XMLHttpRequest();
xdr.open(action ? action : "POST", url ? url : obj.Url); xdr.open(action ? action : 'POST', url ? url : obj.Url);
xdr.timeout = 15000; xdr.timeout = 15000;
xdr.onload = function () { obj.gotNextMessages(xdr.responseText, 'success', xdr, [postdata, callback, tag]); }; xdr.onload = function () { obj.gotNextMessages(xdr.responseText, 'success', xdr, [postdata, callback, tag]); };
xdr.onerror = function () { obj.gotNextMessagesError(xdr, 'error', null, [postdata, callback, tag]); }; xdr.onerror = function () { obj.gotNextMessagesError(xdr, 'error', null, [postdata, callback, tag]); };
@@ -52,7 +52,7 @@ var CreateWsmanComm = function (url) {
//xdr.send(postdata); // Works for text only, no binary. //xdr.send(postdata); // Works for text only, no binary.
// Send POST body, this work with binary. // Send POST body, this work with binary.
if (urlvars && urlvars['wsmantrace']) { console.log("WSMAN-SEND(" + postdata.length + "): " + postdata); } if (urlvars && urlvars['wsmantrace']) { console.log('WSMAN-SEND(' + postdata.length + '): ' + postdata); }
var b = new Uint8Array(postdata.length); var b = new Uint8Array(postdata.length);
for (var i = 0; i < postdata.length; ++i) { b[i] = postdata.charCodeAt(i); } for (var i = 0; i < postdata.length; ++i) { b[i] = postdata.charCodeAt(i); }
xdr.send(b); xdr.send(b);
@@ -65,10 +65,10 @@ var CreateWsmanComm = function (url) {
// Private method // Private method
obj.gotNextMessages = function (data, status, request, callArgs) { obj.gotNextMessages = function (data, status, request, callArgs) {
if (urlvars && urlvars['wsmantrace']) { console.log("WSMAN-RECV(" + data.length + "): " + data); } if (urlvars && urlvars['wsmantrace']) { console.log('WSMAN-RECV(' + data.length + '): ' + data); }
obj.ActiveAjaxCount--; obj.ActiveAjaxCount--;
if (obj.FailAllError == 999) return; if (obj.FailAllError == 999) return;
// console.log("RECV: " + data); // DEBUG // console.log('RECV: ' + data); // DEBUG
if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; } if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; }
if (request.status != 200) { callArgs[1](null, request.status, callArgs[2]); obj.PerformNextAjax(); return; } if (request.status != 200) { callArgs[1](null, request.status, callArgs[2]); obj.PerformNextAjax(); return; }
callArgs[1](data, 200, callArgs[2]); callArgs[1](data, 200, callArgs[2]);
@@ -80,7 +80,7 @@ var CreateWsmanComm = function (url) {
obj.ActiveAjaxCount--; obj.ActiveAjaxCount--;
if (obj.FailAllError == 999) return; if (obj.FailAllError == 999) return;
if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; } if (obj.FailAllError != 0) { callArgs[1](null, obj.FailAllError, callArgs[2]); return; }
// if (s != 200) { console.log("ERROR, status=" + status + "\r\n\r\nreq=" + callArgs[0]); } // Debug: Display the request & response if something did not work. // if (s != 200) { console.log('ERROR, status=' + status + '\r\n\r\nreq=' + callArgs[0]); } // Debug: Display the request & response if something did not work.
if (obj.FailAllError != 999) { callArgs[1]({ Header: { HttpError: request.status } }, request.status, callArgs[2]); } if (obj.FailAllError != 999) { callArgs[1]({ Header: { HttpError: request.status } }, request.status, callArgs[2]); }
obj.PerformNextAjax(); obj.PerformNextAjax();
} }

View File

@@ -74,7 +74,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
obj.PerformAjaxEx = function (postdata, callback, tag, url, action) { obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
if (obj.FailAllError != 0) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag, url, action]); return; } if (obj.FailAllError != 0) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag, url, action]); return; }
if (!postdata) postdata = ''; if (!postdata) postdata = '';
//obj.Debug("SEND: " + postdata); // DEBUG //obj.Debug('SEND: ' + postdata); // DEBUG
obj.ActiveAjaxCount++; obj.ActiveAjaxCount++;
return obj.PerformAjaxExNodeJS(postdata, callback, tag, url, action); return obj.PerformAjaxExNodeJS(postdata, callback, tag, url, action);
@@ -138,7 +138,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
h += 'Host: ' + obj.host + ':' + obj.port + '\r\nContent-Length: ' + postdata.length + '\r\n\r\n' + postdata; // Use Content-Length h += 'Host: ' + obj.host + ':' + obj.port + '\r\nContent-Length: ' + postdata.length + '\r\n\r\n' + postdata; // Use Content-Length
//h += 'Host: ' + obj.host + ':' + obj.port + '\r\nTransfer-Encoding: chunked\r\n\r\n' + postdata.length.toString(16).toUpperCase() + '\r\n' + postdata + '\r\n0\r\n\r\n'; // Use Chunked-Encoding //h += 'Host: ' + obj.host + ':' + obj.port + '\r\nTransfer-Encoding: chunked\r\n\r\n' + postdata.length.toString(16).toUpperCase() + '\r\n' + postdata + '\r\n0\r\n\r\n'; // Use Chunked-Encoding
obj.xxSend(h); obj.xxSend(h);
//console.log("SEND: " + h); // Display send packet //console.log('SEND: ' + h); // Display send packet
} }
// Parse the HTTP digest header and return a list of key & values. // Parse the HTTP digest header and return a list of key & values.
@@ -156,7 +156,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
// NODE.js specific private method // NODE.js specific private method
obj.xxConnectHttpSocket = function () { obj.xxConnectHttpSocket = function () {
//obj.Debug("xxConnectHttpSocket"); //obj.Debug('xxConnectHttpSocket');
obj.socketParseState = 0; obj.socketParseState = 0;
obj.socketAccumulator = ''; obj.socketAccumulator = '';
obj.socketHeader = null; obj.socketHeader = null;
@@ -256,10 +256,10 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
// NODE.js specific private method // NODE.js specific private method
obj.xxOnSocketData = function (data) { obj.xxOnSocketData = function (data) {
obj.xtlsDataReceived = true; obj.xtlsDataReceived = true;
if (urlvars && urlvars['wsmantrace']) { console.log("WSMAN-RECV(" + data.length + "): " + data); } if (urlvars && urlvars['wsmantrace']) { console.log('WSMAN-RECV(' + data.length + '): ' + data); }
if (typeof data === 'object') { if (typeof data === 'object') {
// This is an ArrayBuffer, convert it to a string array (used in IE) // This is an ArrayBuffer, convert it to a string array (used in IE)
var binary = "", bytes = new Uint8Array(data), length = bytes.byteLength; var binary = '', bytes = new Uint8Array(data), length = bytes.byteLength;
for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); }
data = binary; data = binary;
} }
@@ -287,12 +287,12 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
} }
if (obj.socketParseState == 1) { if (obj.socketParseState == 1) {
var csize = -1; var csize = -1;
if ((obj.socketXHeader["connection"] != undefined) && (obj.socketXHeader["connection"].toLowerCase() == 'close') && ((obj.socketXHeader["transfer-encoding"] == undefined) || (obj.socketXHeader["transfer-encoding"].toLowerCase() != 'chunked'))) { if ((obj.socketXHeader['connection'] != undefined) && (obj.socketXHeader['connection'].toLowerCase() == 'close') && ((obj.socketXHeader['transfer-encoding'] == undefined) || (obj.socketXHeader['transfer-encoding'].toLowerCase() != 'chunked'))) {
// The body ends with a close, in this case, we will only process the header // The body ends with a close, in this case, we will only process the header
csize = 0; csize = 0;
} else if (obj.socketXHeader["content-length"] != undefined) { } else if (obj.socketXHeader['content-length'] != undefined) {
// The body length is specified by the content-length // The body length is specified by the content-length
csize = parseInt(obj.socketXHeader["content-length"]); csize = parseInt(obj.socketXHeader['content-length']);
if (obj.socketAccumulator.length < csize) return; if (obj.socketAccumulator.length < csize) return;
var data = obj.socketAccumulator.substring(0, csize); var data = obj.socketAccumulator.substring(0, csize);
obj.socketAccumulator = obj.socketAccumulator.substring(csize); obj.socketAccumulator = obj.socketAccumulator.substring(csize);
@@ -300,7 +300,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
csize = 0; csize = 0;
} else { } else {
// The body is chunked // The body is chunked
var clen = obj.socketAccumulator.indexOf("\r\n"); var clen = obj.socketAccumulator.indexOf('\r\n');
if (clen < 0) return; // Chunk length not found, exit now and get more data. if (clen < 0) return; // Chunk length not found, exit now and get more data.
// Chunk length if found, lets see if we can get the data. // Chunk length if found, lets see if we can get the data.
csize = parseInt(obj.socketAccumulator.substring(0, clen), 16); csize = parseInt(obj.socketAccumulator.substring(0, clen), 16);
@@ -311,7 +311,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
obj.socketData += data; obj.socketData += data;
} }
if (csize == 0) { if (csize == 0) {
//obj.Debug("xxOnSocketData DONE: (" + obj.socketData.length + "): " + obj.socketData); //obj.Debug('xxOnSocketData DONE: (' + obj.socketData.length + '): ' + obj.socketData);
obj.xxProcessHttpResponse(obj.socketXHeader, obj.socketData); obj.xxProcessHttpResponse(obj.socketXHeader, obj.socketData);
obj.socketParseState = 0; obj.socketParseState = 0;
obj.socketHeader = null; obj.socketHeader = null;
@@ -322,7 +322,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
// NODE.js specific private method // NODE.js specific private method
obj.xxProcessHttpResponse = function (header, data) { obj.xxProcessHttpResponse = function (header, data) {
//obj.Debug("xxProcessHttpResponse: " + header.Directive[1]); //obj.Debug('xxProcessHttpResponse: ' + header.Directive[1]);
var s = parseInt(header.Directive[1]); var s = parseInt(header.Directive[1]);
if (isNaN(s)) s = 500; if (isNaN(s)) s = 500;
@@ -336,8 +336,8 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
obj.socket.end(); obj.socket.end();
} else { } else {
var r = obj.pendingAjaxCall.shift(); var r = obj.pendingAjaxCall.shift();
if (r == null || r.length < 1) { console.log("pendingAjaxCall error, " + r); return; } if (r == null || r.length < 1) { console.log('pendingAjaxCall error, ' + r); return; }
//if (s != 200) { obj.Debug("Error, status=" + s + "\r\n\r\nreq=" + r[0] + "\r\n\r\nresp=" + data); } // Debug: Display the request & response if something did not work. //if (s != 200) { obj.Debug('Error, status=' + s + '\r\n\r\nreq=' + r[0] + '\r\n\r\nresp=' + data); } // Debug: Display the request & response if something did not work.
obj.authcounter = 0; obj.authcounter = 0;
obj.ActiveAjaxCount--; obj.ActiveAjaxCount--;
obj.gotNextMessages(data, 'success', { status: s }, r); obj.gotNextMessages(data, 'success', { status: s }, r);
@@ -347,7 +347,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
// NODE.js specific private method // NODE.js specific private method
obj.xxOnSocketClosed = function (data) { obj.xxOnSocketClosed = function (data) {
//obj.Debug("xxOnSocketClosed"); //obj.Debug('xxOnSocketClosed');
obj.socketState = 0; obj.socketState = 0;
if (obj.socket != null) { obj.socket.destroy(); obj.socket = null; } if (obj.socket != null) { obj.socket.destroy(); obj.socket = null; }
if (obj.pendingAjaxCall.length > 0) { if (obj.pendingAjaxCall.length > 0) {
@@ -360,7 +360,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) {
// NODE.js specific private method // NODE.js specific private method
obj.xxSend = function (x) { obj.xxSend = function (x) {
if (obj.socketState == 2) { if (obj.socketState == 2) {
if (urlvars && urlvars['wsmantrace']) { console.log("WSMAN-SEND(" + x.length + "): " + x); } if (urlvars && urlvars['wsmantrace']) { console.log('WSMAN-SEND(' + x.length + '): ' + x); }
obj.socket.write(new Buffer(x, 'binary')); obj.socket.write(new Buffer(x, 'binary'));
} }
} }

View File

@@ -56,8 +56,8 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Private method // Private method
obj.PerformAjaxEx = function (postdata, callback, tag, url, action) { obj.PerformAjaxEx = function (postdata, callback, tag, url, action) {
if (obj.FailAllError != 0) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag, url, action]); return; } if (obj.FailAllError != 0) { obj.gotNextMessagesError({ status: obj.FailAllError }, 'error', null, [postdata, callback, tag, url, action]); return; }
if (!postdata) postdata = ""; if (!postdata) postdata = '';
//console.log("SEND: " + postdata); // DEBUG //console.log('SEND: ' + postdata); // DEBUG
// We are in a websocket relay environment // We are in a websocket relay environment
obj.ActiveAjaxCount++; obj.ActiveAjaxCount++;
@@ -87,11 +87,11 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Websocket relay specific private method (Content Length Encoding) // Websocket relay specific private method (Content Length Encoding)
obj.sendRequest = function (postdata, url, action) { obj.sendRequest = function (postdata, url, action) {
url = url ? url : "/wsman"; url = url ? url : '/wsman';
action = action ? action : "POST"; action = action ? action : 'POST';
var h = action + " " + url + " HTTP/1.1\r\n"; var h = action + ' ' + url + ' HTTP/1.1\r\n';
if (obj.challengeParams != null) { if (obj.challengeParams != null) {
obj.digestRealm = obj.challengeParams["realm"]; obj.digestRealm = obj.challengeParams['realm'];
if (obj.digestRealmMatch && (obj.digestRealm != obj.digestRealmMatch)) { if (obj.digestRealmMatch && (obj.digestRealm != obj.digestRealmMatch)) {
obj.FailAllError = 997; // Cause all new responses to be silent. 997 = Digest Realm check error obj.FailAllError = 997; // Cause all new responses to be silent. 997 = Digest Realm check error
obj.CancelAllQueries(997); obj.CancelAllQueries(997);
@@ -120,10 +120,10 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Websocket relay specific private method // Websocket relay specific private method
obj.xxConnectHttpSocket = function () { obj.xxConnectHttpSocket = function () {
//obj.Debug("xxConnectHttpSocket"); //obj.Debug('xxConnectHttpSocket');
obj.inDataCount = 0; obj.inDataCount = 0;
obj.socketState = 1; obj.socketState = 1;
obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=1&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + "&tls1only=" + obj.tlsv1only + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=1" indicates to the relay that this is a WSMAN session obj.socket = new WebSocket(window.location.protocol.replace('http', 'ws') + '//' + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + '/webrelay.ashx?p=1&host=' + obj.host + '&port=' + obj.port + '&tls=' + obj.tls + '&tls1only=' + obj.tlsv1only + ((user == '*') ? '&serverauth=1' : '') + ((typeof pass === 'undefined') ? ('&serverauth=1&user=' + user) : '')); // The 'p=1' indicates to the relay that this is a WSMAN session
obj.socket.binaryType = 'arraybuffer'; obj.socket.binaryType = 'arraybuffer';
obj.socket.onopen = _OnSocketConnected; obj.socket.onopen = _OnSocketConnected;
obj.socket.onmessage = _OnMessage; obj.socket.onmessage = _OnMessage;
@@ -137,26 +137,26 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
obj.socketAccumulator = ''; obj.socketAccumulator = '';
obj.socketHeader = null; obj.socketHeader = null;
obj.socketData = ''; obj.socketData = '';
//console.log("xxOnSocketConnected"); //console.log('xxOnSocketConnected');
for (i in obj.pendingAjaxCall) { obj.sendRequest(obj.pendingAjaxCall[i][0], obj.pendingAjaxCall[i][3], obj.pendingAjaxCall[i][4]); } for (i in obj.pendingAjaxCall) { obj.sendRequest(obj.pendingAjaxCall[i][0], obj.pendingAjaxCall[i][3], obj.pendingAjaxCall[i][4]); }
} }
// Websocket relay specific private method // Websocket relay specific private method
function _OnMessage(e) { function _OnMessage(e) {
//obj.Debug("_OnSocketData (" + data.byteLength + "): " + data); //obj.Debug('_OnSocketData (' + data.byteLength + '): ' + data);
obj.socketAccumulator += arrToStr(new Uint8Array(e.data)); obj.socketAccumulator += arrToStr(new Uint8Array(e.data));
while (true) { while (true) {
if (obj.socketParseState == 0) { if (obj.socketParseState == 0) {
var headersize = obj.socketAccumulator.indexOf("\r\n\r\n"); var headersize = obj.socketAccumulator.indexOf('\r\n\r\n');
if (headersize < 0) return; if (headersize < 0) return;
//obj.Debug(obj.socketAccumulator.substring(0, headersize)); // Display received HTTP header //obj.Debug(obj.socketAccumulator.substring(0, headersize)); // Display received HTTP header
obj.socketHeader = obj.socketAccumulator.substring(0, headersize).split("\r\n"); obj.socketHeader = obj.socketAccumulator.substring(0, headersize).split('\r\n');
if (obj.amtVersion == null) { for (var i in obj.socketHeader) { if (obj.socketHeader[i].indexOf('Server: Intel(R) Active Management Technology ') == 0) { obj.amtVersion = obj.socketHeader[i].substring(46); } } } if (obj.amtVersion == null) { for (var i in obj.socketHeader) { if (obj.socketHeader[i].indexOf('Server: Intel(R) Active Management Technology ') == 0) { obj.amtVersion = obj.socketHeader[i].substring(46); } } }
obj.socketAccumulator = obj.socketAccumulator.substring(headersize + 4); obj.socketAccumulator = obj.socketAccumulator.substring(headersize + 4);
obj.socketParseState = 1; obj.socketParseState = 1;
obj.socketData = ''; obj.socketData = '';
obj.socketXHeader = { Directive: obj.socketHeader[0].split(' ') }; obj.socketXHeader = { Directive: obj.socketHeader[0].split(' ') };
//console.log("Header", obj.socketXHeader); //console.log('Header', obj.socketXHeader);
for (i in obj.socketHeader) { for (i in obj.socketHeader) {
if (i != 0) { if (i != 0) {
var x2 = obj.socketHeader[i].indexOf(':'); var x2 = obj.socketHeader[i].indexOf(':');
@@ -166,7 +166,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
} }
if (obj.socketParseState == 1) { if (obj.socketParseState == 1) {
var csize = -1; var csize = -1;
if ((obj.socketXHeader['connection'] != undefined) && (obj.socketXHeader['connection'].toLowerCase() == 'close') && ((obj.socketXHeader["transfer-encoding"] == undefined) || (obj.socketXHeader["transfer-encoding"].toLowerCase() != 'chunked'))) { if ((obj.socketXHeader['connection'] != undefined) && (obj.socketXHeader['connection'].toLowerCase() == 'close') && ((obj.socketXHeader['transfer-encoding'] == undefined) || (obj.socketXHeader['transfer-encoding'].toLowerCase() != 'chunked'))) {
// The body ends with a close, in this case, we will only process the header // The body ends with a close, in this case, we will only process the header
csize = 0; csize = 0;
} else if (obj.socketXHeader['content-length'] != undefined) { } else if (obj.socketXHeader['content-length'] != undefined) {
@@ -191,7 +191,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
obj.socketData += data; obj.socketData += data;
} }
if (csize == 0) { if (csize == 0) {
//obj.Debug("_OnSocketData DONE: (" + obj.socketData.length + "): " + obj.socketData); //obj.Debug('_OnSocketData DONE: (' + obj.socketData.length + '): ' + obj.socketData);
_ProcessHttpResponse(obj.socketXHeader, obj.socketData); _ProcessHttpResponse(obj.socketXHeader, obj.socketData);
obj.socketParseState = 0; obj.socketParseState = 0;
obj.socketHeader = null; obj.socketHeader = null;
@@ -202,7 +202,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Websocket relay specific private method // Websocket relay specific private method
function _ProcessHttpResponse(header, data) { function _ProcessHttpResponse(header, data) {
//obj.Debug("_ProcessHttpResponse: " + header.Directive[1]); //obj.Debug('_ProcessHttpResponse: ' + header.Directive[1]);
var s = parseInt(header.Directive[1]); var s = parseInt(header.Directive[1]);
if (isNaN(s)) { if (isNaN(s)) {
@@ -217,7 +217,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
} }
} else { } else {
var r = obj.pendingAjaxCall.shift(); var r = obj.pendingAjaxCall.shift();
// if (s != 200) { obj.Debug("Error, status=" + s + "\r\n\r\nreq=" + r[0] + "\r\n\r\nresp=" + data); } // Debug: Display the request & response if something did not work. // if (s != 200) { obj.Debug('Error, status=' + s + '\r\n\r\nreq=' + r[0] + '\r\n\r\nresp=' + data); } // Debug: Display the request & response if something did not work.
obj.authcounter = 0; obj.authcounter = 0;
obj.ActiveAjaxCount--; obj.ActiveAjaxCount--;
obj.gotNextMessages(data, 'success', { status: s }, r); obj.gotNextMessages(data, 'success', { status: s }, r);
@@ -227,7 +227,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Websocket relay specific private method // Websocket relay specific private method
function _OnSocketClosed(data) { function _OnSocketClosed(data) {
//console.log("_OnSocketClosed"); //console.log('_OnSocketClosed');
if (obj.inDataCount == 0) { obj.tlsv1only = (1 - obj.tlsv1only); } if (obj.inDataCount == 0) { obj.tlsv1only = (1 - obj.tlsv1only); }
obj.socketState = 0; obj.socketState = 0;
if (obj.socket != null) { obj.socket.close(); obj.socket = null; } if (obj.socket != null) { obj.socket.close(); obj.socket = null; }
@@ -240,7 +240,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
// Websocket relay specific private method // Websocket relay specific private method
function _Send(x) { function _Send(x) {
//console.log("SEND: " + x); // DEBUG //console.log('SEND: ' + x); // DEBUG
if (obj.socketState == 2 && obj.socket != null && obj.socket.readyState == WebSocket.OPEN) { if (obj.socketState == 2 && obj.socket != null && obj.socket.readyState == WebSocket.OPEN) {
var b = new Uint8Array(x.length); var b = new Uint8Array(x.length);
for (var i = 0; i < x.length; ++i) { b[i] = x.charCodeAt(i); } for (var i = 0; i < x.length; ++i) { b[i] = x.charCodeAt(i); }

View File

@@ -33,7 +33,8 @@ function IntToStrX(v) { return String.fromCharCode(v & 0xFF, (v >> 8) & 0xFF, (v
function MakeToArray(v) { if (!v || v == null || typeof v == 'object') return v; return [v]; } function MakeToArray(v) { if (!v || v == null || typeof v == 'object') return v; return [v]; }
function SplitArray(v) { return v.split(','); } function SplitArray(v) { return v.split(','); }
function Clone(v) { return JSON.parse(JSON.stringify(v)); } function Clone(v) { return JSON.parse(JSON.stringify(v)); }
function EscapeHtml(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; } function EscapeHtml(x) { if (typeof x == 'string') return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;'); if (typeof x == 'boolean') return x; if (typeof x == 'number') return x; }
function NoBreak(v) { return v.split(' ').join('&nbsp;'); }
// Move an element from one position in an array to a new position // Move an element from one position in an array to a new position
function ArrayElementMove(arr, from, to) { arr.splice(to, 0, arr.splice(from, 1)[0]); }; function ArrayElementMove(arr, from, to) { arr.splice(to, 0, arr.splice(from, 1)[0]); };
@@ -42,8 +43,8 @@ function ArrayElementMove(arr, from, to) { arr.splice(to, 0, arr.splice(from, 1)
function ObjectToStringEx(x, c) { function ObjectToStringEx(x, c) {
var r = ""; var r = "";
if (x != 0 && (!x || x == null)) return "(Null)"; if (x != 0 && (!x || x == null)) return "(Null)";
if (x instanceof Array) { for (var i in x) { r += '<br />' + gap(c) + "Item #" + i + ": " + ObjectToStringEx(x[i], c + 1); } } if (x instanceof Array) { for (var i in x) { r += '<br />' + gap(c) + "Item #" + i + ': ' + ObjectToStringEx(x[i], c + 1); } }
else if (x instanceof Object) { for (var i in x) { r += '<br />' + gap(c) + i + " = " + ObjectToStringEx(x[i], c + 1); } } else if (x instanceof Object) { for (var i in x) { r += '<br />' + gap(c) + i + ' = ' + ObjectToStringEx(x[i], c + 1); } }
else { r += EscapeHtml(x); } else { r += EscapeHtml(x); }
return r; return r;
} }
@@ -52,8 +53,8 @@ function ObjectToStringEx(x, c) {
function ObjectToStringEx2(x, c) { function ObjectToStringEx2(x, c) {
var r = ""; var r = "";
if (x != 0 && (!x || x == null)) return "(Null)"; if (x != 0 && (!x || x == null)) return "(Null)";
if (x instanceof Array) { for (var i in x) { r += '\r\n' + gap2(c) + "Item #" + i + ": " + ObjectToStringEx2(x[i], c + 1); } } if (x instanceof Array) { for (var i in x) { r += '\r\n' + gap2(c) + "Item #" + i + ': ' + ObjectToStringEx2(x[i], c + 1); } }
else if (x instanceof Object) { for (var i in x) { r += '\r\n' + gap2(c) + i + " = " + ObjectToStringEx2(x[i], c + 1); } } else if (x instanceof Object) { for (var i in x) { r += '\r\n' + gap2(c) + i + ' = ' + ObjectToStringEx2(x[i], c + 1); } }
else { r += EscapeHtml(x); } else { r += EscapeHtml(x); }
return r; return r;
} }
@@ -68,7 +69,7 @@ function ObjectToString2(x) { return ObjectToStringEx2(x, 0); }
// Convert a hex string to a raw string // Convert a hex string to a raw string
function hex2rstr(d) { function hex2rstr(d) {
if (typeof d != "string" || d.length == 0) return ''; if (typeof d != 'string' || d.length == 0) return '';
var r = '', m = ('' + d).match(/../g), t; var r = '', m = ('' + d).match(/../g), t;
while (t = m.shift()) r += String.fromCharCode('0x' + t); while (t = m.shift()) r += String.fromCharCode('0x' + t);
return r return r

View File

@@ -13,9 +13,9 @@
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
var saveAs = saveAs || (function (view) { var saveAs = saveAs || (function (view) {
"use strict"; 'use strict';
// IE <10 is explicitly unsupported // IE <10 is explicitly unsupported
if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) { if (typeof navigator !== 'undefined' && /MSIE [1-9]\./.test(navigator.userAgent)) {
return; return;
} }
var var
@@ -24,10 +24,10 @@ var saveAs = saveAs || (function (view) {
, get_URL = function () { , get_URL = function () {
return view.URL || view.webkitURL || view; return view.URL || view.webkitURL || view;
} }
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") , save_link = doc.createElementNS('http://www.w3.org/1999/xhtml', 'a')
, can_use_save_link = "download" in save_link , can_use_save_link = 'download' in save_link
, click = function (node) { , click = function (node) {
var event = new MouseEvent("click"); var event = new MouseEvent('click');
node.dispatchEvent(event); node.dispatchEvent(event);
} }
, is_safari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent) , is_safari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent)
@@ -38,7 +38,7 @@ var saveAs = saveAs || (function (view) {
throw ex; throw ex;
}, 0); }, 0);
} }
, force_saveable_type = "application/octet-stream" , force_saveable_type = 'application/octet-stream'
, fs_min_size = 0 , fs_min_size = 0
// See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and // See https://code.google.com/p/chromium/issues/detail?id=375297#c7 and
// https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047 // https://github.com/eligrey/FileSaver.js/commit/485930a#commitcomment-8768047
@@ -46,7 +46,7 @@ var saveAs = saveAs || (function (view) {
, arbitrary_revoke_timeout = 500 // in ms , arbitrary_revoke_timeout = 500 // in ms
, revoke = function (file) { , revoke = function (file) {
var revoker = function () { var revoker = function () {
if (typeof file === "string") { // file is an object URL if (typeof file === 'string') { // file is an object URL
get_URL().revokeObjectURL(file); get_URL().revokeObjectURL(file);
} else { // file is a File } else { // file is a File
file.remove(); file.remove();
@@ -62,8 +62,8 @@ var saveAs = saveAs || (function (view) {
event_types = [].concat(event_types); event_types = [].concat(event_types);
var i = event_types.length; var i = event_types.length;
while (i--) { while (i--) {
var listener = filesaver["on" + event_types[i]]; var listener = filesaver['on' + event_types[i]];
if (typeof listener === "function") { if (typeof listener === 'function') {
try { try {
listener.call(filesaver, event || filesaver); listener.call(filesaver, event || filesaver);
} catch (ex) { } catch (ex) {
@@ -75,7 +75,7 @@ var saveAs = saveAs || (function (view) {
, auto_bom = function (blob) { , auto_bom = function (blob) {
// prepend BOM for UTF-8 XML and text types (including HTML) // prepend BOM for UTF-8 XML and text types (including HTML)
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
return new Blob(["\ufeff", blob], { type: blob.type }); return new Blob(['\ufeff', blob], { type: blob.type });
} }
return blob; return blob;
} }
@@ -91,16 +91,16 @@ var saveAs = saveAs || (function (view) {
, object_url , object_url
, target_view , target_view
, dispatch_all = function () { , dispatch_all = function () {
dispatch(filesaver, "writestart progress write writeend".split(" ")); dispatch(filesaver, 'writestart progress write writeend'.split(' '));
} }
// on any filesys errors revert to saving with object URLs // on any filesys errors revert to saving with object URLs
, fs_error = function () { , fs_error = function () {
if (target_view && is_safari && typeof FileReader !== "undefined") { if (target_view && is_safari && typeof FileReader !== 'undefined') {
// Safari doesn't allow downloading of blob urls // Safari doesn't allow downloading of blob urls
var reader = new FileReader(); var reader = new FileReader();
reader.onloadend = function () { reader.onloadend = function () {
var base64Data = reader.result; var base64Data = reader.result;
target_view.location.href = "data:attachment/file" + base64Data.slice(base64Data.search(/[,;]/)); target_view.location.href = 'data:attachment/file' + base64Data.slice(base64Data.search(/[,;]/));
filesaver.readyState = filesaver.DONE; filesaver.readyState = filesaver.DONE;
dispatch_all(); dispatch_all();
}; };
@@ -115,7 +115,7 @@ var saveAs = saveAs || (function (view) {
if (target_view) { if (target_view) {
target_view.location.href = object_url; target_view.location.href = object_url;
} else { } else {
var new_tab = view.open(object_url, "_blank"); var new_tab = view.open(object_url, '_blank');
if (new_tab == undefined && is_safari) { if (new_tab == undefined && is_safari) {
//Apple do not allow window.open, see http://bit.ly/1kZffRI //Apple do not allow window.open, see http://bit.ly/1kZffRI
view.location.href = object_url view.location.href = object_url
@@ -137,7 +137,7 @@ var saveAs = saveAs || (function (view) {
; ;
filesaver.readyState = filesaver.INIT; filesaver.readyState = filesaver.INIT;
if (!name) { if (!name) {
name = "download"; name = 'download';
} }
if (can_use_save_link) { if (can_use_save_link) {
object_url = get_URL().createObjectURL(blob); object_url = get_URL().createObjectURL(blob);
@@ -164,8 +164,8 @@ var saveAs = saveAs || (function (view) {
// Since I can't be sure that the guessed media type will trigger a download // Since I can't be sure that the guessed media type will trigger a download
// in WebKit, I append .download to the filename. // in WebKit, I append .download to the filename.
// https://bugs.webkit.org/show_bug.cgi?id=65440 // https://bugs.webkit.org/show_bug.cgi?id=65440
if (webkit_req_fs && name !== "download") { if (webkit_req_fs && name !== 'download') {
name += ".download"; name += '.download';
} }
if (type === force_saveable_type || webkit_req_fs) { if (type === force_saveable_type || webkit_req_fs) {
target_view = view; target_view = view;
@@ -176,14 +176,14 @@ var saveAs = saveAs || (function (view) {
} }
fs_min_size += blob.size; fs_min_size += blob.size;
req_fs(view.TEMPORARY, fs_min_size, abortable(function (fs) { req_fs(view.TEMPORARY, fs_min_size, abortable(function (fs) {
fs.root.getDirectory("saved", create_if_not_found, abortable(function (dir) { fs.root.getDirectory('saved', create_if_not_found, abortable(function (dir) {
var save = function () { var save = function () {
dir.getFile(name, create_if_not_found, abortable(function (file) { dir.getFile(name, create_if_not_found, abortable(function (file) {
file.createWriter(abortable(function (writer) { file.createWriter(abortable(function (writer) {
writer.onwriteend = function (event) { writer.onwriteend = function (event) {
target_view.location.href = file.toURL(); target_view.location.href = file.toURL();
filesaver.readyState = filesaver.DONE; filesaver.readyState = filesaver.DONE;
dispatch(filesaver, "writeend", event); dispatch(filesaver, 'writeend', event);
revoke(file); revoke(file);
}; };
writer.onerror = function () { writer.onerror = function () {
@@ -192,8 +192,8 @@ var saveAs = saveAs || (function (view) {
fs_error(); fs_error();
} }
}; };
"writestart progress write abort".split(" ").forEach(function (event) { 'writestart progress write abort'.split(' ').forEach(function (event) {
writer["on" + event] = filesaver["on" + event]; writer['on' + event] = filesaver['on' + event];
}); });
writer.write(blob); writer.write(blob);
filesaver.abort = function () { filesaver.abort = function () {
@@ -224,19 +224,19 @@ var saveAs = saveAs || (function (view) {
} }
; ;
// IE 10+ (native saveAs) // IE 10+ (native saveAs)
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { if (typeof navigator !== 'undefined' && navigator.msSaveOrOpenBlob) {
return function (blob, name, no_auto_bom) { return function (blob, name, no_auto_bom) {
if (!no_auto_bom) { if (!no_auto_bom) {
blob = auto_bom(blob); blob = auto_bom(blob);
} }
return navigator.msSaveOrOpenBlob(blob, name || "download"); return navigator.msSaveOrOpenBlob(blob, name || 'download');
}; };
} }
FS_proto.abort = function () { FS_proto.abort = function () {
var filesaver = this; var filesaver = this;
filesaver.readyState = filesaver.DONE; filesaver.readyState = filesaver.DONE;
dispatch(filesaver, "abort"); dispatch(filesaver, 'abort');
}; };
FS_proto.readyState = FS_proto.INIT = 0; FS_proto.readyState = FS_proto.INIT = 0;
FS_proto.WRITING = 1; FS_proto.WRITING = 1;
@@ -253,17 +253,17 @@ var saveAs = saveAs || (function (view) {
return saveAs; return saveAs;
}( }(
typeof self !== "undefined" && self typeof self !== 'undefined' && self
|| typeof window !== "undefined" && window || typeof window !== 'undefined' && window
|| this.content || this.content
)); ));
// `self` is undefined in Firefox for Android content script context // `self` is undefined in Firefox for Android content script context
// while `this` is nsIContentFrameMessageManager // while `this` is nsIContentFrameMessageManager
// with an attribute `content` that corresponds to the window // with an attribute `content` that corresponds to the window
if (typeof module !== "undefined" && module.exports) { if (typeof module !== 'undefined' && module.exports) {
module.exports.saveAs = saveAs; module.exports.saveAs = saveAs;
} else if ((typeof define !== "undefined" && define !== null) && (define.amd != null)) { } else if ((typeof define !== 'undefined' && define !== null) && (define.amd != null)) {
define([], function () { define([], function () {
return saveAs; return saveAs;
}); });

View File

@@ -41,12 +41,12 @@ var requirejs, require, define;
function normalize(name, baseName) { function normalize(name, baseName) {
var nameParts, nameSegment, mapValue, foundMap, lastIndex, var nameParts, nameSegment, mapValue, foundMap, lastIndex,
foundI, foundStarMap, starI, i, j, part, foundI, foundStarMap, starI, i, j, part,
baseParts = baseName && baseName.split("/"), baseParts = baseName && baseName.split('/'),
map = config.map, map = config.map,
starMap = (map && map['*']) || {}; starMap = (map && map['*']) || {};
//Adjust any relative paths. //Adjust any relative paths.
if (name && name.charAt(0) === ".") { if (name && name.charAt(0) === '.') {
//If have a base name, try to normalize against it, //If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will //otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end. //be relative to baseUrl in the end.
@@ -70,10 +70,10 @@ var requirejs, require, define;
//start trimDots //start trimDots
for (i = 0; i < name.length; i += 1) { for (i = 0; i < name.length; i += 1) {
part = name[i]; part = name[i];
if (part === ".") { if (part === '.') {
name.splice(i, 1); name.splice(i, 1);
i -= 1; i -= 1;
} else if (part === "..") { } else if (part === '..') {
if (i === 1 && (name[2] === '..' || name[0] === '..')) { if (i === 1 && (name[2] === '..' || name[0] === '..')) {
//End of the line. Keep at least one non-dot //End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped //path segment at the front so it can be mapped
@@ -90,7 +90,7 @@ var requirejs, require, define;
} }
//end trimDots //end trimDots
name = name.join("/"); name = name.join('/');
} else if (name.indexOf('./') === 0) { } else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative // No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot. // to baseUrl, pull off the leading dot.
@@ -103,7 +103,7 @@ var requirejs, require, define;
nameParts = name.split('/'); nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) { for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join("/"); nameSegment = nameParts.slice(0, i).join('/');
if (baseParts) { if (baseParts) {
//Find the longest baseName segment match in the config. //Find the longest baseName segment match in the config.
@@ -291,13 +291,13 @@ var requirejs, require, define;
depName = map.f; depName = map.f;
//Fast path CommonJS standard dependencies. //Fast path CommonJS standard dependencies.
if (depName === "require") { if (depName === 'require') {
args[i] = handlers.require(name); args[i] = handlers.require(name);
} else if (depName === "exports") { } else if (depName === 'exports') {
//CommonJS module spec 1.1 //CommonJS module spec 1.1
args[i] = handlers.exports(name); args[i] = handlers.exports(name);
usingExports = true; usingExports = true;
} else if (depName === "module") { } else if (depName === 'module') {
//CommonJS module spec 1.1 //CommonJS module spec 1.1
cjsModule = args[i] = handlers.module(name); cjsModule = args[i] = handlers.module(name);
} else if (hasProp(defined, depName) || } else if (hasProp(defined, depName) ||
@@ -334,7 +334,7 @@ var requirejs, require, define;
}; };
requirejs = require = req = function (deps, callback, relName, forceSync, alt) { requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
if (typeof deps === "string") { if (typeof deps === 'string') {
if (handlers[deps]) { if (handlers[deps]) {
//callback in this case is really relName //callback in this case is really relName
return handlers[deps](callback); return handlers[deps](callback);
@@ -427,7 +427,7 @@ var requirejs, require, define;
}; };
}()); }());
define("node_modules/almond/almond", function(){}); define('node_modules/almond/almond', function(){});
/** /**
* Utility functions for web applications. * Utility functions for web applications.
@@ -11645,8 +11645,8 @@ var j_lm = ((canary&0xffffff)==0xefcafe);
function BigInteger(a,b,c) { function BigInteger(a,b,c) {
this.data = []; this.data = [];
if(a != null) if(a != null)
if("number" == typeof a) this.fromNumber(a,b,c); if('number' == typeof a) this.fromNumber(a,b,c);
else if(b == null && "string" != typeof a) this.fromString(a,256); else if(b == null && 'string' != typeof a) this.fromString(a,256);
else this.fromString(a,b); else this.fromString(a,b);
} }
@@ -11704,10 +11704,10 @@ if(typeof(navigator) === 'undefined')
{ {
BigInteger.prototype.am = am3; BigInteger.prototype.am = am3;
dbits = 28; dbits = 28;
} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { } else if(j_lm && (navigator.appName == 'Microsoft Internet Explorer')) {
BigInteger.prototype.am = am2; BigInteger.prototype.am = am2;
dbits = 30; dbits = 30;
} else if(j_lm && (navigator.appName != "Netscape")) { } else if(j_lm && (navigator.appName != 'Netscape')) {
BigInteger.prototype.am = am1; BigInteger.prototype.am = am1;
dbits = 26; dbits = 26;
} else { // Mozilla/Netscape seems to prefer am3 } else { // Mozilla/Netscape seems to prefer am3
@@ -11725,14 +11725,14 @@ BigInteger.prototype.F1 = BI_FP-dbits;
BigInteger.prototype.F2 = 2*dbits-BI_FP; BigInteger.prototype.F2 = 2*dbits-BI_FP;
// Digit conversions // Digit conversions
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; var BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';
var BI_RC = new Array(); var BI_RC = new Array();
var rr,vv; var rr,vv;
rr = "0".charCodeAt(0); rr = '0'.charCodeAt(0);
for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
rr = "a".charCodeAt(0); rr = 'a'.charCodeAt(0);
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
rr = "A".charCodeAt(0); rr = 'A'.charCodeAt(0);
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
function int2char(n) { return BI_RM.charAt(n); } function int2char(n) { return BI_RM.charAt(n); }
@@ -11776,7 +11776,7 @@ function bnpFromString(s,b) {
while(--i >= 0) { while(--i >= 0) {
var x = (k==8)?s[i]&0xff:intAt(s,i); var x = (k==8)?s[i]&0xff:intAt(s,i);
if(x < 0) { if(x < 0) {
if(s.charAt(i) == "-") mi = true; if(s.charAt(i) == '-') mi = true;
continue; continue;
} }
mi = false; mi = false;
@@ -11806,7 +11806,7 @@ function bnpClamp() {
// (public) return string representation in given radix // (public) return string representation in given radix
function bnToString(b) { function bnToString(b) {
if(this.s < 0) return "-"+this.negate().toString(b); if(this.s < 0) return '-'+this.negate().toString(b);
var k; var k;
if(b == 16) k = 4; if(b == 16) k = 4;
else if(b == 8) k = 3; else if(b == 8) k = 3;
@@ -11814,7 +11814,7 @@ function bnToString(b) {
else if(b == 32) k = 5; else if(b == 32) k = 5;
else if(b == 4) k = 2; else if(b == 4) k = 2;
else return this.toRadix(b); else return this.toRadix(b);
var km = (1<<k)-1, d, m = false, r = "", i = this.t; var km = (1<<k)-1, d, m = false, r = '', i = this.t;
var p = this.DB-(i*this.DB)%k; var p = this.DB-(i*this.DB)%k;
if(i-- > 0) { if(i-- > 0) {
if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); } if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }
@@ -11830,7 +11830,7 @@ function bnToString(b) {
if(m) r += int2char(d); if(m) r += int2char(d);
} }
} }
return m?r:"0"; return m?r:'0';
} }
// (public) -this // (public) -this
@@ -12232,10 +12232,10 @@ else return 1;
//(protected) convert to radix string //(protected) convert to radix string
function bnpToRadix(b) { function bnpToRadix(b) {
if(b == null) b = 10; if(b == null) b = 10;
if(this.signum() == 0 || b < 2 || b > 36) return "0"; if(this.signum() == 0 || b < 2 || b > 36) return '0';
var cs = this.chunkSize(b); var cs = this.chunkSize(b);
var a = Math.pow(b,cs); var a = Math.pow(b,cs);
var d = nbv(a), y = nbi(), z = nbi(), r = ""; var d = nbv(a), y = nbi(), z = nbi(), r = '';
this.divRemTo(d,y,z); this.divRemTo(d,y,z);
while(y.signum() > 0) { while(y.signum() > 0) {
r = (a+z.intValue()).toString(b).substr(1) + r; r = (a+z.intValue()).toString(b).substr(1) + r;
@@ -12253,7 +12253,7 @@ var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
for(var i = 0; i < s.length; ++i) { for(var i = 0; i < s.length; ++i) {
var x = intAt(s,i); var x = intAt(s,i);
if(x < 0) { if(x < 0) {
if(s.charAt(i) == "-" && this.signum() == 0) mi = true; if(s.charAt(i) == '-' && this.signum() == 0) mi = true;
continue; continue;
} }
w = b*w+x; w = b*w+x;
@@ -12273,7 +12273,7 @@ if(mi) BigInteger.ZERO.subTo(this,this);
//(protected) alternate constructor //(protected) alternate constructor
function bnpFromNumber(a,b,c) { function bnpFromNumber(a,b,c) {
if("number" == typeof b) { if('number' == typeof b) {
// new BigInteger(int,int,RNG) // new BigInteger(int,int,RNG)
if(a < 2) this.fromInt(1); if(a < 2) this.fromInt(1);
else { else {

View File

@@ -62,8 +62,8 @@ var j_lm = ((canary&0xffffff)==0xefcafe);
function BigInteger(a,b,c) { function BigInteger(a,b,c) {
this.data = []; this.data = [];
if(a != null) if(a != null)
if("number" == typeof a) this.fromNumber(a,b,c); if('number' == typeof a) this.fromNumber(a,b,c);
else if(b == null && "string" != typeof a) this.fromString(a,256); else if(b == null && 'string' != typeof a) this.fromString(a,256);
else this.fromString(a,b); else this.fromString(a,b);
} }
@@ -121,10 +121,10 @@ if(typeof(navigator) === 'undefined')
{ {
BigInteger.prototype.am = am3; BigInteger.prototype.am = am3;
dbits = 28; dbits = 28;
} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { } else if(j_lm && (navigator.appName == 'Microsoft Internet Explorer')) {
BigInteger.prototype.am = am2; BigInteger.prototype.am = am2;
dbits = 30; dbits = 30;
} else if(j_lm && (navigator.appName != "Netscape")) { } else if(j_lm && (navigator.appName != 'Netscape')) {
BigInteger.prototype.am = am1; BigInteger.prototype.am = am1;
dbits = 26; dbits = 26;
} else { // Mozilla/Netscape seems to prefer am3 } else { // Mozilla/Netscape seems to prefer am3
@@ -142,14 +142,14 @@ BigInteger.prototype.F1 = BI_FP-dbits;
BigInteger.prototype.F2 = 2*dbits-BI_FP; BigInteger.prototype.F2 = 2*dbits-BI_FP;
// Digit conversions // Digit conversions
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; var BI_RM = '0123456789abcdefghijklmnopqrstuvwxyz';
var BI_RC = new Array(); var BI_RC = new Array();
var rr,vv; var rr,vv;
rr = "0".charCodeAt(0); rr = '0'.charCodeAt(0);
for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
rr = "a".charCodeAt(0); rr = 'a'.charCodeAt(0);
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
rr = "A".charCodeAt(0); rr = 'A'.charCodeAt(0);
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
function int2char(n) { return BI_RM.charAt(n); } function int2char(n) { return BI_RM.charAt(n); }
@@ -193,7 +193,7 @@ function bnpFromString(s,b) {
while(--i >= 0) { while(--i >= 0) {
var x = (k==8)?s[i]&0xff:intAt(s,i); var x = (k==8)?s[i]&0xff:intAt(s,i);
if(x < 0) { if(x < 0) {
if(s.charAt(i) == "-") mi = true; if(s.charAt(i) == '-') mi = true;
continue; continue;
} }
mi = false; mi = false;
@@ -223,7 +223,7 @@ function bnpClamp() {
// (public) return string representation in given radix // (public) return string representation in given radix
function bnToString(b) { function bnToString(b) {
if(this.s < 0) return "-"+this.negate().toString(b); if(this.s < 0) return '-'+this.negate().toString(b);
var k; var k;
if(b == 16) k = 4; if(b == 16) k = 4;
else if(b == 8) k = 3; else if(b == 8) k = 3;
@@ -231,7 +231,7 @@ function bnToString(b) {
else if(b == 32) k = 5; else if(b == 32) k = 5;
else if(b == 4) k = 2; else if(b == 4) k = 2;
else return this.toRadix(b); else return this.toRadix(b);
var km = (1<<k)-1, d, m = false, r = "", i = this.t; var km = (1<<k)-1, d, m = false, r = '', i = this.t;
var p = this.DB-(i*this.DB)%k; var p = this.DB-(i*this.DB)%k;
if(i-- > 0) { if(i-- > 0) {
if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); } if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }
@@ -247,7 +247,7 @@ function bnToString(b) {
if(m) r += int2char(d); if(m) r += int2char(d);
} }
} }
return m?r:"0"; return m?r:'0';
} }
// (public) -this // (public) -this
@@ -649,10 +649,10 @@ else return 1;
//(protected) convert to radix string //(protected) convert to radix string
function bnpToRadix(b) { function bnpToRadix(b) {
if(b == null) b = 10; if(b == null) b = 10;
if(this.signum() == 0 || b < 2 || b > 36) return "0"; if(this.signum() == 0 || b < 2 || b > 36) return '0';
var cs = this.chunkSize(b); var cs = this.chunkSize(b);
var a = Math.pow(b,cs); var a = Math.pow(b,cs);
var d = nbv(a), y = nbi(), z = nbi(), r = ""; var d = nbv(a), y = nbi(), z = nbi(), r = '';
this.divRemTo(d,y,z); this.divRemTo(d,y,z);
while(y.signum() > 0) { while(y.signum() > 0) {
r = (a+z.intValue()).toString(b).substr(1) + r; r = (a+z.intValue()).toString(b).substr(1) + r;
@@ -670,7 +670,7 @@ var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
for(var i = 0; i < s.length; ++i) { for(var i = 0; i < s.length; ++i) {
var x = intAt(s,i); var x = intAt(s,i);
if(x < 0) { if(x < 0) {
if(s.charAt(i) == "-" && this.signum() == 0) mi = true; if(s.charAt(i) == '-' && this.signum() == 0) mi = true;
continue; continue;
} }
w = b*w+x; w = b*w+x;
@@ -690,7 +690,7 @@ if(mi) BigInteger.ZERO.subTo(this,this);
//(protected) alternate constructor //(protected) alternate constructor
function bnpFromNumber(a,b,c) { function bnpFromNumber(a,b,c) {
if("number" == typeof b) { if('number' == typeof b) {
// new BigInteger(int,int,RNG) // new BigInteger(int,int,RNG)
if(a < 2) this.fromInt(1); if(a < 2) this.fromInt(1);
else { else {

View File

@@ -9,7 +9,7 @@
<!-- ###END###{ComputerSelectorNoImages} --> <!-- ###END###{ComputerSelectorNoImages} -->
<!-- ###BEGIN###{ComputerSelector-Local-ScriptOnly} --> <!-- ###BEGIN###{ComputerSelector-Local-ScriptOnly} -->
<!-- ###END###{ComputerSelector-Local-ScriptOnly} --> <!-- ###END###{ComputerSelector-Local-ScriptOnly} -->
<html style="height:100%"> <html lang="en" style="height:100%">
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
@@ -1617,7 +1617,7 @@
<!-- ###END###{PowerControl} --> <!-- ###END###{PowerControl} -->
<script type="text/javascript"> <script type="text/javascript">
// ###BEGIN###{!Look-BrandedCommander} // ###BEGIN###{!Look-BrandedCommander}
var version = '0.8.4'; var version = '0.8.5';
// ###END###{!Look-BrandedCommander} // ###END###{!Look-BrandedCommander}
// ###BEGIN###{Look-BrandedCommander} // ###BEGIN###{Look-BrandedCommander}
var version = '1.2.0'; var version = '1.2.0';
@@ -1646,7 +1646,7 @@
var currentMeshNode = null; var currentMeshNode = null;
// ###END###{Mode-MeshCentral2} // ###END###{Mode-MeshCentral2}
var webcompilerfeatures = [/*###WEBCOMPILERFEATURES###*/]; var webcompilerfeatures = [/*###WEBCOMPILERFEATURES###*/];
var StatusStrs = ['Disconnected', 'Connecting...', 'Setup...', 'Connected']; var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected"];
// ###BEGIN###{Scripting} // ###BEGIN###{Scripting}
var scriptstate; var scriptstate;
// ###END###{Scripting} // ###END###{Scripting}
@@ -1801,7 +1801,7 @@
// ###BEGIN###{Terminal-Enumation-All} // ###BEGIN###{Terminal-Enumation-All}
Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation]; Q('id_ttypebutton').value = terminalEmulations[terminal.m.terminalEmulation];
// ###END###{Terminal-Enumation-All} // ###END###{Terminal-Enumation-All}
Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?'CR+LF':'LF'; Q('id_tcrbutton').value = (terminal.m.lineFeed == '\r\n')?"CR+LF":"LF";
QE('idx_connectbutton2', true); QE('idx_connectbutton2', true);
@@ -1846,7 +1846,7 @@
// ###BEGIN###{ComputerSelector} // ###BEGIN###{ComputerSelector}
if (!urlvars['host']) { go(101); } if (!urlvars['host']) { go(101); }
QH('id_computername', 'Remote Management Console v' + version); QH('id_computername', format("Remote Management Console v{0}", version));
// ###BEGIN###{ComputerSelector-Local} // ###BEGIN###{ComputerSelector-Local}
if (urlvars['host']) { if (urlvars['host']) {
@@ -1892,9 +1892,9 @@
// Read the computers from a file list // Read the computers from a file list
var listok = 0; var listok = 0;
try { try {
var ctext = require("fs").readFileSync(urlvars['list'], "utf8"); var ctext = require('fs').readFileSync(urlvars['list'], 'utf8');
if ((ctext.length > 2) && (ctext.charCodeAt(0) == 65533) && (ctext.charCodeAt(1) == 65533)) { // This is unicode detection if ((ctext.length > 2) && (ctext.charCodeAt(0) == 65533) && (ctext.charCodeAt(1) == 65533)) { // This is unicode detection
ctext = require("fs").readFileSync(urlvars['list'], "utf16le"); ctext = require('fs').readFileSync(urlvars['list'], 'utf16le');
if ((ctext.length > 1) && (ctext.charCodeAt(0) == 65279)) { ctext = ctext.substring(1); } if ((ctext.length > 1) && (ctext.charCodeAt(0) == 65279)) { ctext = ctext.substring(1); }
} }
if (ctext) { if (ctext) {
@@ -1956,7 +1956,7 @@
// Add all possible variable types to dialog 16 // Add all possible variable types to dialog 16
var options = ''; var options = '';
for (var i in AmtSetupBinVarIds) { for (var j in AmtSetupBinVarIds[i]) { options += '<option value="' + i + "-" + j + '">' + AmtSetupBinVarIds[i][j][1] } } for (var i in AmtSetupBinVarIds) { for (var j in AmtSetupBinVarIds[i]) { options += '<option value="' + i + '-' + j + '">' + AmtSetupBinVarIds[i][j][1] } }
QH('d16type', options); QH('d16type', options);
// ###END###{USBSetup} // ###END###{USBSetup}
@@ -1979,10 +1979,10 @@
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
NW_AutoUpdateCheck(); NW_AutoUpdateCheck();
// ###BEGIN###{!ComputerSelector-Local-ScriptOnly} // ###BEGIN###{!ComputerSelector-Local-ScriptOnly}
if (urlvars['help'] || urlvars['?']) { messagebox("Commander Line Options", '<div style=text-align:left><b>-host:[hostname]</b>, Hostname or IP of Intel&reg; AMT<br/><b>-user:[username]</b>, Digest login username<br/><b>-pass:[password]</b>, Digest login password<br/><b>-tls</b>, Connect using TLS security<br/><b>-kvm</b>, Once connected go to remote desktop<br/><b>-kvmfull</b>, Once connected go to fullscreen remote desktop<br/><b>-kvmonly</b>, Perform fullscreen remote desktop only<br/><b>-sol</b>, Once connected go to terminal<br/><b>-script:[file]</b>, Run a script<br/><b>-autoexit</b>, Exit after script is done<br/><b>-ignoretls</b>, Don\'t check Intel&reg; AMT TLS certificate<br/></div>'); } if (urlvars['help'] || urlvars['?']) { messagebox("Commander Line Options", '<div style=text-align:left><b>-host:[hostname]</b>, ' + "Hostname or IP of Intel&reg; AMT" + '<br/><b>-user:[username]</b>, ' + "Digest login username" + '<br/><b>-pass:[password]</b>, ' + "Digest login password" + '<br/><b>-tls</b>, ' + "Connect using TLS security" + '<br/><b>-kvm</b>, ' + "Once connected go to remote desktop" + '<br/><b>-kvmfull</b>, ' + "Once connected go to fullscreen remote desktop" + '<br/><b>-kvmonly</b>, ' + "Perform fullscreen remote desktop only" + '<br/><b>-sol</b>, ' + "Once connected go to terminal" + '<br/><b>-script:[file]</b>, ' + "Run a script" + '<br/><b>-autoexit</b>, ' + "Exit after script is done" + '<br/><b>-ignoretls</b>, ' + "Don't check Intel&reg; AMT TLS certificate" + '<br/></div>'); }
// ###END###{!ComputerSelector-Local-ScriptOnly} // ###END###{!ComputerSelector-Local-ScriptOnly}
// ###BEGIN###{ComputerSelector-Local-ScriptOnly} // ###BEGIN###{ComputerSelector-Local-ScriptOnly}
if (urlvars['help'] || urlvars['?']) { messagebox("Commander Line Options", '<div style=text-align:left><b>-list:[listfile]</b>, List of computers to run a script on<br/><b>-script:[file]</b>, Run a script<br/><b>-autoexit</b>, Exit after all scripts are done<br/><b>-ignoretls</b>, Don\'t check Intel&reg; AMT TLS certificate<br/></div>'); } if (urlvars['help'] || urlvars['?']) { messagebox("Commander Line Options", '<div style=text-align:left><b>-list:[listfile]</b>, ' + "List of computers to run a script on" + '<br/><b>-script:[file]</b>, ' + "Run a script" + '<br/><b>-autoexit</b>, ' + "Exit after all scripts are done" + '<br/><b>-ignoretls</b>, ' + "Don't check Intel&reg; AMT TLS certificate" + '<br/></div>'); }
// ###END###{ComputerSelector-Local-ScriptOnly} // ###END###{ComputerSelector-Local-ScriptOnly}
// ###END###{Mode-NodeWebkit} // ###END###{Mode-NodeWebkit}
@@ -2156,7 +2156,7 @@
// Add Mac OS X specific menu // Add Mac OS X specific menu
var os = require('os'); var os = require('os');
if (os.platform() == 'darwin') { mainmenu.createMacBuiltin('MeshCommander', { hideEdit: true, hideWindow: true }); } if (os.platform() == 'darwin') { mainmenu.createMacBuiltin('MeshCommander', { hideEdit: true, hideWindow: true }); }
var filemenu = new gui.MenuItem({ label: 'File' }); var filemenu = new gui.MenuItem({ label: "File" });
var filemenusub = new gui.Menu(); var filemenusub = new gui.Menu();
var seperator = false; var seperator = false;
var toolsmenu = null; var toolsmenu = null;
@@ -2265,7 +2265,7 @@
// Explicit exit action not required on Mac. The MacBuiltin menu includes native option to quit application (Quit) // Explicit exit action not required on Mac. The MacBuiltin menu includes native option to quit application (Quit)
if (os.platform() != 'darwin') { if (os.platform() != 'darwin') {
if (seperator == true) filemenusub.append(new gui.MenuItem({ type: 'separator' })); if (seperator == true) filemenusub.append(new gui.MenuItem({ type: 'separator' }));
filemenusub.append(new gui.MenuItem({ label: 'Exit', click: NW_Exit })); filemenusub.append(new gui.MenuItem({ label: "Exit", click: NW_Exit }));
} }
filemenu.submenu = filemenusub; filemenu.submenu = filemenusub;
@@ -2311,6 +2311,21 @@
toolsmenusub.append(new gui.MenuItem({ label: "Settings", click: showDesktopSettings })); toolsmenusub.append(new gui.MenuItem({ label: "Settings", click: showDesktopSettings }));
toolsmenu.submenu = toolsmenusub; toolsmenu.submenu = toolsmenusub;
} }
// Language menu
var languagemenu = new gui.MenuItem({ label: "Languages" });
var languagesubmenu = new gui.Menu();
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'en'), label: "English", click: function () { window.location.href = 'commander.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'zh-chs'), label: "Chinese (Simplified)", click: function () { window.location.href = 'commander_zh-chs.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'nl'), label: "Dutch", click: function () { window.location.href = 'commander_nl.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'fr'), label: "French", click: function () { window.location.href = 'commander_fr.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'it'), label: "Italian", click: function () { window.location.href = 'commander_it.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'ja'), label: "Japanese", click: function () { window.location.href = 'commander_ja.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'pt'), label: "Portuguese", click: function () { window.location.href = 'commander_pt.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'ru'), label: "Russian", click: function () { window.location.href = 'commander_ru.htm'; } }));
languagesubmenu.append(new gui.MenuItem({ type: 'checkbox', checked: (document.documentElement.lang == 'es'), label: "Spanish", click: function () { window.location.href = 'commander_es.htm'; } }));
languagemenu.submenu = languagesubmenu;
var helpmenu = new gui.MenuItem({ label: "Help" }); var helpmenu = new gui.MenuItem({ label: "Help" });
var helpmenusub = new gui.Menu(); var helpmenusub = new gui.Menu();
// ###BEGIN###{Look-Commander} // ###BEGIN###{Look-Commander}
@@ -2353,6 +2368,7 @@
if (toolsmenu != null) mainmenu.append(toolsmenu); if (toolsmenu != null) mainmenu.append(toolsmenu);
if (scriptmenu != null) mainmenu.append(scriptmenu); if (scriptmenu != null) mainmenu.append(scriptmenu);
if (securitymenu != null) mainmenu.append(securitymenu); if (securitymenu != null) mainmenu.append(securitymenu);
mainmenu.append(languagemenu);
mainmenu.append(helpmenu); mainmenu.append(helpmenu);
gui.Window.get().menu = mainmenu; gui.Window.get().menu = mainmenu;
} }
@@ -3150,7 +3166,7 @@
} }
function onProcessChanged(a, b) { function onProcessChanged(a, b) {
QS('id_progressbar').width = ((a * 100) / b) + "%"; QS('id_progressbar').width = ((a * 100) / b) + '%';
if (a == 0) refreshButtons(true); // If nothing is being done, re-enable refresh buttons if (a == 0) refreshButtons(true); // If nothing is being done, re-enable refresh buttons
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
@@ -3250,9 +3266,9 @@
d4name.value = d4tags.value = d4hostname.value = d4password.value = ''; d4name.value = d4tags.value = d4hostname.value = d4password.value = '';
d4username.value = "admin"; d4username.value = "admin";
if (kerberos != null) { if (kerberos != null) {
QH('d4security', '<option value=0>Digest / None</option><option value=1>Digest / TLS</option><option value=2>Kerberos / None</option><option value=3>Kerberos / TLS</option>'); QH('d4security', '<option value=0>' + "Digest / None" + '</option><option value=1>' + "Digest / TLS" + '</option><option value=2>' + "Kerberos / None" + '</option><option value=3>' + "Kerberos / TLS" + '</option>');
} else { } else {
QH('d4security', '<option value=0>Digest / None</option><option value=1>Digest / TLS</option>'); QH('d4security', '<option value=0>' + "Digest / None" + '</option><option value=1>' + "Digest / TLS" + '</option>');
} }
d4security.value = 0; d4security.value = 0;
setDialogMode(4, "Add Computer", 3, function () { addComputerButton(); }); setDialogMode(4, "Add Computer", 3, function () { addComputerButton(); });
@@ -3492,16 +3508,16 @@
var k = Q('d4security').value >= 2; var k = Q('d4security').value >= 2;
// ###BEGIN###{!Mode-NodeWebkit} // ###BEGIN###{!Mode-NodeWebkit}
if (k) { if (k) {
computerlist.push({ 'h': Math.random(), "name": encodeURIComponent(d4name.value), "host": encodeURIComponent(d4hostname.value), "tags": encodeURIComponent(d4tags.value), "user": "*", "pass": encodeURIComponent(Q('d4kerberos').value), "tls": d4security.value % 2 }); computerlist.push({ 'h': Math.random(), 'name': encodeURIComponent(d4name.value), 'host': encodeURIComponent(d4hostname.value), 'tags': encodeURIComponent(d4tags.value), 'user': '*', 'pass': encodeURIComponent(Q('d4kerberos').value), 'tls': d4security.value % 2 });
} else { } else {
computerlist.push({ 'h': Math.random(), "name": encodeURIComponent(d4name.value), "host": encodeURIComponent(d4hostname.value), "tags": encodeURIComponent(d4tags.value), "user": encodeURIComponent(d4username.value), "pass": encodeURIComponent(d4password.value), "tls": d4security.value % 2 }); computerlist.push({ 'h': Math.random(), 'name': encodeURIComponent(d4name.value), 'host': encodeURIComponent(d4hostname.value), 'tags': encodeURIComponent(d4tags.value), 'user': encodeURIComponent(d4username.value), 'pass': encodeURIComponent(d4password.value), 'tls': d4security.value % 2 });
} }
// ###END###{!Mode-NodeWebkit} // ###END###{!Mode-NodeWebkit}
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
if (k) { if (k) {
computerlist.push({ 'h': Math.random(), "name": encodeURIComponent(d4name.value), "host": encodeURIComponent(d4hostname.value), "tags": encodeURIComponent(d4tags.value), "user": "*", "pass": encodeURIComponent(Q('d4kerberos').value), "tls": d4security.value % 2, "tlscerthash": getCertPinning(d4hostname.value) }); computerlist.push({ 'h': Math.random(), 'name': encodeURIComponent(d4name.value), 'host': encodeURIComponent(d4hostname.value), 'tags': encodeURIComponent(d4tags.value), 'user': '*', 'pass': encodeURIComponent(Q('d4kerberos').value), 'tls': d4security.value % 2, 'tlscerthash': getCertPinning(d4hostname.value) });
} else { } else {
computerlist.push({ 'h': Math.random(), "name": encodeURIComponent(d4name.value), "host": encodeURIComponent(d4hostname.value), "tags": encodeURIComponent(d4tags.value), "user": encodeURIComponent(d4username.value), "pass": encodeURIComponent(d4password.value), "tls": d4security.value % 2, "tlscerthash": getCertPinning(d4hostname.value) }); computerlist.push({ 'h': Math.random(), 'name': encodeURIComponent(d4name.value), 'host': encodeURIComponent(d4hostname.value), 'tags': encodeURIComponent(d4tags.value), 'user': encodeURIComponent(d4username.value), 'pass': encodeURIComponent(d4password.value), 'tls': d4security.value % 2, 'tlscerthash': getCertPinning(d4hostname.value) });
} }
// ###END###{Mode-NodeWebkit} // ###END###{Mode-NodeWebkit}
saveComputers(); saveComputers();
@@ -3524,16 +3540,16 @@
// If connected to a MeshCentral server, only edit the device name // If connected to a MeshCentral server, only edit the device name
// ###BEGIN###{MeshServerConnect} // ###BEGIN###{MeshServerConnect}
if (meshCentralServer != null) { if (meshCentralServer != null) {
var x = '<div style=height:26px><input id=d11deviceName style=float:right;width:200px value="' + decodeURIComponent(c['name'] ? c['name'] : '') + '"><div>Friendly Name</div></div>'; var x = '<div style=height:26px><input id=d11deviceName style=float:right;width:200px value="' + decodeURIComponent(c['name'] ? c['name'] : '') + '"><div>' + "Friendly Name" + '</div></div>';
setDialogMode(11, "Edit Device", 3, computerEditMeshOk, x, c); setDialogMode(11, "Edit Device", 3, computerEditMeshOk, x, c);
return; return;
} }
// ###END###{MeshServerConnect} // ###END###{MeshServerConnect}
if (kerberos != null || c['user'] == '*') { if (kerberos != null || c['user'] == '*') {
QH('d4security', '<option value=0>Digest / None</option><option value=1>Digest / TLS</option><option value=2>Kerberos / None</option><option value=3>Kerberos / TLS</option>'); QH('d4security', '<option value=0>' + "Digest / None" + '</option><option value=1>' + "Digest / TLS" + '</option><option value=2>' + "Kerberos / None" + '</option><option value=3>' + "Kerberos / TLS" + '</option>');
} else { } else {
QH('d4security', '<option value=0>Digest / None</option><option value=1>Digest / TLS</option>'); QH('d4security', '<option value=0>' + "Digest / None" + '</option><option value=1>' + "Digest / TLS" + '</option>');
} }
d4name.value = decodeURIComponent(c['name']?c['name']:''); d4name.value = decodeURIComponent(c['name']?c['name']:'');
d4tags.value = decodeURIComponent(c['tags']?c['tags']:''); d4tags.value = decodeURIComponent(c['tags']?c['tags']:'');
@@ -3677,14 +3693,14 @@
if (securityok == true) { if (securityok == true) {
if (computer['tls'] != 0) { extra.push("TLS"); } if (computer['tls'] != 0) { extra.push("TLS"); }
} else { } else {
extra.push((computer['tls'] == 0) ? "No&nbsp;Security" : "TLS"); extra.push((computer['tls'] == 0) ? NoBreak("No Security") : "TLS");
} }
} else { } else {
extra.push((computer['tls'] == 0) ? "No&nbsp;Security" : "TLS"); extra.push((computer['tls'] == 0) ? NoBreak("No Security") : "TLS");
} }
// ###END###{MeshServerConnect} // ###END###{MeshServerConnect}
// ###BEGIN###{!MeshServerConnect} // ###BEGIN###{!MeshServerConnect}
extra.push((computer['tls'] == 0) ? "No&nbsp;Security" : "TLS"); extra.push((computer['tls'] == 0) ? NoBreak("No Security") : "TLS");
// ###END###{!MeshServerConnect} // ###END###{!MeshServerConnect}
var name = decodeURIComponent(computer['host']); var name = decodeURIComponent(computer['host']);
if (computer['name'] && computer['name'] != '') name = decodeURIComponent(computer['name']); if (computer['name'] && computer['name'] != '') name = decodeURIComponent(computer['name']);
@@ -3900,7 +3916,7 @@
// ###BEGIN###{MeshServerConnect} // ###BEGIN###{MeshServerConnect}
if (meshCentralServer == null) { if (meshCentralServer == null) {
// ###END###{MeshServerConnect} // ###END###{MeshServerConnect}
if (currentcomputer['user'] != "*") { if (currentcomputer['user'] != '*') {
x += addComputerDetailsEntry("Authentication", "Digest / " + EscapeHtml(decodeURIComponent(currentcomputer['user']))); x += addComputerDetailsEntry("Authentication", "Digest / " + EscapeHtml(decodeURIComponent(currentcomputer['user'])));
} else { } else {
if (currentcomputer['pass'] == '') { if (currentcomputer['pass'] == '') {
@@ -3929,12 +3945,12 @@
var mode = ''; var mode = '';
if (currentcomputer['pstate'] == 2) { mode = "ACM"; if (currentcomputer['pmode'] == 2) mode = "CCM"; } if (currentcomputer['pstate'] == 2) { mode = "ACM"; if (currentcomputer['pmode'] == 2) mode = "CCM"; }
if (mode != '') mode = ' / ' + mode; if (mode != '') mode = ' / ' + mode;
x += addComputerDetailsEntry("Intel&reg AMT", "v" + currentcomputer['ver'] + mode); x += addComputerDetailsEntry("Intel&reg; AMT", "v" + currentcomputer['ver'] + mode);
} }
if (currentcomputer['date']) { x += addComputerDetailsEntry("Last Connection", new Date(currentcomputer['date']).toDateString()); } if (currentcomputer['date']) { x += addComputerDetailsEntry("Last Connection", new Date(currentcomputer['date']).toDateString()); }
if (currentcomputer['digestrealm']) { if (currentcomputer['digestrealm']) {
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
x += '<div cm="' + "Remove&nbsp;Realm..." + '#removeCurrentRealm(' + currentcomputer['h'] + ')">'; x += '<div cm="' + NoBreak("Remove Realm...") + '#removeCurrentRealm(' + currentcomputer['h'] + ')">';
// ###END###{ContextMenus} // ###END###{ContextMenus}
x += addComputerDetailsEntry("Digest Realm", '<span style=font-size:x-small>' + currentcomputer['digestrealm'] + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentRealm(' + currentcomputer['h'] + ')><u>' + "Remove Realm" + '</u></a></span>'); x += addComputerDetailsEntry("Digest Realm", '<span style=font-size:x-small>' + currentcomputer['digestrealm'] + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentRealm(' + currentcomputer['h'] + ')><u>' + "Remove Realm" + '</u></a></span>');
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
@@ -3946,7 +3962,7 @@
if (currentcomputer['tlscerthash']) { if (currentcomputer['tlscerthash']) {
if (currentcomputer['tlscert']) { if (currentcomputer['tlscert']) {
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
x += '<div cm="' + "View&nbsp;Certificate..." + '#viewCurrentPinCertificate(' + currentcomputer['h'] + ')|' + "Remove&nbsp;Pinning..." + '#removeCurrentPinCertificate(' + currentcomputer['h'] + ')">'; x += '<div cm="' + NoBreak("View Certificate...") + '#viewCurrentPinCertificate(' + currentcomputer['h'] + ')|' + NoBreak("Remove Pinning...") + '#removeCurrentPinCertificate(' + currentcomputer['h'] + ')">';
// ###END###{ContextMenus} // ###END###{ContextMenus}
x += addComputerDetailsEntry("TLS Certificate", '<span title="Cert hash: ' + currentcomputer['tlscerthash'] + '">' + "Pinned to specific certificate" + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=viewCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Show Certificate" + '</u></a> <a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Remove Pinning" + '</u></a></span>'); x += addComputerDetailsEntry("TLS Certificate", '<span title="Cert hash: ' + currentcomputer['tlscerthash'] + '">' + "Pinned to specific certificate" + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=viewCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Show Certificate" + '</u></a> <a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Remove Pinning" + '</u></a></span>');
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
@@ -3954,7 +3970,7 @@
// ###END###{ContextMenus} // ###END###{ContextMenus}
} else { } else {
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
x += '<div cm="' + "Remove&nbsp;Pinning..." + '#removeCurrentPinCertificate(' + currentcomputer['h'] + ')">'; x += '<div cm="' + NoBreak("Remove Pinning...") + '#removeCurrentPinCertificate(' + currentcomputer['h'] + ')">';
// ###END###{ContextMenus} // ###END###{ContextMenus}
x += addComputerDetailsEntry("TLS Certificate", '<span title="Cert hash: ' + currentcomputer['tlscerthash'] + '">' + "Pinned to specific certificate" + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Remove Pinning" + '</u></a></span>'); x += addComputerDetailsEntry("TLS Certificate", '<span title="Cert hash: ' + currentcomputer['tlscerthash'] + '">' + "Pinned to specific certificate" + '</span><br /><span style=margin-left:5px><a style=cursor:pointer;font-size:10px;color:blue onclick=removeCurrentPinCertificate(' + currentcomputer['h'] + ')><u>' + "Remove Pinning" + '</u></a></span>');
// ###BEGIN###{ContextMenus} // ###BEGIN###{ContextMenus}
@@ -4014,7 +4030,7 @@
var x = '<img src=images-commander/cert1.png style=float:right height=32 width=32 />'; var x = '<img src=images-commander/cert1.png style=float:right height=32 width=32 />';
x += 'This certificate is pinned to computer ' + c['name'] + '. When connecting, if this certificate is received the connection will allowed. Hit delete button to un-pin.<br>'; x += 'This certificate is pinned to computer ' + c['name'] + '. When connecting, if this certificate is received the connection will allowed. Hit delete button to un-pin.<br>';
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
//x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes, <a style=cursor:pointer;color:blue onclick=downloadCert(" + h + ")>Download</a>"); //x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=downloadCert(' + h + ')>' + "Download" + '</a>');
// ###END###{FileSaver} // ###END###{FileSaver}
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
//x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes"); //x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes");
@@ -4133,7 +4149,7 @@
// ###END###{Terminal} // ###END###{Terminal}
var username = currentcomputer['user']; var username = currentcomputer['user'];
if (username == '') { username = 'admin'; } if (username == '') { username = 'admin'; }
require('nw.gui').Window.open(window.location.href + '?host=' + currentcomputer['host'] + '&user=' + username + '&pass=' + currentcomputer['pass'] + '&tls=' + currentcomputer['tls'] + adder, { "icon": "favicon.png", "toolbar": false, "frame": true, "width": 970, "min_width": 970, "height": 760, "min_height": 640 }); require('nw.gui').Window.open(window.location.href + '?host=' + currentcomputer['host'] + '&user=' + username + '&pass=' + currentcomputer['pass'] + '&tls=' + currentcomputer['tls'] + adder, { 'icon': 'favicon.png', 'toolbar': false, 'frame': true, 'width': 970, 'min_width': 970, 'height': 760, 'min_height': 640 });
//require('child_process').exec('nw.exe -host:' + decodeURIComponent(currentcomputer['host']) + ' -user:' + decodeURIComponent(currentcomputer['user']) + ' -pass:' + decodeURIComponent(currentcomputer['pass']) + ((currentcomputer['tls']==1)?' -tls':''), function (error, stdout, stderr) { }); //require('child_process').exec('nw.exe -host:' + decodeURIComponent(currentcomputer['host']) + ' -user:' + decodeURIComponent(currentcomputer['user']) + ' -pass:' + decodeURIComponent(currentcomputer['pass']) + ((currentcomputer['tls']==1)?' -tls':''), function (error, stdout, stderr) { });
return; return;
} }
@@ -4364,7 +4380,7 @@
function mscript_console(msg, scriptstate) { function mscript_console(msg, scriptstate) {
scriptstate.computer['consolemsg'] = msg; scriptstate.computer['consolemsg'] = msg;
scriptstate.computer['consolemsgs'] += (msg + "\r\n"); scriptstate.computer['consolemsgs'] += (msg + '\r\n');
if (scriptstate.computer.consoledialog) { Q(scriptstate.computer.consoledialog).value = scriptstate.computer['consolemsgs']; } if (scriptstate.computer.consoledialog) { Q(scriptstate.computer.consoledialog).value = scriptstate.computer['consolemsgs']; }
QH('XI-' + scriptstate.computer['h'], msg); QH('XI-' + scriptstate.computer['h'], msg);
} }
@@ -4731,7 +4747,7 @@
// ###BEGIN###{!ComputerSelector-Local-ScriptOnly} // ###BEGIN###{!ComputerSelector-Local-ScriptOnly}
if (urlvars['host'] && urlvars['script']) { if (urlvars['host'] && urlvars['script']) {
try { try {
var data = require("fs").readFileSync(urlvars['script'], "utf8"); var data = require('fs').readFileSync(urlvars['script'], 'utf8');
if (data) { script_onScriptRead( { target: { result: data }} ); } if (data) { script_onScriptRead( { target: { result: data }} ); }
} catch (e) { messagebox("Run Script", "Invalid script file.") } } catch (e) { messagebox("Run Script", "Invalid script file.") }
} }
@@ -4775,7 +4791,7 @@
var c = showTlsCertTempCert = cert?cert:wsstack.comm.getPeerCertificate(), x = '<br>'; var c = showTlsCertTempCert = cert?cert:wsstack.comm.getPeerCertificate(), x = '<br>';
if (msg) x = '<div>' + msg + '</div><br />'; if (msg) x = '<div>' + msg + '</div><br />';
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
x += addHtmlValue("Certificate", c.raw.length + " bytes, <a style=cursor:pointer;color:blue onclick=downloadTlsCert()>Download</a>"); x += addHtmlValue("Certificate", c.raw.length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=downloadTlsCert()>' + "Download" + '</a>');
// ###END###{FileSaver} // ###END###{FileSaver}
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
x += addHtmlValue("Certificate", c.raw.length + " bytes"); x += addHtmlValue("Certificate", c.raw.length + " bytes");
@@ -4783,14 +4799,14 @@
// Display certificate key usages // Display certificate key usages
var y = []; var y = [];
if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.2') >= 0) { y.push("TLS&nbsp;Client"); } if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.2') >= 0) { y.push(NoBreak("TLS Client")); }
if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.3') >= 0) { y.push("Code&nbsp;Signing"); } if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.3') >= 0) { y.push(NoBreak("Code Signing")); }
if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.4') >= 0) { y.push("EMail"); } if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.4') >= 0) { y.push("EMail"); }
if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.1') >= 0) { y.push("TLS&nbsp;Server"); } if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.1') >= 0) { y.push(NoBreak("TLS Server")); }
if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.1') >= 0) { y.push("Intel&reg;&nbsp;AMT Console"); } if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.1') >= 0) { y.push(NoBreak("Intel&reg; AMT Console")); }
if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.2') >= 0) { y.push("Intel&reg;&nbsp;AMT Agent"); } if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.2') >= 0) { y.push(NoBreak("Intel&reg; AMT Agent")); }
if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.3') >= 0) { y.push("Intel&reg;&nbsp;AMT Activation"); } if (c.ext_key_usage.indexOf('2.16.840.1.113741.1.2.3') >= 0) { y.push(NoBreak("Intel&reg; AMT Activation")); }
if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.8') >= 0) { y.push("Time&nbsp;Stamping"); } if (c.ext_key_usage.indexOf('1.3.6.1.5.5.7.3.8') >= 0) { y.push(NoBreak("Time Stamping")); }
if (y.length > 0) { x += addHtmlValueNoTitle("Certificate Usage", y.join(', ') + '.') + '<br clear=all />'; } if (y.length > 0) { x += addHtmlValueNoTitle("Certificate Usage", y.join(', ') + '.') + '<br clear=all />'; }
x += '<br><div style="border-bottom:1px solid gray"><i>' + "Certificate Subject" + '</i></div><br>'; x += '<br><div style="border-bottom:1px solid gray"><i>' + "Certificate Subject" + '</i></div><br>';
@@ -5085,7 +5101,7 @@
host = gs['HostName']; host = gs['HostName'];
y = gs['DomainName']; y = gs['DomainName'];
if (y != null && y.length > 0) host += "." + y; if (y != null && y.length > 0) host += '.' + y;
if (host.length == 0) { host = ('<i>' + "None" + '</i>'); } else { host = EscapeHtml(host); } if (host.length == 0) { host = ('<i>' + "None" + '</i>'); } else { host = EscapeHtml(host); }
x += TableEntry("Name & Domain", addLinkConditional(host, 'showEditNameDlg()', xxAccountAdminName)); x += TableEntry("Name & Domain", addLinkConditional(host, 'showEditNameDlg()', xxAccountAdminName));
if (HardwareInventory) x += TableEntry("System ID", guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase())); if (HardwareInventory) x += TableEntry("System ID", guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase()));
@@ -5099,28 +5115,28 @@
// ###END###{!Look-Intel-SBT} // ###END###{!Look-Intel-SBT}
// ###BEGIN###{Look-Intel-SBT} // ###BEGIN###{Look-Intel-SBT}
x += TableEntry("Intel&reg; SBT", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; SBT", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-Intel-SBT} // ###END###{Look-Intel-SBT}
// ###BEGIN###{Look-Intel-SM} // ###BEGIN###{Look-Intel-SM}
x += TableEntry("Intel&reg; SM", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; SM", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-Intel-SM} // ###END###{Look-Intel-SM}
// ###BEGIN###{Look-Intel-AMT} // ###BEGIN###{Look-Intel-AMT}
x += TableEntry("Intel&reg; AMT", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; AMT", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-Intel-AMT} // ###END###{Look-Intel-AMT}
// ###BEGIN###{Look-Commander} // ###BEGIN###{Look-Commander}
x += TableEntry("Intel&reg; ME", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; ME", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-Commander} // ###END###{Look-Commander}
// ###BEGIN###{Look-ISDU} // ###BEGIN###{Look-ISDU}
x += TableEntry("Intel&reg; ME", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; ME", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-ISDU} // ###END###{Look-ISDU}
// ###BEGIN###{Look-BrandedCommander} // ###BEGIN###{Look-BrandedCommander}
x += TableEntry("Intel&reg; ME", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; ME", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-BrandedCommander} // ###END###{Look-BrandedCommander}
// ###BEGIN###{Look-Unite} // ###BEGIN###{Look-Unite}
x += TableEntry("Intel&reg; ME", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; ME", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-Unite} // ###END###{Look-Unite}
// ###BEGIN###{Look-MeshCentral} // ###BEGIN###{Look-MeshCentral}
x += TableEntry("Intel&reg; ME", "v" + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode); x += TableEntry("Intel&reg; ME", 'v' + getItem(amtlogicalelements, 'InstanceID', 'AMT')['VersionString'] + mode);
// ###END###{Look-MeshCentral} // ###END###{Look-MeshCentral}
// ###BEGIN###{ComputerSelector} // ###BEGIN###{ComputerSelector}
@@ -5139,18 +5155,18 @@
// ###BEGIN###{MeshServerConnect} // ###BEGIN###{MeshServerConnect}
if (meshCentralServer != null) { if (meshCentralServer != null) {
QH('id_computername', 'Computer: ' + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName']) + ', Server: ' + meshCentralServer.host); QH('id_computername', "Computer: " + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName']) + ", Server: " + meshCentralServer.host);
} else { } else {
QH('id_computername', 'Computer: ' + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName'])); QH('id_computername', "Computer: " + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName']));
} }
// ###END###{MeshServerConnect} // ###END###{MeshServerConnect}
// ###BEGIN###{!MeshServerConnect} // ###BEGIN###{!MeshServerConnect}
QH('id_computername', 'Computer: ' + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName'])); QH('id_computername', "Computer: " + ((gs['HostName'] == '') ? ('<i>' + "None" + '</i>') : gs['HostName']));
// ###END###{!MeshServerConnect} // ###END###{!MeshServerConnect}
// ###END###{!Mode-MeshCentral2} // ###END###{!Mode-MeshCentral2}
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
if (gs['HostName'] != '') { require('nw.gui').Window.get().title = NW_WindowTitle + " - " + gs['HostName']; } else { require('nw.gui').Window.get().title = NW_WindowTitle; } if (gs['HostName'] != '') { require('nw.gui').Window.get().title = NW_WindowTitle + ' - ' + gs['HostName']; } else { require('nw.gui').Window.get().title = NW_WindowTitle; }
// ###END###{Mode-NodeWebkit} // ###END###{Mode-NodeWebkit}
// ###BEGIN###{PowerControl} // ###BEGIN###{PowerControl}
@@ -5182,17 +5198,17 @@
if (sol) features += ", Serial-over-LAN"; if (sol) features += ", Serial-over-LAN";
if (ider) features += ", IDE-Redirect"; if (ider) features += ", IDE-Redirect";
if (kvm) features += ", KVM"; if (kvm) features += ", KVM";
if (features == '') features = " None"; if (features == '') features = ' ' + "None";
x += TableEntry("Active Features", addLinkConditional(features.substring(2), 'showFeaturesDlg()', xxAccountAdminName)); x += TableEntry("Active Features", addLinkConditional(features.substring(2), 'showFeaturesDlg()', xxAccountAdminName));
} }
if ((amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) { if ((amtsysstate['IPS_KVMRedirectionSettingData'] != null) && (amtsysstate['IPS_KVMRedirectionSettingData'].response)) {
var desktopSettings = amtsysstate['IPS_KVMRedirectionSettingData'].response; var desktopSettings = amtsysstate['IPS_KVMRedirectionSettingData'].response;
var screenname = 'Primary display'; var screenname = "Primary display";
if ((amtversion > 7) && (desktopSettings['DefaultScreen'] !== undefined) && (desktopSettings['DefaultScreen'] < 255)) { screenname = ['Primary display', 'Secondary display', '3rd display'][desktopSettings['DefaultScreen']]; } if ((amtversion > 7) && (desktopSettings['DefaultScreen'] !== undefined) && (desktopSettings['DefaultScreen'] < 255)) { screenname = ["Primary display", "Secondary display", "3rd display"][desktopSettings['DefaultScreen']]; }
features = '<span title="The default remote display is the ' + screenname.toLowerCase() + '">' + screenname + '</span>'; features = '<span title="' + format("The default remote display is {0}", screenname.toLowerCase()) + '">' + screenname + '</span>';
if (desktopSettings['Is5900PortEnabled'] == true) { features += ", Port 5900 enabled"; } if (desktopSettings['Is5900PortEnabled'] == true) { features += ", Port 5900 enabled"; }
if (desktopSettings['OptInPolicy'] == true) { features += ", " + desktopSettings['OptInPolicyTimeout'] + " second" + ((desktopSettings['OptInPolicyTimeout'] > 0)?'s':'') + " opt-in"; } if (desktopSettings['OptInPolicy'] == true) { features += ", " + desktopSettings['OptInPolicyTimeout'] + ' ' + ((desktopSettings['OptInPolicyTimeout'] > 0)?"seconds opt-in":"second opt-in"); }
features += ", " + desktopSettings['SessionTimeout'] + " minute" + ((desktopSettings['SessionTimeout'] > 0) ? 's' : '') + " session timeout"; features += ", " + desktopSettings['SessionTimeout'] + " minute" + ((desktopSettings['SessionTimeout'] > 0) ? 's' : '') + " session timeout";
// Screen blanking on AMT 10 and higher // Screen blanking on AMT 10 and higher
@@ -5256,15 +5272,15 @@
// ###END###{!Look-Intel-SBT} // ###END###{!Look-Intel-SBT}
if (amtdeltatime) { x += TableEntry("Date & Time", addLinkConditional(new Date(new Date().getTime() + amtdeltatime).toLocaleString(), 'syncClock()', xxAccountAdminName)); } if (amtdeltatime) { x += TableEntry("Date & Time", addLinkConditional(new Date(new Date().getTime() + amtdeltatime).toLocaleString(), 'syncClock()', xxAccountAdminName)); }
var buttons = AddRefreshButton('PullSystemStatus()') + " "; var buttons = AddRefreshButton('PullSystemStatus()') + ' ';
// ###BEGIN###{PowerControl} // ###BEGIN###{PowerControl}
buttons += AddButton("Power Actions...", 'showPowerActionDlg()') + " "; buttons += AddButton("Power Actions...", 'showPowerActionDlg()') + ' ';
// ###END###{PowerControl} // ###END###{PowerControl}
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
buttons += AddButton("Save State...", 'saveEntireAmtState()') + " "; buttons += AddButton("Save State...", 'saveEntireAmtState()') + ' ';
// ###END###{FileSaver} // ###END###{FileSaver}
// ###BEGIN###{Scripting} // ###BEGIN###{Scripting}
buttons += AddButton("Run Script...", 'script_runScriptDlg()') + " "; buttons += AddButton("Run Script...", 'script_runScriptDlg()') + ' ';
// ###END###{Scripting} // ###END###{Scripting}
x += TableEnd(buttons); x += TableEnd(buttons);
QH('id_TableSysStatus', x); QH('id_TableSysStatus', x);
@@ -5296,7 +5312,7 @@
x += TableEntry("Name & Domain", addLinkConditional(host + fqdnshare, 'showEditNameDlg(1)', xxAccountAdminName)); x += TableEntry("Name & Domain", addLinkConditional(host + fqdnshare, 'showEditNameDlg(1)', xxAccountAdminName));
// Dynamic DNS // Dynamic DNS
var ddns = 'Disabled'; var ddns = "Disabled";
if (gs['DDNSUpdateEnabled'] == true) { if (gs['DDNSUpdateEnabled'] == true) {
ddns = "Enabled each " + gs['DDNSPeriodicUpdateInterval'] + " minutes, TTL is " + gs['DDNSTTL'] + " minutes"; ddns = "Enabled each " + gs['DDNSPeriodicUpdateInterval'] + " minutes, TTL is " + gs['DDNSTTL'] + " minutes";
} else if (gs['DDNSUpdateByDHCPServerEnabled'] == true) { } else if (gs['DDNSUpdateByDHCPServerEnabled'] == true) {
@@ -5310,7 +5326,7 @@
if (z['WLANLinkProtectionLevel'] || (y == 1)) { amtwirelessif = y; } // Set the wireless interface, this seems to cover new wireless only computers and older computers with dual interfaces. if (z['WLANLinkProtectionLevel'] || (y == 1)) { amtwirelessif = y; } // Set the wireless interface, this seems to cover new wireless only computers and older computers with dual interfaces.
if ((y == 0) && (amtwirelessif != y) && (z['MACAddress'] == '00-00-00-00-00-00')) { continue; } // On computers with only wireless, the wired interface will have a null MAC, skip it. if ((y == 0) && (amtwirelessif != y) && (z['MACAddress'] == '00-00-00-00-00-00')) { continue; } // On computers with only wireless, the wired interface will have a null MAC, skip it.
if (y == 0) systemdefense++; if (y == 0) systemdefense++;
x += '<br><h2>' + ((amtwirelessif == y)?"Wireless":"Wired") + " Interface</h2>"; x += '<br><h2>' + ((amtwirelessif == y)?"Wireless Interface":"Wired Interface") + '</h2>';
x += TableStart(); x += TableStart();
/* /*
@@ -5367,7 +5383,7 @@
// Display IPv4 current settings // Display IPv4 current settings
x += TableEntry("IPv4 address", isIpAddress(z['IPAddress'],"None")); x += TableEntry("IPv4 address", isIpAddress(z['IPAddress'],"None"));
if (isIpAddress(z['DefaultGateway'])) { x += TableEntry("IPv4 gateway / Mask", z['DefaultGateway'] + " / " + isIpAddress(z['SubnetMask'],"None")); } if (isIpAddress(z['DefaultGateway'])) { x += TableEntry("IPv4 gateway / Mask", z['DefaultGateway'] + ' / ' + isIpAddress(z['SubnetMask'],"None")); }
var dns = z['PrimaryDNS']; var dns = z['PrimaryDNS'];
if (isIpAddress(dns)) { if (isIpAddress(dns)) {
@@ -5378,7 +5394,7 @@
if ((amtsysstate['IPS_IPv6PortSettings'].status == 200) && (amtversion > 5)) { if ((amtsysstate['IPS_IPv6PortSettings'].status == 200) && (amtversion > 5)) {
// Check if IPv6 is enabled for this interface // Check if IPv6 is enabled for this interface
var zz = amtsysstate['IPS_IPv6PortSettings'].responses[y]; var zz = amtsysstate['IPS_IPv6PortSettings'].responses[y];
var ipv6state = 'Disabled', ipv6, ipv6manual, elementSettings = amtsysstate['CIM_ElementSettingData'].responses; var ipv6state = "Disabled", ipv6, ipv6manual, elementSettings = amtsysstate['CIM_ElementSettingData'].responses;
for (var i = 0; i < elementSettings.length; i++) { for (var i = 0; i < elementSettings.length; i++) {
if (elementSettings[i]['SettingData'] && elementSettings[i]['SettingData']['ReferenceParameters']['SelectorSet']['Selector']['Value'] == 'Intel(r) IPS IPv6 Settings ' + y) { if (elementSettings[i]['SettingData'] && elementSettings[i]['SettingData']['ReferenceParameters']['SelectorSet']['Selector']['Value'] == 'Intel(r) IPS IPv6 Settings ' + y) {
ipv6 = (elementSettings[i]['IsCurrent'] == 1); ipv6 = (elementSettings[i]['IsCurrent'] == 1);
@@ -5388,7 +5404,7 @@
// Check if manual addresses have been added // Check if manual addresses have been added
if (ipv6 == true) { if (ipv6 == true) {
ipv6manual = isIpAddress(zz['IPv6Address']) || isIpAddress(zz['DefaultRouter']) || isIpAddress(zz['PrimaryDNS']) || isIpAddress(zz['SecondaryDNS']); ipv6manual = isIpAddress(zz['IPv6Address']) || isIpAddress(zz['DefaultRouter']) || isIpAddress(zz['PrimaryDNS']) || isIpAddress(zz['SecondaryDNS']);
ipv6state = 'Enabled, Automatic ' + (ipv6manual?"& manual":'') + " addresses"; ipv6state = (ipv6manual ? "Enabled, Automatic & manual addresses" : "Enabled, Automatic addresses");
} }
// Display IPv6 current settings // Display IPv6 current settings
@@ -5441,10 +5457,10 @@
function showLinkPolicyDlg(y) { function showLinkPolicyDlg(y) {
if (xxdialogMode) return; if (xxdialogMode) return;
var z = amtsysstate['AMT_EthernetPortSettings'].responses[y], s = ''; var z = amtsysstate['AMT_EthernetPortSettings'].responses[y], s = '';
s += '<label><input type=checkbox id=d11p1 value=1 ' + ((z['LinkPolicy'].indexOf(1) >= 0) ? "checked" : '') + '>Available in S0/AC - Powered on & plugged in</label><br>'; s += '<label><input type=checkbox id=d11p1 value=1 ' + ((z['LinkPolicy'].indexOf(1) >= 0) ? 'checked' : '') + '>Available in S0/AC - Powered on & plugged in</label><br>';
s += '<label><input type=checkbox id=d11p2 value=14 ' + ((z['LinkPolicy'].indexOf(14) >= 0) ? "checked" : '') + '>Available in Sx/AC - Sleeping & plugged in</label><br>'; s += '<label><input type=checkbox id=d11p2 value=14 ' + ((z['LinkPolicy'].indexOf(14) >= 0) ? 'checked' : '') + '>Available in Sx/AC - Sleeping & plugged in</label><br>';
s += '<label><input type=checkbox id=d11p3 value=16 ' + ((z['LinkPolicy'].indexOf(16) >= 0) ? "checked" : '') + '>Available in S0/DC - Powered on & on battery</label><br>'; s += '<label><input type=checkbox id=d11p3 value=16 ' + ((z['LinkPolicy'].indexOf(16) >= 0) ? 'checked' : '') + '>Available in S0/DC - Powered on & on battery</label><br>';
s += '<label><input type=checkbox id=d11p4 value=224 ' + ((z['LinkPolicy'].indexOf(224) >= 0) ? "checked" : '') + '>Available in Sx/DC - Sleeping & on battery</label><br>'; s += '<label><input type=checkbox id=d11p4 value=224 ' + ((z['LinkPolicy'].indexOf(224) >= 0) ? 'checked' : '') + '>Available in Sx/DC - Sleeping & on battery</label><br>';
setDialogMode(11, "Link Policy", 3, showLinkPolicyDlgEx, s, y); setDialogMode(11, "Link Policy", 3, showLinkPolicyDlgEx, s, y);
} }
@@ -5481,7 +5497,7 @@
if (xxdialogMode) return; if (xxdialogMode) return;
var n = '', d = new Date(); var n = '', d = new Date();
if (amtsysstate) { n = '-' + amtsysstate['AMT_GeneralSettings'].response['HostName']; } if (amtsysstate) { n = '-' + amtsysstate['AMT_GeneralSettings'].response['HostName']; }
n += '-' + d.getFullYear() + '-' + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2);; n += '-' + d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);;
idx_d19savestatefilename.value = 'amtstate' + n + '.json'; idx_d19savestatefilename.value = 'amtstate' + n + '.json';
setDialogMode(19, "Save Entire Intel&reg; AMT State", 3, saveEntireAmtStateOk); setDialogMode(19, "Save Entire Intel&reg; AMT State", 3, saveEntireAmtStateOk);
} }
@@ -5569,7 +5585,7 @@
} }
function showDesktopSettingsDlgOk3(stack, name, response, status) { function showDesktopSettingsDlgOk3(stack, name, response, status) {
if (status != 200) { messagebox("Error", "Screen Blanking could not be set, blanking may not be supported on this system (" + status + ")."); return; } if (status != 200) { messagebox("Error", format("Screen Blanking could not be set, blanking may not be supported on this system ({0}).", status)); return; }
amtstack.Get('IPS_ScreenConfigurationService', function (stack, name, response, status) { amtstack.Get('IPS_ScreenConfigurationService', function (stack, name, response, status) {
if (status == 200) { amtsysstate['IPS_ScreenConfigurationService'].response = response.Body; updateSystemStatus(); } if (status == 200) { amtsysstate['IPS_ScreenConfigurationService'].response = response.Body; updateSystemStatus(); }
}, 0, 1); }, 0, 1);
@@ -5599,10 +5615,10 @@
if (processMessageLog0responses != null) { fr = ((processMessageLog0responses[0]['IsFrozen'] == true) ? AddButton("Un-freeze Log", 'FreezeLog(0)') : AddButton("Freeze Log", 'FreezeLog(1)')); } if (processMessageLog0responses != null) { fr = ((processMessageLog0responses[0]['IsFrozen'] == true) ? AddButton("Un-freeze Log", 'FreezeLog(0)') : AddButton("Freeze Log", 'FreezeLog(1)')); }
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
x += TableEnd('<div style=float:right><input id=eventFilter placeholder=Filter style=margin:4px onkeyup=eventFilter()>&nbsp;</div><div>&nbsp;' + AddRefreshButton('PullEventLog(1)') + AddButton("Clear Log", 'ClearLog()') + fr); x += TableEnd('<div style=float:right><input id=eventFilter placeholder="' + "Filter" + '" style=margin:4px onkeyup=eventFilter()>&nbsp;</div><div>&nbsp;' + AddRefreshButton('PullEventLog(1)') + AddButton("Clear Log", 'ClearLog()') + fr);
// ###END###{!FileSaver} // ###END###{!FileSaver}
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
x += TableEnd('<div style=float:right><input id=eventFilter placeholder=Filter style=margin:4px onkeyup=eventFilter()>&nbsp;</div><div>&nbsp;' + AddRefreshButton('PullEventLog(1)') + AddButton("Clear Log", 'ClearLog()') + AddButton("Save...", 'SaveEventLog()') + fr); x += TableEnd('<div style=float:right><input id=eventFilter placeholder="' + "Filter" + '" style=margin:4px onkeyup=eventFilter()>&nbsp;</div><div>&nbsp;' + AddRefreshButton('PullEventLog(1)') + AddButton("Clear Log", 'ClearLog()') + AddButton("Save...", 'SaveEventLog()') + fr);
// ###END###{FileSaver} // ###END###{FileSaver}
QH('id_TableEventLog', x + '<br>'); QH('id_TableEventLog', x + '<br>');
} }
@@ -5623,7 +5639,7 @@
y++; y++;
var icon = 1, m = messages[i]; var icon = 1, m = messages[i];
if (m['EventSeverity'] >= 8) { icon = 2; } if (m['EventSeverity'] >= 16) { icon = 3; } if (m['EventSeverity'] >= 8) { icon = 2; } if (m['EventSeverity'] >= 16) { icon = 3; }
x += '<tr id=xamtevent' + i + ' class=r3 onclick=showEventDetails(' + i + ')><td class=r1><p><div class=icon' + icon + ' style=display:block;float:left;margin-left:5px;margin-right:5px></div>' + (parseInt(i) + 1) + '<td class=r1 title="' + m['Time'].toLocaleString() + '">' + m['Time'].toLocaleDateString('en', { year: "numeric", month: "2-digit", day: "numeric" }) + '<br>' + m['Time'].toLocaleTimeString('en', { hour:"2-digit", minute:"2-digit", second:"2-digit" }) + '<td class=r1>' + m['EntityStr'].replace("(r)", "&reg;") + '<td class=r1>' + m['Desc']; x += '<tr id=xamtevent' + i + ' class=r3 onclick=showEventDetails(' + i + ')><td class=r1><p><div class=icon' + icon + ' style=display:block;float:left;margin-left:5px;margin-right:5px></div>' + (parseInt(i) + 1) + '<td class=r1 title="' + m['Time'].toLocaleString() + '">' + m['Time'].toLocaleDateString('en', { year: 'numeric', month: '2-digit', day: 'numeric' }) + '<br>' + m['Time'].toLocaleTimeString('en', { hour:'2-digit', minute:'2-digit', second:'2-digit' }) + '<td class=r1>' + m['EntityStr'].replace('(r)', '&reg;') + '<td class=r1>' + m['Desc'];
} }
x += TableEnd(y == 0 ? '&nbsp;' : ''); x += TableEnd(y == 0 ? '&nbsp;' : '');
QH('id_TableEventLog2', x + '<br>'); QH('id_TableEventLog2', x + '<br>');
@@ -5733,7 +5749,7 @@
for (var i in subscriptionsFilters) { x += '<option value="' + subscriptionsFilters[i]['InstanceID'] + '">' + subscriptionsFilters[i]['CollectionName'].substring(13) + '</option>'; } for (var i in subscriptionsFilters) { x += '<option value="' + subscriptionsFilters[i]['InstanceID'] + '">' + subscriptionsFilters[i]['CollectionName'].substring(13) + '</option>'; }
x += '</select><div style=padding-top:4px>' + "Filter" + '</div></div>'; x += '</select><div style=padding-top:4px>' + "Filter" + '</div></div>';
x += '<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value="http://"><div style=padding-top:4px>' + "URL" + '</div></div>'; x += '<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value="http://"><div style=padding-top:4px>' + "URL" + '</div></div>';
x += '<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>None</option><option value=1>' + "Digest" + '</option></select><div style=padding-top:4px>' + "Authentication" + '</div></div>'; x += '<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>' + "None" + '</option><option value=1>' + "Digest" + '</option></select><div style=padding-top:4px>' + "Authentication" + '</div></div>';
x += '<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>' + "Username" + '</div></div>'; x += '<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>' + "Username" + '</div></div>';
x += '<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>' + "Password" + '</div></div>'; x += '<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>' + "Password" + '</div></div>';
x += '<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>' + "Arguments" + '</div></div>'; x += '<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>' + "Arguments" + '</div></div>';
@@ -5799,10 +5815,10 @@
auditLog = messages; auditLog = messages;
var i, x = '<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>'; var i, x = '<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>';
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
x += TableEnd('<div style=float:right><input id=auditFilter placeholder=Filter style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> ' + AddRefreshButton('PullAuditLog(1)') + AddButton("Clear Log", 'ClearAuditLog()') /* + AddButton("Settings...", 'ShowAuditLogSettings()')*/) + '<br>'; x += TableEnd('<div style=float:right><input id=auditFilter placeholder="' + "Filter" + '" style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> ' + AddRefreshButton('PullAuditLog(1)') + AddButton("Clear Log", 'ClearAuditLog()') /* + AddButton("Settings...", 'ShowAuditLogSettings()')*/) + '<br>';
// ###END###{!FileSaver} // ###END###{!FileSaver}
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
x += TableEnd('<div style=float:right><input id=auditFilter placeholder=Filter style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> ' + AddRefreshButton('PullAuditLog(1)') + AddButton("Save...", 'SaveAuditLog()') + AddButton("Clear Log", 'ClearAuditLog()') /* + AddButton("Settings...", 'ShowAuditLogSettings()')*/) + '<br>'; x += TableEnd('<div style=float:right><input id=auditFilter placeholder="' + "Filter" + '" style=margin:4px onkeyup=auditFilter()>&nbsp;</div><div> ' + AddRefreshButton('PullAuditLog(1)') + AddButton("Save...", 'SaveAuditLog()') + AddButton("Clear Log", 'ClearAuditLog()') /* + AddButton("Settings...", 'ShowAuditLogSettings()')*/) + '<br>';
// ###END###{FileSaver} // ###END###{FileSaver}
if (messages.length == 0) { if (messages.length == 0) {
x = "No audit log events found."; x = "No audit log events found.";
@@ -5818,7 +5834,7 @@
if (m['Event']) description += ", " + m['Event']; if (m['Event']) description += ", " + m['Event'];
if (m['ExStr'] != null) description += ", " + m['ExStr']; if (m['ExStr'] != null) description += ", " + m['ExStr'];
if (initiator != '' && addr != '') initiator += ", "; if (initiator != '' && addr != '') initiator += ", ";
x += '<tr id=xamtaudit' + i + ' class=r3 onclick=showAuditDetails(' + i + ')><td class=r1 title="' + m['Time'].toLocaleString() + '">&nbsp;&nbsp;' + m['Time'].toLocaleDateString('en', { year: "numeric", month: "2-digit", day: "numeric" }) + '<br>&nbsp;&nbsp;' + m['Time'].toLocaleTimeString('en', { hour:"2-digit", minute:"2-digit", second:"2-digit" }) + '<td class=r1>' + initiator + addr + '<td class=r1>' + description; x += '<tr id=xamtaudit' + i + ' class=r3 onclick=showAuditDetails(' + i + ')><td class=r1 title="' + m['Time'].toLocaleString() + '">&nbsp;&nbsp;' + m['Time'].toLocaleDateString('en', { year: 'numeric', month: '2-digit', day: 'numeric' }) + '<br>&nbsp;&nbsp;' + m['Time'].toLocaleTimeString('en', { hour:'2-digit', minute:'2-digit', second:'2-digit' }) + '<td class=r1>' + initiator + addr + '<td class=r1>' + description;
} }
x += TableEnd(y == 0 ? '&nbsp;' : '') + '<br>'; x += TableEnd(y == 0 ? '&nbsp;' : '') + '<br>';
} }
@@ -5932,10 +5948,10 @@
function getTlsSecurityState(x) { function getTlsSecurityState(x) {
if (xxTlsSettings[x]['Enabled'] == false) return "Disabled"; if (xxTlsSettings[x]['Enabled'] == false) return "Disabled";
var r = ((xxTlsSettings[x]['MutualAuthentication'] == true) ? 'Mutual-auth TLS' : 'Server-auth TLS') + ((xxTlsSettings[x]['AcceptNonSecureConnections'] == true) ? " and non-TLS" : ''); var r = ((xxTlsSettings[x]['MutualAuthentication'] == true) ? "Mutual-auth TLS" : "Server-auth TLS") + ((xxTlsSettings[x]['AcceptNonSecureConnections'] == true) ? " and non-TLS" : '');
if ((xxTlsSettings[x]['MutualAuthentication'] == true) && (xxTlsSettings[x]['TrustedCN'])) { if ((xxTlsSettings[x]['MutualAuthentication'] == true) && (xxTlsSettings[x]['TrustedCN'])) {
var trustedCn = MakeToArray(xxTlsSettings[x]['TrustedCN']); var trustedCn = MakeToArray(xxTlsSettings[x]['TrustedCN']);
if (trustedCn.length > 0) { r += ", Trusted name" + ((trustedCn.length > 1)?'s':'') + ": " + trustedCn.join(', ') + "."; } if (trustedCn.length > 0) { r += ', ' + ((trustedCn.length > 1) ? 'Trusted names' : 'Trusted name') + ': ' + trustedCn.join(', ') + '.'; }
} }
return r; return r;
} }
@@ -5984,7 +6000,7 @@
if (xxdialogMode) return; if (xxdialogMode) return;
var c = xxCertificates[h], x = '<br>'; var c = xxCertificates[h], x = '<br>';
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes, <a style=cursor:pointer;color:blue onclick=downloadCert(" + h + ")>Download</a>"); x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=downloadCert(' + h + ')>' + "Download" + '</a>');
// ###END###{FileSaver} // ###END###{FileSaver}
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes"); x += addHtmlValue("Certificate", c.X509Certificate.length + " bytes");
@@ -6008,7 +6024,7 @@
} }
*/ */
x += '<br><div style="border-bottom:1px solid gray"><i>Certificate Subject</i></div><br>'; x += '<br><div style="border-bottom:1px solid gray"><i>' + "Certificate Subject" + '</i></div><br>';
for (var i in c.XSubject) { if (c.XSubject[i]) { x += addHtmlValue(xxCertSubjectNames[i] ? xxCertSubjectNames[i] : i, EscapeHtml(c.XSubject[i])); } } for (var i in c.XSubject) { if (c.XSubject[i]) { x += addHtmlValue(xxCertSubjectNames[i] ? xxCertSubjectNames[i] : i, EscapeHtml(c.XSubject[i])); } }
// x += addHtmlValueNoTitle("Fingerprint", c.fingerprint.substring(0,29) + '<br />' + c.fingerprint.substring(30)); // TODO: Parse the certificate using Forge and get the fingerprint // x += addHtmlValueNoTitle("Fingerprint", c.fingerprint.substring(0,29) + '<br />' + c.fingerprint.substring(30)); // TODO: Parse the certificate using Forge and get the fingerprint
x += '<br><div style="border-bottom:1px solid gray"><i>' + "Issuer Certificate" + '</i></div><br>'; x += '<br><div style="border-bottom:1px solid gray"><i>' + "Issuer Certificate" + '</i></div><br>';
@@ -6847,7 +6863,7 @@
if (xxdialogMode) return; if (xxdialogMode) return;
var x = ''; var x = '';
x += '<div style=height:26px;margin-top:4px><select id=policySelection style=float:right;width:266px><option value=-1>' + "None"; x += '<div style=height:26px;margin-top:4px><select id=policySelection style=float:right;width:266px><option value=-1>' + "None";
for (var i in xxSystemDefense['AMT_SystemDefensePolicy'].responses) { x += '<option value=' + i + ((xxSystemDefenceLinkedPolicy[network] && xxSystemDefense['AMT_SystemDefensePolicy'].responses[i]['InstanceID'] == xxSystemDefenceLinkedPolicy[network]['InstanceID']) ? ' selected' : '') + ">" + xxSystemDefense['AMT_SystemDefensePolicy'].responses[i]['PolicyName']; } for (var i in xxSystemDefense['AMT_SystemDefensePolicy'].responses) { x += '<option value=' + i + ((xxSystemDefenceLinkedPolicy[network] && xxSystemDefense['AMT_SystemDefensePolicy'].responses[i]['InstanceID'] == xxSystemDefenceLinkedPolicy[network]['InstanceID']) ? ' selected' : '') + '>' + xxSystemDefense['AMT_SystemDefensePolicy'].responses[i]['PolicyName']; }
x += '</select><div style=padding-top:4px>' + "Default Policy" + '</div></div>'; x += '</select><div style=padding-top:4px>' + "Default Policy" + '</div></div>';
setDialogMode(11, "Default System Defense Policy", 3, changeDefaultPolicyOk, x, network); setDialogMode(11, "Default System Defense Policy", 3, changeDefaultPolicyOk, x, network);
} }
@@ -7005,11 +7021,11 @@
x += '<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>'; x += '<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>';
for (var i in xxSystemDefense['AMT_Hdr8021Filter'].responses) { for (var i in xxSystemDefense['AMT_Hdr8021Filter'].responses) {
var filter = xxSystemDefense['AMT_Hdr8021Filter'].responses[i]; var filter = xxSystemDefense['AMT_Hdr8021Filter'].responses[i];
x += '<option value=' + filter['InstanceID'] + ">" + filter['Name']; x += '<option value=' + filter['InstanceID'] + '>' + filter['Name'];
} }
for (var i in xxSystemDefense['AMT_IPHeadersFilter'].responses) { for (var i in xxSystemDefense['AMT_IPHeadersFilter'].responses) {
var filter = xxSystemDefense['AMT_IPHeadersFilter'].responses[i]; var filter = xxSystemDefense['AMT_IPHeadersFilter'].responses[i];
x += '<option value=' + filter['InstanceID'] + ">" + filter['Name']; x += '<option value=' + filter['InstanceID'] + '>' + filter['Name'];
} }
x += '</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>' + "Add Filter" + '</div></div>'; x += '</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>' + "Add Filter" + '</div></div>';
} }
@@ -7271,17 +7287,17 @@
// http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf // http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf
var DMTFCPUStatus = ["Unknown", "Enabled", "Disabled by User", "Disabled By BIOS (POST Error)", "Idle", "Other"]; var DMTFCPUStatus = ["Unknown", "Enabled", "Disabled by User", "Disabled By BIOS (POST Error)", "Idle", "Other"];
var DMTFMemType = ["Unknown", "Other", "DRAM", "Synchronous DRAM", "Cache DRAM", "EDO", "EDRAM", "VRAM", "SRAM", "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", "RDRAM", "DDR", "DDR-2", "BRAM", "FB-DIMM", "DDR3", "FBD2", "DDR4", "LPDDR", "LPDDR2", "LPDDR3", "LPDDR4"]; var DMTFMemType = ["Unknown", "Other", "DRAM", "Synchronous DRAM", "Cache DRAM", "EDO", "EDRAM", "VRAM", "SRAM", "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", "RDRAM", "DDR", "DDR-2", "BRAM", "FB-DIMM", "DDR3", "FBD2", "DDR4", "LPDDR", "LPDDR2", "LPDDR3", "LPDDR4"];
var DMTFMemFormFactor = ['', 'Other','Unknown','SIMM','SIP','Chip','DIP','ZIP','Proprietary Card','DIMM','TSOP','Row of chips','RIMM','SODIMM','SRIMM','FB-DIM']; var DMTFMemFormFactor = ['', "Other","Unknown","SIMM","SIP","Chip","DIP","ZIP","Proprietary Card","DIMM","TSOP","Row of chips","RIMM","SODIMM","SRIMM","FB-DIM"];
var DMTFProcFamilly = { // Page 46 of DMTF document var DMTFProcFamilly = { // Page 46 of DMTF document
191: 'Intel&reg; Core&trade; 2 Duo Processor', 191: "Intel&reg; Core&trade; 2 Duo Processor",
192: 'Intel&reg; Core&trade; 2 Solo processor', 192: "Intel&reg; Core&trade; 2 Solo processor",
193: 'Intel&reg; Core&trade; 2 Extreme processor', 193: "Intel&reg; Core&trade; 2 Extreme processor",
194: 'Intel&reg; Core&trade; 2 Quad processor', 194: "Intel&reg; Core&trade; 2 Quad processor",
195: 'Intel&reg; Core&trade; 2 Extreme mobile processor', 195: "Intel&reg; Core&trade; 2 Extreme mobile processor",
196: 'Intel&reg; Core&trade; 2 Duo mobile processor', 196: "Intel&reg; Core&trade; 2 Duo mobile processor",
197: 'Intel&reg; Core&trade; 2 Solo mobile processor', 197: "Intel&reg; Core&trade; 2 Solo mobile processor",
198: 'Intel&reg; Core&trade; i7 processor', 198: "Intel&reg; Core&trade; i7 processor",
199: 'Dual-Core Intel&reg; Celeron&reg; processor' }; 199: "Dual-Core Intel&reg; Celeron&reg; processor" };
var HardwareInventory; var HardwareInventory;
function processHardware(stack, name, responses, status) { function processHardware(stack, name, responses, status) {
@@ -7362,7 +7378,7 @@
// Now find the name of the power schema in the AMT_SystemPowerScheme table // Now find the name of the power schema in the AMT_SystemPowerScheme table
for (var j = 0; j < AmtSystemPowerSchemes.length; j++) { for (var j = 0; j < AmtSystemPowerSchemes.length; j++) {
var selected = ((AmtSystemPowerSchemes[j]['SchemeGUID'] == currentguid)?' checked':''); var selected = ((AmtSystemPowerSchemes[j]['SchemeGUID'] == currentguid)?' checked':'');
s += '<input type=radio name=powerpolicy value=\"' + AmtSystemPowerSchemes[j]['InstanceID'] + "\" " + selected + '>' + AmtSystemPowerSchemes[j]['Description'] + '<br>'; s += '<input type=radio name=powerpolicy value=\"' + AmtSystemPowerSchemes[j]['InstanceID'] + '\" ' + selected + '>' + AmtSystemPowerSchemes[j]['Description'] + '<br>';
} }
setDialogMode(11, "Intel&reg; AMT Power Policy", 3, showPowerPolicyDlgOk, s); setDialogMode(11, "Intel&reg; AMT Power Policy", 3, showPowerPolicyDlgOk, s);
@@ -7459,8 +7475,8 @@
r['Handle'] = -1; r['Handle'] = -1;
} }
x += '<div class=itemBar onclick=showUserDetails(' + r['Handle'] + ')><div style=float:right>'; x += '<div class=itemBar onclick=showUserDetails(' + r['Handle'] + ')><div style=float:right>';
if (state > 0 && xxAccountAdminName) x += " " + AddButton2((state == 1?'Disable':'Enable'), 'changeAccountStateButton(event,' + r['Handle'] + ',' + state + ')'); if (state > 0 && xxAccountAdminName) x += ' ' + AddButton2((state == 1?'Disable':'Enable'), 'changeAccountStateButton(event,' + r['Handle'] + ',' + state + ')');
if (!hidden && xxAccountAdminName) x += " " + AddButton2("Edit...", 'changeAccountButton(event,' + r['Handle'] + ')'); if (!hidden && xxAccountAdminName) x += ' ' + AddButton2("Edit...", 'changeAccountButton(event,' + r['Handle'] + ')');
x += '</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="' + name + '"><b>' + name + '</b></div><div style=padding-top:3px>' + rb + '</div></div>'; x += '</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title="' + name + '"><b>' + name + '</b></div><div style=padding-top:3px>' + rb + '</div></div>';
} }
} }
@@ -7525,7 +7541,7 @@
function updateRealms(r) { function updateRealms(r) {
QV('id_d2permissions', r != null); QV('id_d2permissions', r != null);
if (r != null) { if (r != null) {
var x = '<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3' + ((r.indexOf(3) >= 0)?' checked':'') + '>Administrator</label></li><hr />'; var x = '<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3' + ((r.indexOf(3) >= 0)?' checked':'') + '>' + "Administrator" + '</label></li><hr />';
for (var y in amtstack.RealmNames) { var c = ''; if (r.indexOf(parseInt(y)) >= 0) c = ' checked'; if (amtstack.RealmNames[y]) x += '<li><label><input type=checkbox onchange=updateAccountDialog() id=rx' + y + c + '>' + amtstack.RealmNames[y] + '</label></li>'; } for (var y in amtstack.RealmNames) { var c = ''; if (r.indexOf(parseInt(y)) >= 0) c = ' checked'; if (amtstack.RealmNames[y]) x += '<li><label><input type=checkbox onchange=updateAccountDialog() id=rx' + y + c + '>' + amtstack.RealmNames[y] + '</label></li>'; }
QH('id_d2realms', x); QH('id_d2realms', x);
} }
@@ -7545,7 +7561,7 @@
var i, n = a['DigestUsername']; var i, n = a['DigestUsername'];
if (!n) n = GetSidString(atob(a['KerberosUserSid'])); if (!n) n = GetSidString(atob(a['KerberosUserSid']));
x += addHtmlValue("Name", n); x += addHtmlValue("Name", n);
if (xxAccountEnabledInfo[h]) { x += addHtmlValue("State", ((xxAccountEnabledInfo[h]['Enabled'] == true)?'Enabled':'Disabled')); } if (xxAccountEnabledInfo[h]) { x += addHtmlValue("State", ((xxAccountEnabledInfo[h]['Enabled'] == true)?"Enabled":"Disabled")); }
if (n == xxAccountAdminName) { if (n == xxAccountAdminName) {
x += addHtmlValue("Permission", "Administrator"); x += addHtmlValue("Permission", "Administrator");
} else { } else {
@@ -7724,8 +7740,8 @@
} else { } else {
if (terminal.m.capture.length > 0) { if (terminal.m.capture.length > 0) {
var n = 'TerminalCapture', d = new Date(); var n = 'TerminalCapture', d = new Date();
if (amtsysstate) { n += "-" + amtsysstate['AMT_GeneralSettings'].response['HostName']; } if (amtsysstate) { n += '-' + amtsysstate['AMT_GeneralSettings'].response['HostName']; }
n += '-' + d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2); n += '-' + d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);
// ###BEGIN###{!Mode-NodeWebkit} // ###BEGIN###{!Mode-NodeWebkit}
saveAs(data2blob(terminal.m.capture), n + '.txt'); saveAs(data2blob(terminal.m.capture), n + '.txt');
delete terminal.m.capture; delete terminal.m.capture;
@@ -8276,8 +8292,8 @@
function deskSaveImage() { function deskSaveImage() {
if (xxdialogMode || desktop.State != 3) return; if (xxdialogMode || desktop.State != 3) return;
var n = 'Desktop', d = new Date(); var n = 'Desktop', d = new Date();
if (amtsysstate) { n += "-" + amtsysstate['AMT_GeneralSettings'].response['HostName']; } if (amtsysstate) { n += '-' + amtsysstate['AMT_GeneralSettings'].response['HostName']; }
n += '-' + d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2); n += '-' + d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);
Q('Desk')['toBlob']( Q('Desk')['toBlob'](
function(blob) { function(blob) {
// ###BEGIN###{!Mode-NodeWebkit} // ###BEGIN###{!Mode-NodeWebkit}
@@ -8338,7 +8354,7 @@
if (data.action == 'download') { p24gotDownloadCommand(data); return; } if (data.action == 'download') { p24gotDownloadCommand(data); return; }
if (data.action == 'upload') { p24gotUploadData(data); return; } if (data.action == 'upload') { p24gotUploadData(data); return; }
if (data.action == 'pong') { return; } if (data.action == 'pong') { return; }
data.path = data.path.replace(/\//g, "\\"); data.path = data.path.replace(/\//g, '\\');
if ((p24filetree != null) && (data.path == p24filetree.path)) { if ((p24filetree != null) && (data.path == p24filetree.path)) {
// This is an update to the same folder // This is an update to the same folder
var checkedNames = p24getCheckedNames(); var checkedNames = p24getCheckedNames();
@@ -8384,12 +8400,12 @@
// Figure out the name and shortname // Figure out the name and shortname
var f = filetreexx[i], name = f.n, shortname; var f = filetreexx[i], name = f.n, shortname;
shortname = name; shortname = name;
if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "...</span>"; } else { shortname = EscapeHtml(name); } if (name.length > 70) { shortname = '<span title="' + EscapeHtml(name) + '">' + EscapeHtml(name.substring(0, 70)) + "..." + '</span>'; } else { shortname = EscapeHtml(name); }
name = EscapeHtml(name); name = EscapeHtml(name);
// Figure out the date // Figure out the date
var fdatestr = ''; var fdatestr = '';
if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + "/" + (fdate.getDate()) + "/" + fdate.getFullYear() + " " + fdate.toLocaleTimeString() + "&nbsp;"; } if (f.d != null) { var fdate = new Date(f.d), fdatestr = (fdate.getMonth() + 1) + '/' + (fdate.getDate()) + '/' + fdate.getFullYear() + ' ' + fdate.toLocaleTimeString() + '&nbsp;'; }
// Figure out the size // Figure out the size
var fsize = ''; var fsize = '';
@@ -8699,10 +8715,10 @@
// ###END###{IDER-IMRSDK} // ###END###{IDER-IMRSDK}
// Setup the IDER session (WebSocket) // Setup the IDER session (WebSocket)
var x = '<div>Mount disk images on a Intel&reg; AMT computer - Experimental.</div><br />'; var x = '<div>' + "Mount disk images on a Intel&reg; AMT computer - Experimental." + '</div><br />';
x += '<div style=height:26px><input id=floppyImageInput type=file style=float:right;width:250px accept=".img"><div>Floppy&nbsp;(.img)</div></div>'; x += '<div style=height:26px><input id=floppyImageInput type=file style=float:right;width:250px accept=".img"><div>' + NoBreak("Floppy (.img)") + '</div></div>';
x += '<div style=height:26px><input id=cdromImageInput type=file style=float:right;width:250px accept=".iso"><div>CDROM&nbsp;(.iso)</div></div>'; x += '<div style=height:26px><input id=cdromImageInput type=file style=float:right;width:250px accept=".iso"><div>' + NoBreak("CDROM (.iso)") + '</div></div>';
x += '<div style=height:26px><select id=iderStartType style=float:right;width:250px><option value=0>On next boot<option value=1>Graceful<option value=2>Immediate</select><div>Session Start</div></div>'; x += '<div style=height:26px><select id=iderStartType style=float:right;width:250px><option value=0>' + "On next boot" + '<option value=1>' + "Graceful" + '<option value=2>' + "Immediate" + '</select><div>' + "Session Start" + '</div></div>';
setDialogMode(11, "Storage Redirection", 3, iderStart2, x); setDialogMode(11, "Storage Redirection", 3, iderStart2, x);
var iderurl = null; var iderurl = null;
try { iderurl = localStorage.getItem('iderurl'); } catch (ex) { } try { iderurl = localStorage.getItem('iderurl'); } catch (ex) { }
@@ -8965,9 +8981,9 @@
xxPolicies = { 'User': [], 'Alert': [], 'Periodic': [] }; xxPolicies = { 'User': [], 'Alert': [], 'Periodic': [] };
for (var i in responses['AMT_RemoteAccessPolicyAppliesToMPS'].responses) { for (var i in responses['AMT_RemoteAccessPolicyAppliesToMPS'].responses) {
var policy = responses['AMT_RemoteAccessPolicyAppliesToMPS'].responses[i]; var policy = responses['AMT_RemoteAccessPolicyAppliesToMPS'].responses[i];
var server = Clone(getItem(xxCiraServers, "Name", getItem(policy['ManagedElement']['ReferenceParameters']['SelectorSet']['Selector'], "@Name", "Name")['Value'])); var server = Clone(getItem(xxCiraServers, 'Name', getItem(policy['ManagedElement']['ReferenceParameters']['SelectorSet']['Selector'], '@Name', 'Name')['Value']));
server.MpsType = policy['MpsType']; // MpsType was added in Intel AMT 11.6 server.MpsType = policy['MpsType']; // MpsType was added in Intel AMT 11.6
var ptype = (getItem(policy['PolicySet']['ReferenceParameters']['SelectorSet']['Selector'], "@Name", "PolicyRuleName")['Value']).split(' ')[0]; var ptype = (getItem(policy['PolicySet']['ReferenceParameters']['SelectorSet']['Selector'], '@Name', 'PolicyRuleName')['Value']).split(' ')[0];
xxPolicies[ptype].push(server); xxPolicies[ptype].push(server);
} }
@@ -8976,8 +8992,8 @@
function updateRemoteAccess() { function updateRemoteAccess() {
if (xxEnvironementDetection == null) return; if (xxEnvironementDetection == null) return;
var x = '', e = 'Disabled', ciraProxySupport = (xxRemoteAccess['IPS_HTTPProxyService'] && xxRemoteAccess['IPS_HTTPProxyAccessPoint']); var x = '', e = "Disabled", ciraProxySupport = (xxRemoteAccess['IPS_HTTPProxyService'] && xxRemoteAccess['IPS_HTTPProxyAccessPoint']);
if (xxEnvironementDetection['DetectionStrings'] && xxEnvironementDetection['DetectionStrings'].length > 0) { e = 'Enabled, ' + xxEnvironementDetection['DetectionStrings'].length + ' domain' + (xxEnvironementDetection['DetectionStrings'].length > 1?'s':''); } if (xxEnvironementDetection['DetectionStrings'] && xxEnvironementDetection['DetectionStrings'].length > 0) { e = "Enabled, " + xxEnvironementDetection['DetectionStrings'].length + ' ' + (xxEnvironementDetection['DetectionStrings'].length > 1?'domains':'domain'); }
// General settings // General settings
x += TableStart(); x += TableStart();
@@ -9390,7 +9406,7 @@
function showEditNameDlg(x) { function showEditNameDlg(x) {
if (xxdialogMode) return; if (xxdialogMode) return;
var t = amtsysstate['AMT_GeneralSettings'].response['HostName'], y = amtsysstate['AMT_GeneralSettings'].response['DomainName']; var t = amtsysstate['AMT_GeneralSettings'].response['HostName'], y = amtsysstate['AMT_GeneralSettings'].response['DomainName'];
if (y != null && y.length > 0) t += "." + y; if (y != null && y.length > 0) t += '.' + y;
var r = '<br><div style=height:26px><input id=d11name value="' + t + '" style=float:right;width:200px><div>' + "Name & Domain" + '</div></div>'; var r = '<br><div style=height:26px><input id=d11name value="' + t + '" style=float:right;width:200px><div>' + "Name & Domain" + '</div></div>';
if (x == 1) { if (x == 1) {
var s = (amtsysstate['AMT_GeneralSettings'].response['SharedFQDN'] == true); var s = (amtsysstate['AMT_GeneralSettings'].response['SharedFQDN'] == true);
@@ -9742,7 +9758,7 @@
setTimeout(function () { setDialogMode(0); }, 1300); setTimeout(function () { setDialogMode(0); }, 1300);
}); });
} else if ((action == 104) || (action == 105)) { } else if ((action == 104) || (action == 105)) {
var x = ("Confirm execution of Intel&reg Remote Secure Erase?" + '<br>' + "Enter Secure Erase password if required." + '<br>'); var x = ("Confirm execution of Intel&reg; Remote Secure Erase?" + '<br>' + "Enter Secure Erase password if required." + '<br>');
x += ('<br><div style=height:16px><input type=password id=rsepass maxlength=32 style=float:right;width:240px><div>' + "Password" + '</div></div>'); x += ('<br><div style=height:16px><input type=password id=rsepass maxlength=32 style=float:right;width:240px><div>' + "Password" + '</div></div>');
x += ('<br><div style=color:red>' + "<b>WARNING:</b> This will wipe data on the remote system." + '</div>'); x += ('<br><div style=color:red>' + "<b>WARNING:</b> This will wipe data on the remote system." + '</div>');
// ###BEGIN###{Mode-NodeWebkit} // ###BEGIN###{Mode-NodeWebkit}
@@ -10203,7 +10219,7 @@
if (i != ii || j != jj) { if (i != ii || j != jj) {
if (xx != '') { x += xx; xx = '<br>'; } if (xx != '') { x += xx; xx = '<br>'; }
ii = i; jj = j; ii = i; jj = j;
if (i != '') { xx += EscapeHtml(i + " / " + j); } else { xx += "Root"; } if (i != '') { xx += EscapeHtml(i + ' / ' + j); } else { xx += "Root"; }
} }
//var handle = "\"" + i + "\",\"" + j + "\",\"" + k + "\""; //var handle = "\"" + i + "\",\"" + j + "\",\"" + k + "\"";
var handle = '\"' + i + ((i != '') ? '/' : '') + j + ((j != '') ? '/' : '') + k + '\"'; var handle = '\"' + i + ((i != '') ? '/' : '') + j + ((j != '') ? '/' : '') + k + '\"';
@@ -10319,9 +10335,9 @@
} else { } else {
x += '<br><div style=height:20px><input id=mstoragefile style=float:right;width:240px readonly disabled=disabled value="' + filename + '" ><div>' + "Upload file" + '</div></div>'; x += '<br><div style=height:20px><input id=mstoragefile style=float:right;width:240px readonly disabled=disabled value="' + filename + '" ><div>' + "Upload file" + '</div></div>';
} }
x += '<br><div style=height:16px><input id=mstoragevendor placeholder=Vendor list=mstoragevendorlist maxlength=11 style=float:right;width:240px><div>' + "Vendor name" + '</div></div>'; x += '<br><div style=height:16px><input id=mstoragevendor placeholder="' + "Vendor" + '" list=mstoragevendorlist maxlength=11 style=float:right;width:240px><div>' + "Vendor name" + '</div></div>';
x += '<br><div style=height:16px><input id=mstorageapplication placeholder=App list=mstorageapplicationlist maxlength=11 style=float:right;width:240px><div>' + "Application name" + '</div></div>'; x += '<br><div style=height:16px><input id=mstorageapplication placeholder="' + "App" + '" list=mstorageapplicationlist maxlength=11 style=float:right;width:240px><div>' + "Application name" + '</div></div>';
x += '<br><div style=height:16px><input id=mstoragefilename placeholder=Filename maxlength=11 style=float:right;width:240px><div>' + "Filename" + '</div></div>'; x += '<br><div style=height:16px><input id=mstoragefilename placeholder="' + "Filename" + '" maxlength=11 style=float:right;width:240px><div>' + "Filename" + '</div></div>';
x += '<br><div style=height:16px><input id=mstoragetype placeholder=application/octet-stream list=mstoragetypelist style=float:right;width:240px><div>' + "MIME Type" + '</div></div>'; x += '<br><div style=height:16px><input id=mstoragetype placeholder=application/octet-stream list=mstoragetypelist style=float:right;width:240px><div>' + "MIME Type" + '</div></div>';
x += '<br><div style=height:16px><input id=mstoragelink style=float:right;width:240px><div title=\"' + "If set, creates a link to this content from the main web page" + '\">' + "Link" + '</div></div><br>'; x += '<br><div style=height:16px><input id=mstoragelink style=float:right;width:240px><div title=\"' + "If set, creates a link to this content from the main web page" + '\">' + "Link" + '</div></div><br>';
x += '<datalist id=mstoragevendorlist>'; x += '<datalist id=mstoragevendorlist>';
@@ -10463,11 +10479,11 @@
xxAlarms = response; xxAlarms = response;
for (var i = 0; i < response.length; i++) { for (var i = 0; i < response.length; i++) {
var waketime = convertAmtDataStr(response[i]['StartTime']['Datetime']); var waketime = convertAmtDataStr(response[i]['StartTime']['Datetime']);
var details = '<b>' + response[i]['ElementName'] + '</b>, wake on ' + waketime.toLocaleString().replace(', ', ' at '); var details = '<b>' + response[i]['ElementName'] + '</b>, ' + "wake on" + ' ' + waketime.toLocaleString().replace(', ', " at ");
if (response[i]['Interval'] != undefined) { details += ' and each' + _fmtinterval(response[i]['Interval']['Interval']); } if (response[i]['Interval'] != undefined) { details += " and each" + _fmtinterval(response[i]['Interval']['Interval']); }
if (response[i]['DeleteOnCompletion'] == true) { details += ", delete when done"; } if (response[i]['DeleteOnCompletion'] == true) { details += ", delete when done"; }
x += '<div class=itemBar onclick=showAlertDetails(' + i + ')><div style=float:right>'; x += '<div class=itemBar onclick=showAlertDetails(' + i + ')><div style=float:right>';
if (xxAccountAdminName) x += " " + AddButton2("Edit...", 'showAddAlarm(" + i + ")'); if (xxAccountAdminName) x += ' ' + AddButton2("Edit...", 'showAddAlarm(" + i + ")');
x += '</div><div style=padding-top:3px;width:auto;float:left;overflow-x:hidden>' + details + '</div></div>'; x += '</div><div style=padding-top:3px;width:auto;float:left;overflow-x:hidden>' + details + '</div></div>';
} }
} else { } else {
@@ -10954,7 +10970,7 @@
if (block['vars'][i]['type'] == 2) { attributes += ' onkeypress=\'return numbersOnly(event)\'' } if (block['vars'][i]['type'] == 2) { attributes += ' onkeypress=\'return numbersOnly(event)\'' }
if (block['vars'][i]['type'] == 1 || block['vars'][i]['type'] == 2) { d = '<input title="' + block['vars'][i]['desc'] + '" id=scriptXvalue_' + i + ' value="' + block['vars'][i]['value'] + '" ' + attributes + ' style=width:100%></input>'; } if (block['vars'][i]['type'] == 1 || block['vars'][i]['type'] == 2) { d = '<input title="' + block['vars'][i]['desc'] + '" id=scriptXvalue_' + i + ' value="' + block['vars'][i]['value'] + '" ' + attributes + ' style=width:100%></input>'; }
if (block['vars'][i]['type'] == 3) { if (block['vars'][i]['type'] == 3) {
d = '<select title=\'' + block['vars'][i]['desc'] + '\' id=scriptXvalue_' + i + " style=width:100%;padding:0;margin:0>"; d = '<select title=\'' + block['vars'][i]['desc'] + '\' id=scriptXvalue_' + i + ' style=width:100%;padding:0;margin:0>';
for (var j in block['vars'][i]['values']) { d += '<option value=' + j + (j == block['vars'][i]['value'] ? ' selected' : '') + '>' + block['vars'][i]['values'][j] + '</option>'; } for (var j in block['vars'][i]['values']) { d += '<option value=' + j + (j == block['vars'][i]['value'] ? ' selected' : '') + '>' + block['vars'][i]['values'][j] + '</option>'; }
d += '</select>'; d += '</select>';
} }
@@ -11056,8 +11072,8 @@
if (script_BuildingBlocks['_start']) { script += '##### Starting Block #####\r\n' + script_BuildingBlocks['_start']['code'] + '\r\n\r\n'; } if (script_BuildingBlocks['_start']) { script += '##### Starting Block #####\r\n' + script_BuildingBlocks['_start']['code'] + '\r\n\r\n'; }
for (var i in script_BlockScript) { for (var i in script_BlockScript) {
var code = script_BlockScript[i]['code']; var code = script_BlockScript[i]['code'];
code = code.split("%%%~%%%").join(i); code = code.split('%%%~%%%').join(i);
for (var j in script_BlockScript[i]['vars']) { code = code.split("%%%" + j + "%%%").join(script_BlockScript[i]['vars'][j]['value']); } for (var j in script_BlockScript[i]['vars']) { code = code.split('%%%' + j + '%%%').join(script_BlockScript[i]['vars'][j]['value']); }
script += '##### Block: ' + script_BlockScript[i]['name'] + ' #####\r\nHighlightBlock __t ' + i + '\r\n' + code + '\r\n\r\n'; script += '##### Block: ' + script_BlockScript[i]['name'] + ' #####\r\nHighlightBlock __t ' + i + '\r\n' + code + '\r\n\r\n';
} }
if (script_BuildingBlocks['_end']) { script += '##### Ending Block #####\r\n' + script_BuildingBlocks['_end']['code'] + '\r\nHighlightBlock\r\n'; } if (script_BuildingBlocks['_end']) { script += '##### Ending Block #####\r\n' + script_BuildingBlocks['_end']['code'] + '\r\nHighlightBlock\r\n'; }
@@ -11169,7 +11185,7 @@
var vs = []; var vs = [];
for (var i in runstate.variables) { if (!i.startsWith('__')) vs.push(i); } for (var i in runstate.variables) { if (!i.startsWith('__')) vs.push(i); }
vs.sort(); vs.sort();
//for (var i in vs) { r += vs[i] + " = " + script_toString(runstate.variables[vs[i]]) + "\n"; } //for (var i in vs) { r += vs[i] + ' = ' + script_toString(runstate.variables[vs[i]]) + "\n"; }
for (var i in vs) { for (var i in vs) {
if (typeof runstate.variables[vs[i]] == 'object') { if (typeof runstate.variables[vs[i]] == 'object') {
r += '<b>' + vs[i] + '</b> = ' + ObjectToStringEx(runstate.variables[vs[i]], 2) + '<br>'; r += '<b>' + vs[i] + '</b> = ' + ObjectToStringEx(runstate.variables[vs[i]], 2) + '<br>';
@@ -11280,9 +11296,9 @@
if (certificate['privateKey']) { cmenus.push("Issue new cert..." + '#cert_issueNew(' + certificate['h'] + ')'); } if (certificate['privateKey']) { cmenus.push("Issue new cert..." + '#cert_issueNew(' + certificate['h'] + ')'); }
cmenus.push("Export as .cer..." + '#cert_saveCertCer(' + certificate['h'] + ')'); cmenus.push("Export as .cer..." + '#cert_saveCertCer(' + certificate['h'] + ')');
if (certificate['privateKey']) { cmenus.push("Export as .p12..." + '#cert_saveCertP12(' + certificate['h'] + ')'); } if (certificate['privateKey']) { cmenus.push("Export as .p12..." + '#cert_saveCertP12(' + certificate['h'] + ')'); }
x += " cm='" + cmenus.join('|') + "'"; x += ' cm=\'' + cmenus.join('|') + '\'';
// ###END###{ContextMenus} // ###END###{ContextMenus}
x += " onclick='cert_select(event, " + certificate['h'] + ")' id=CR-" + certificate['h'] + " ondblclick=cert_view(" + certificate['h'] + ")>"; x += ' onclick=\'cert_select(event, ' + certificate['h'] + ')\' id=CR-' + certificate['h'] + ' ondblclick=cert_view(' + certificate['h'] + ')>';
//x += '<input id=SC-' + certificate['h'] + ' type=checkbox style=float:left;margin-top:8px onclick=cert_onCertificateChecked()' + (certificate.checked?' checked':'') + ' />'; //x += '<input id=SC-' + certificate['h'] + ' type=checkbox style=float:left;margin-top:8px onclick=cert_onCertificateChecked()' + (certificate.checked?' checked':'') + ' />';
x += '<div style=float:right><span style=font-size:14px>' + extra.join(', ') + '</span>&nbsp;<input type=button value="' + "View..." + '" onclick=cert_view(' + certificate['h'] + ')>&nbsp;</div><div style=padding-top:2px>&nbsp;'; x += '<div style=float:right><span style=font-size:14px>' + extra.join(', ') + '</span>&nbsp;<input type=button value="' + "View..." + '" onclick=cert_view(' + certificate['h'] + ')>&nbsp;</div><div style=padding-top:2px>&nbsp;';
// ###BEGIN###{Look-BrandedCommander} // ###BEGIN###{Look-BrandedCommander}
@@ -11303,16 +11319,16 @@
var x = '', certificate = getCertificate(h), cert = certificate.cert, commonName = cert.subject.getField('CN').value; var x = '', certificate = getCertificate(h), cert = certificate.cert, commonName = cert.subject.getField('CN').value;
var fingerprint = '', fingerprint2 = forge.md.sha1.create().update(forge.asn1.toDer(forge.pki.certificateToAsn1(cert)).getBytes()).digest().toHex().toUpperCase(); var fingerprint = '', fingerprint2 = forge.md.sha1.create().update(forge.asn1.toDer(forge.pki.certificateToAsn1(cert)).getBytes()).digest().toHex().toUpperCase();
for (i = 0; i < fingerprint2.length; i++) { if ((i != 0) && (i % 2 == 0)) { fingerprint += ':'; } fingerprint += fingerprint2.substring(i, i + 1); } for (i = 0; i < fingerprint2.length; i++) { if ((i != 0) && (i % 2 == 0)) { fingerprint += ':'; } fingerprint += fingerprint2.substring(i, i + 1); }
x += '<img src=images-commander/cert' + ((certificate['privateKey']) ? '2' : '1') + ".png style=vertical-align:text-top;float:right;height:28px height=32 width=32 />"; x += '<img src=images-commander/cert' + ((certificate['privateKey']) ? '2' : '1') + '.png style=vertical-align:text-top;float:right;height:28px height=32 width=32 />';
x += '<input id=certTrustedCheck type=checkbox>' + "This is a trusted certificate" + '<br>'; x += '<input id=certTrustedCheck type=checkbox>' + "This is a trusted certificate" + '<br>';
var extKeyUsage = null; var extKeyUsage = null;
for (var i in certificate.cert.extensions) { if (certificate.cert.extensions[i].id == '2.5.29.37') { extKeyUsage = certificate.cert.extensions[i]; } } for (var i in certificate.cert.extensions) { if (certificate.cert.extensions[i].id == '2.5.29.37') { extKeyUsage = certificate.cert.extensions[i]; } }
if ((certificate['privateKey']) && (extKeyUsage != null) && (extKeyUsage['2.16.840.1.113741.1.2.1'] == true)) { x += '<div><input id=certMutualAuth type=checkbox>Use for TLS console authentication<br></div>'; } if ((certificate['privateKey']) && (extKeyUsage != null) && (extKeyUsage['2.16.840.1.113741.1.2.1'] == true)) { x += '<div><input id=certMutualAuth type=checkbox>' + "Use for TLS console authentication" + '<br></div>'; }
x += '<br>'; x += '<br>';
// ###BEGIN###{FileSaver} // ###BEGIN###{FileSaver}
var y = atob(certificate['certbin']).length + " bytes, <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(" + h + ",1)>Save&nbsp.cer</a>"; var y = atob(certificate['certbin']).length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=cert_saveCertCer(' + h + ',1)>' + NoBreak("Save .cer") + '</a>';
if (certificate['privateKey']) { y += ", <a style=cursor:pointer;color:blue onclick=cert_saveCertP12(" + h + ")>Save&nbsp.p12</a>"; } if (certificate['privateKey']) { y += ', <a style=cursor:pointer;color:blue onclick=cert_saveCertP12(' + h + ')>' + NoBreak("Save .p12") + '</a>'; }
y += ", <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(" + h + ",2)>Save&nbsp.pem</a>"; y += ', <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(' + h + ',2)>' + NoBreak("Save .pem") + '</a>';
x += addHtmlValueNoTitle("Certificate", y); x += addHtmlValueNoTitle("Certificate", y);
// ###END###{FileSaver} // ###END###{FileSaver}
// ###BEGIN###{!FileSaver} // ###BEGIN###{!FileSaver}
@@ -11321,14 +11337,14 @@
// Decode certificate usages // Decode certificate usages
y = []; y = [];
if (extKeyUsage != null) { if (extKeyUsage != null) {
if (extKeyUsage.clientAuth == true) { y.push("TLS&nbsp;Client"); } if (extKeyUsage.clientAuth == true) { y.push(NoBreak("TLS Client")); }
if (extKeyUsage.codeSigning == true) { y.push("Code&nbsp;Signing"); } if (extKeyUsage.codeSigning == true) { y.push(NoBreak("Code Signing")); }
if (extKeyUsage.emailProtection == true) { y.push("EMail"); } if (extKeyUsage.emailProtection == true) { y.push("EMail"); }
if (extKeyUsage.serverAuth == true) { y.push("TLS&nbsp;Server"); } if (extKeyUsage.serverAuth == true) { y.push(NoBreak("TLS Server")); }
if (extKeyUsage['2.16.840.1.113741.1.2.1'] == true) { y.push("Intel&reg;&nbsp;AMT Console"); } if (extKeyUsage['2.16.840.1.113741.1.2.1'] == true) { y.push(NoBreak("Intel&reg; AMT Console")); }
if (extKeyUsage['2.16.840.1.113741.1.2.2'] == true) { y.push("Intel&reg;&nbsp;AMT Agent"); } if (extKeyUsage['2.16.840.1.113741.1.2.2'] == true) { y.push(NoBreak("Intel&reg; AMT Agent")); }
if (extKeyUsage['2.16.840.1.113741.1.2.3'] == true) { y.push("Intel&reg;&nbsp;AMT Activation"); } if (extKeyUsage['2.16.840.1.113741.1.2.3'] == true) { y.push(NoBreak("Intel&reg; AMT Activation")); }
if (extKeyUsage.timeStamping == true) { y.push("Time&nbsp;Stamping"); } if (extKeyUsage.timeStamping == true) { y.push(NoBreak("Time Stamping")); }
if (y.length > 0) { x += addHtmlValueNoTitle("Certificate Usage", y.join(', ') + '.') + '<br clear=all />'; } if (y.length > 0) { x += addHtmlValueNoTitle("Certificate Usage", y.join(', ') + '.') + '<br clear=all />'; }
} }
x += '<br><div style=\"border-bottom:1px solid gray\"><i>' + "Certificate Subject" + '</i></div><br>'; x += '<br><div style=\"border-bottom:1px solid gray\"><i>' + "Certificate Subject" + '</i></div><br>';
@@ -11904,7 +11920,7 @@
selectedVariable = j; selectedVariable = j;
var modid = setupbin.records[i].variables[j].moduleid; var modid = setupbin.records[i].variables[j].moduleid;
var varid = setupbin.records[i].variables[j].varid; var varid = setupbin.records[i].variables[j].varid;
d16type.value = modid + "-" + varid; d16type.value = modid + '-' + varid;
d16type.disabled = true; d16type.disabled = true;
usb_ond16typechange(); usb_ond16typechange();
QV('d16genericvalue', false); QV('d16genericvalue', false);
@@ -12432,7 +12448,7 @@
} }
} }
function pad2(num) { var s = "00" + num; return s.substr(s.length - 2); } function pad2(num) { var s = '00' + num; return s.substr(s.length - 2); }
// ###END###{SessionRecording} // ###END###{SessionRecording}
@@ -12475,7 +12491,7 @@
} }
function center() { function center() {
QS('dialog').left = ((((getDocWidth() - 400) / 2)) + "px"); QS('dialog').left = ((((getDocWidth() - 400) / 2)) + 'px');
// ###BEGIN###{Desktop} // ###BEGIN###{Desktop}
var sh = 0, mh = (Q('id_mainarea').offsetHeight - ((fullscreen == false)?126:53)); var sh = 0, mh = (Q('id_mainarea').offsetHeight - ((fullscreen == false)?126:53));
// ###BEGIN###{Scripting} // ###BEGIN###{Scripting}
@@ -12522,7 +12538,7 @@
r = {'webappversion':version,'description':desc,'hostname':amtsysstate['AMT_GeneralSettings'].response['HostName'],'localtime':Date(),'utctime':new Date().toUTCString(),'isotime':new Date().toISOString()}; r = {'webappversion':version,'description':desc,'hostname':amtsysstate['AMT_GeneralSettings'].response['HostName'],'localtime':Date(),'utctime':new Date().toUTCString(),'isotime':new Date().toISOString()};
if (HardwareInventory) r['systemid'] = guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase()); if (HardwareInventory) r['systemid'] = guidToStr(HardwareInventory['CIM_ComputerSystemPackage'].response['PlatformGUID'].toLowerCase());
} }
n += '-' + d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2) + "-" + ("0" + d.getHours()).slice(-2) + "-" + ("0" + d.getMinutes()).slice(-2);; n += '-' + d.getFullYear() + '-' + ('0'+(d.getMonth()+1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + '-' + ('0' + d.getHours()).slice(-2) + '-' + ('0' + d.getMinutes()).slice(-2);;
r[name2] = data; r[name2] = data;
// ###BEGIN###{!Mode-NodeWebkit} // ###BEGIN###{!Mode-NodeWebkit}
saveAs(data2blob(JSON.stringify(r, null, ' ').replace(/\n/g, '\r\n')), name + n + '.json'); saveAs(data2blob(JSON.stringify(r, null, ' ').replace(/\n/g, '\r\n')), name + n + '.json');
@@ -12696,7 +12712,7 @@
function TableEnd(n) { return '<tr><td colspan=2><p>' + (n?n:'') + '</table>'; } function TableEnd(n) { return '<tr><td colspan=2><p>' + (n?n:'') + '</table>'; }
function AddButton(v, f) { return '<input type=button value=\'' + v + '\' onclick=\'' + f + '\' style=margin:4px>'; } function AddButton(v, f) { return '<input type=button value=\'' + v + '\' onclick=\'' + f + '\' style=margin:4px>'; }
function AddButton2(v, f, s) { return '<input type=button value=\'' + v + '\' onclick=\'' + f + '\' ' + s + '>'; } function AddButton2(v, f, s) { return '<input type=button value=\'' + v + '\' onclick=\'' + f + '\' ' + s + '>'; }
function AddRefreshButton(f) { return '<input type=button name=refreshbtn value=Refresh onclick=\'refreshButtons(false);' + f + '\' style=margin:4px ' + (refreshButtonsState==false?'disabled':'') + '>'; } 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 style=cursor:pointer;color:blue id=morexxx1 onclick=QV(\"morexxx1\",false);QV(\"morexxx2\",true)>&#x25BC; More</a><div id=morexxx2 style=display:none><br><hr>'; }; function MoreStart() { return '<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV(\"morexxx1\",false);QV(\"morexxx2\",true)>&#x25BC; More</a><div id=morexxx2 style=display:none><br><hr>'; };
function MoreEnd() { return '<a style=cursor:pointer;color:blue onclick=QV(\"morexxx2\",false);QV(\"morexxx1\",true)>&#x25B2; Less</a></div>'; }; function MoreEnd() { return '<a style=cursor:pointer;color:blue onclick=QV(\"morexxx2\",false);QV(\"morexxx1\",true)>&#x25B2; Less</a></div>'; };
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 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; }

View File

@@ -23,7 +23,7 @@ var CreateMeshCentralServer = function (host, port, path, username, password, to
obj.crypto = require('crypto'); obj.crypto = require('crypto');
obj.constants = require('constants'); obj.constants = require('constants');
obj.xtlsoptions = null; obj.xtlsoptions = null;
obj.accumulator = ""; obj.accumulator = '';
obj.accopcodes = 0; obj.accopcodes = 0;
obj.acclen = -1; obj.acclen = -1;
obj.accmask = false; obj.accmask = false;
@@ -52,7 +52,7 @@ var CreateMeshCentralServer = function (host, port, path, username, password, to
obj.connect = function () { obj.connect = function () {
obj.socketState = 1; obj.socketState = 1;
if (obj.onStateChange != null) { obj.onStateChange(obj, obj.socketState); } if (obj.onStateChange != null) { obj.onStateChange(obj, obj.socketState); }
obj.accumulator = ""; obj.accumulator = '';
obj.accopcodes = 0; obj.accopcodes = 0;
obj.acclen = -1; obj.acclen = -1;
obj.accmask = false; obj.accmask = false;
@@ -71,7 +71,7 @@ var CreateMeshCentralServer = function (host, port, path, username, password, to
obj.socket.on('error', _OnSocketClosed); obj.socket.on('error', _OnSocketClosed);
} }
obj.disconnect = function () { _OnSocketClosed("UserDisconnect"); } obj.disconnect = function () { _OnSocketClosed('UserDisconnect'); }
obj.send = function (obj) { _Send(obj); } obj.send = function (obj) { _Send(obj); }
// Called when the socket is connected, we still need to do work to get the websocket connected // Called when the socket is connected, we still need to do work to get the websocket connected
@@ -87,7 +87,7 @@ var CreateMeshCentralServer = function (host, port, path, username, password, to
if (obj.token != null) { urlExtras = '&token=' + obj.token; } if (obj.token != null) { urlExtras = '&token=' + obj.token; }
// Send the websocket switching header // Send the websocket switching header
obj.socket.write(new Buffer('GET ' + obj.path + '?user=' + encodeURIComponent(obj.username) + '&pass=' + encodeURIComponent(obj.password) + urlExtras + " HTTP/1.1\r\nHost: " + obj.host + "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n", "binary")); obj.socket.write(new Buffer('GET ' + obj.path + '?user=' + encodeURIComponent(obj.username) + '&pass=' + encodeURIComponent(obj.password) + urlExtras + ' HTTP/1.1\r\nHost: ' + obj.host + '\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n', 'binary'));
} }
// Called when socket data is received from the server // Called when socket data is received from the server
@@ -259,7 +259,7 @@ var CreateMeshCentralServer = function (host, port, path, username, password, to
// Called to send websocket data to the server // Called to send websocket data to the server
function _Send(object) { function _Send(object) {
if (obj.socketState < 2) { return; } if (obj.socketState < 2) { return; }
var data = new Buffer(JSON.stringify(object), "binary"); var data = new Buffer(JSON.stringify(object), 'binary');
var header = String.fromCharCode(129); // 129 is default full fragment op code var header = String.fromCharCode(129); // 129 is default full fragment op code
if (data.length < 126) { header += String.fromCharCode(data.length); } if (data.length < 126) { header += String.fromCharCode(data.length); }
else if (data.length < 65536) { header += String.fromCharCode(126) + ShortToStr(data.length); } else if (data.length < 65536) { header += String.fromCharCode(126) + ShortToStr(data.length); }

View File

@@ -2574,7 +2574,7 @@ var CreateAmtScanner = function (func) {
doCallback(new Error("Timeout exceeded"), null); doCallback(new Error("Timeout exceeded"), null);
}, 3000); }, 3000);
require("dns").reverse(ip, doCallback); require('dns').reverse(ip, doCallback);
} }
return obj; return obj;
@@ -2594,7 +2594,7 @@ var CreateAmtRemoteIder = function () {
obj.tx_timeout = 0; // Default 0 obj.tx_timeout = 0; // Default 0
obj.heartbeat = 20000; // Default 20000 obj.heartbeat = 20000; // Default 20000
obj.version = 1; obj.version = 1;
obj.acc = ""; obj.acc = '';
obj.inSequence = 0; obj.inSequence = 0;
obj.outSequence = 0; obj.outSequence = 0;
obj.iderinfo = null; obj.iderinfo = null;
@@ -3130,8 +3130,8 @@ function CreateIMRSDKWrapper() {
var _IMRSDK; var _IMRSDK;
var _ImrSdkVersion; var _ImrSdkVersion;
var _ref = require("ref"); var _ref = require('ref');
var _ffi = require("ffi"); var _ffi = require('ffi');
var _struct = require('ref-struct'); var _struct = require('ref-struct');
var _arrayType = require('ref-array'); var _arrayType = require('ref-array');
obj.pendingData = {}; obj.pendingData = {};
@@ -35623,66 +35623,66 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
} }
var convertAmtKeyCodeTable = { var convertAmtKeyCodeTable = {
"Pause": 19, 'Pause': 19,
"CapsLock": 20, 'CapsLock': 20,
"Space": 32, 'Space': 32,
"Quote": 39, 'Quote': 39,
"Minus": 45, 'Minus': 45,
"NumpadMultiply": 42, 'NumpadMultiply': 42,
"NumpadAdd": 43, 'NumpadAdd': 43,
"PrintScreen": 44, 'PrintScreen': 44,
"Comma": 44, 'Comma': 44,
"NumpadSubtract": 45, 'NumpadSubtract': 45,
"NumpadDecimal": 46, 'NumpadDecimal': 46,
"Period": 46, 'Period': 46,
"Slash": 47, 'Slash': 47,
"NumpadDivide": 47, 'NumpadDivide': 47,
"Semicolon": 59, 'Semicolon': 59,
"Equal": 61, 'Equal': 61,
"OSLeft": 91, 'OSLeft': 91,
"BracketLeft": 91, 'BracketLeft': 91,
"OSRight": 91, 'OSRight': 91,
"Backslash": 92, 'Backslash': 92,
"BracketRight": 93, 'BracketRight': 93,
"ContextMenu": 93, 'ContextMenu': 93,
"Backquote": 96, 'Backquote': 96,
"NumLock": 144, 'NumLock': 144,
"ScrollLock": 145, 'ScrollLock': 145,
"Backspace": 0xff08, 'Backspace': 0xff08,
"Tab": 0xff09, 'Tab': 0xff09,
"Enter": 0xff0d, 'Enter': 0xff0d,
"NumpadEnter": 0xff0d, 'NumpadEnter': 0xff0d,
"Escape": 0xff1b, 'Escape': 0xff1b,
"Delete": 0xffff, 'Delete': 0xffff,
"Home": 0xff50, 'Home': 0xff50,
"PageUp": 0xff55, 'PageUp': 0xff55,
"PageDown": 0xff56, 'PageDown': 0xff56,
"ArrowLeft": 0xff51, 'ArrowLeft': 0xff51,
"ArrowUp": 0xff52, 'ArrowUp': 0xff52,
"ArrowRight": 0xff53, 'ArrowRight': 0xff53,
"ArrowDown": 0xff54, 'ArrowDown': 0xff54,
"End": 0xff57, 'End': 0xff57,
"Insert": 0xff63, 'Insert': 0xff63,
"F1": 0xffbe, 'F1': 0xffbe,
"F2": 0xffbf, 'F2': 0xffbf,
"F3": 0xffc0, 'F3': 0xffc0,
"F4": 0xffc1, 'F4': 0xffc1,
"F5": 0xffc2, 'F5': 0xffc2,
"F6": 0xffc3, 'F6': 0xffc3,
"F7": 0xffc4, 'F7': 0xffc4,
"F8": 0xffc5, 'F8': 0xffc5,
"F9": 0xffc6, 'F9': 0xffc6,
"F10": 0xffc7, 'F10': 0xffc7,
"F11": 0xffc8, 'F11': 0xffc8,
"F12": 0xffc9, 'F12': 0xffc9,
"ShiftLeft": 0xffe1, 'ShiftLeft': 0xffe1,
"ShiftRight": 0xffe2, 'ShiftRight': 0xffe2,
"ControlLeft": 0xffe3, 'ControlLeft': 0xffe3,
"ControlRight": 0xffe4, 'ControlRight': 0xffe4,
"AltLeft": 0xffe9, 'AltLeft': 0xffe9,
"AltRight": 0xffea, 'AltRight': 0xffea,
"MetaLeft": 0xffe7, 'MetaLeft': 0xffe7,
"MetaRight": 0xffe8 'MetaRight': 0xffe8
} }
function convertAmtKeyCode(e) { function convertAmtKeyCode(e) {
if (e.code.startsWith('Key') && e.code.length == 4) { return e.code.charCodeAt(3) + ((e.shiftKey == false) ? 32 : 0); } if (e.code.startsWith('Key') && e.code.length == 4) { return e.code.charCodeAt(3) + ((e.shiftKey == false) ? 32 : 0); }
@@ -36219,82 +36219,82 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
} }
// Keyboard and Mouse I/O. // Keyboard and Mouse I/O.
obj.MouseButton = { "NONE": 0x00, "LEFT": 0x02, "RIGHT": 0x08, "MIDDLE": 0x20 }; obj.MouseButton = { 'NONE': 0x00, 'LEFT': 0x02, 'RIGHT': 0x08, 'MIDDLE': 0x20 };
obj.KeyAction = { "NONE": 0, "DOWN": 1, "UP": 2, "SCROLL": 3, "EXUP": 4, "EXDOWN": 5, "DBLCLICK": 6 }; obj.KeyAction = { 'NONE': 0, 'DOWN': 1, 'UP': 2, 'SCROLL': 3, 'EXUP': 4, 'EXDOWN': 5, 'DBLCLICK': 6 };
obj.InputType = { "KEY": 1, "MOUSE": 2, "CTRLALTDEL": 10, "TOUCH": 15 }; obj.InputType = { 'KEY': 1, 'MOUSE': 2, 'CTRLALTDEL': 10, 'TOUCH': 15 };
obj.Alternate = 0; obj.Alternate = 0;
var convertKeyCodeTable = { var convertKeyCodeTable = {
"Pause": 19, 'Pause': 19,
"CapsLock": 20, 'CapsLock': 20,
"Space": 32, 'Space': 32,
"Quote": 222, 'Quote': 222,
"Minus": 189, 'Minus': 189,
"NumpadMultiply": 106, 'NumpadMultiply': 106,
"NumpadAdd": 107, 'NumpadAdd': 107,
"PrintScreen": 44, 'PrintScreen': 44,
"Comma": 188, 'Comma': 188,
"NumpadSubtract": 109, 'NumpadSubtract': 109,
"NumpadDecimal": 110, 'NumpadDecimal': 110,
"Period": 190, 'Period': 190,
"Slash": 191, 'Slash': 191,
"NumpadDivide": 111, 'NumpadDivide': 111,
"Semicolon": 186, 'Semicolon': 186,
"Equal": 187, 'Equal': 187,
"OSLeft": 91, 'OSLeft': 91,
"BracketLeft": 219, 'BracketLeft': 219,
"OSRight": 91, 'OSRight': 91,
"Backslash": 220, 'Backslash': 220,
"BracketRight": 221, 'BracketRight': 221,
"ContextMenu": 93, 'ContextMenu': 93,
"Backquote": 192, 'Backquote': 192,
"NumLock": 144, 'NumLock': 144,
"ScrollLock": 145, 'ScrollLock': 145,
"Backspace": 8, 'Backspace': 8,
"Tab": 9, 'Tab': 9,
"Enter": 13, 'Enter': 13,
"NumpadEnter": 13, 'NumpadEnter': 13,
"Escape": 27, 'Escape': 27,
"Delete": 46, 'Delete': 46,
"Home": 36, 'Home': 36,
"PageUp": 33, 'PageUp': 33,
"PageDown": 34, 'PageDown': 34,
"ArrowLeft": 37, 'ArrowLeft': 37,
"ArrowUp": 38, 'ArrowUp': 38,
"ArrowRight": 39, 'ArrowRight': 39,
"ArrowDown": 40, 'ArrowDown': 40,
"End": 35, 'End': 35,
"Insert": 45, 'Insert': 45,
"F1": 112, 'F1': 112,
"F2": 113, 'F2': 113,
"F3": 114, 'F3': 114,
"F4": 115, 'F4': 115,
"F5": 116, 'F5': 116,
"F6": 117, 'F6': 117,
"F7": 118, 'F7': 118,
"F8": 119, 'F8': 119,
"F9": 120, 'F9': 120,
"F10": 121, 'F10': 121,
"F11": 122, 'F11': 122,
"F12": 123, 'F12': 123,
"ShiftLeft": 16, 'ShiftLeft': 16,
"ShiftRight": 16, 'ShiftRight': 16,
"ControlLeft": 17, 'ControlLeft': 17,
"ControlRight": 17, 'ControlRight': 17,
"AltLeft": 18, 'AltLeft': 18,
"AltRight": 18, 'AltRight': 18,
"MetaLeft": 91, 'MetaLeft': 91,
"MetaRight": 92, 'MetaRight': 92,
"VolumeMute": 181 'VolumeMute': 181
//"LaunchMail": //'LaunchMail':
//"LaunchApp1": //'LaunchApp1':
//"LaunchApp2": //'LaunchApp2':
//"BrowserStop": //'BrowserStop':
//"MediaStop": //'MediaStop':
//"MediaTrackPrevious": //'MediaTrackPrevious':
//"MediaTrackNext": //'MediaTrackNext':
//"MediaPlayPause": //'MediaPlayPause':
//"MediaSelect": //'MediaSelect':
} }
function convertKeyCode(e) { function convertKeyCode(e) {
@@ -49509,8 +49509,8 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
if (certificate['privateKey']) { cmenus.push("Issue new cert..." + '#cert_issueNew(' + certificate['h'] + ')'); } if (certificate['privateKey']) { cmenus.push("Issue new cert..." + '#cert_issueNew(' + certificate['h'] + ')'); }
cmenus.push("Export as .cer..." + '#cert_saveCertCer(' + certificate['h'] + ')'); cmenus.push("Export as .cer..." + '#cert_saveCertCer(' + certificate['h'] + ')');
if (certificate['privateKey']) { cmenus.push("Export as .p12..." + '#cert_saveCertP12(' + certificate['h'] + ')'); } if (certificate['privateKey']) { cmenus.push("Export as .p12..." + '#cert_saveCertP12(' + certificate['h'] + ')'); }
x += " cm='" + cmenus.join('|') + "'"; x += ' cm=\'' + cmenus.join('|') + '\'';
x += " onclick='cert_select(event, " + certificate['h'] + ")' id=CR-" + certificate['h'] + " ondblclick=cert_view(" + certificate['h'] + ")>"; x += ' onclick=\'cert_select(event, ' + certificate['h'] + ')\' id=CR-' + certificate['h'] + ' ondblclick=cert_view(' + certificate['h'] + ')>';
//x += '<input id=SC-' + certificate['h'] + ' type=checkbox style=float:left;margin-top:8px onclick=cert_onCertificateChecked()' + (certificate.checked?' checked':'') + ' />'; //x += '<input id=SC-' + certificate['h'] + ' type=checkbox style=float:left;margin-top:8px onclick=cert_onCertificateChecked()' + (certificate.checked?' checked':'') + ' />';
x += '<div style=float:right><span style=font-size:14px>' + extra.join(', ') + '</span>&nbsp;<input type=button value="' + "View..." + '" onclick=cert_view(' + certificate['h'] + ')>&nbsp;</div><div style=padding-top:2px>&nbsp;'; x += '<div style=float:right><span style=font-size:14px>' + extra.join(', ') + '</span>&nbsp;<input type=button value="' + "View..." + '" onclick=cert_view(' + certificate['h'] + ')>&nbsp;</div><div style=padding-top:2px>&nbsp;';
//x += '<img src=certificate.png style=vertical-align:text-top height=28 width=24 />'; //x += '<img src=certificate.png style=vertical-align:text-top height=28 width=24 />';
@@ -49528,16 +49528,16 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
var x = '', certificate = getCertificate(h), cert = certificate.cert, commonName = cert.subject.getField('CN').value; var x = '', certificate = getCertificate(h), cert = certificate.cert, commonName = cert.subject.getField('CN').value;
var fingerprint = '', fingerprint2 = forge.md.sha1.create().update(forge.asn1.toDer(forge.pki.certificateToAsn1(cert)).getBytes()).digest().toHex().toUpperCase(); var fingerprint = '', fingerprint2 = forge.md.sha1.create().update(forge.asn1.toDer(forge.pki.certificateToAsn1(cert)).getBytes()).digest().toHex().toUpperCase();
for (i = 0; i < fingerprint2.length; i++) { if ((i != 0) && (i % 2 == 0)) { fingerprint += ':'; } fingerprint += fingerprint2.substring(i, i + 1); } for (i = 0; i < fingerprint2.length; i++) { if ((i != 0) && (i % 2 == 0)) { fingerprint += ':'; } fingerprint += fingerprint2.substring(i, i + 1); }
x += '<img src=images-commander/cert' + ((certificate['privateKey']) ? '2' : '1') + ".png style=vertical-align:text-top;float:right;height:28px height=32 width=32 />"; x += '<img src=images-commander/cert' + ((certificate['privateKey']) ? '2' : '1') + '.png style=vertical-align:text-top;float:right;height:28px height=32 width=32 />';
x += '<input id=certTrustedCheck type=checkbox>' + "This is a trusted certificate" + '<br>'; x += '<input id=certTrustedCheck type=checkbox>' + "This is a trusted certificate" + '<br>';
var extKeyUsage = null; var extKeyUsage = null;
for (var i in certificate.cert.extensions) { if (certificate.cert.extensions[i].id == '2.5.29.37') { extKeyUsage = certificate.cert.extensions[i]; } } for (var i in certificate.cert.extensions) { if (certificate.cert.extensions[i].id == '2.5.29.37') { extKeyUsage = certificate.cert.extensions[i]; } }
if ((certificate['privateKey']) && (extKeyUsage != null) && (extKeyUsage['2.16.840.1.113741.1.2.1'] == true)) { x += '<div><input id=certMutualAuth type=checkbox>Use for TLS console authentication<br></div>'; } if ((certificate['privateKey']) && (extKeyUsage != null) && (extKeyUsage['2.16.840.1.113741.1.2.1'] == true)) { x += '<div><input id=certMutualAuth type=checkbox>Use for TLS console authentication<br></div>'; }
x += '<br>'; x += '<br>';
var y = atob(certificate['certbin']).length + " bytes, <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(" + h + ",1)>Save&nbsp.cer</a>"; var y = atob(certificate['certbin']).length + " bytes, " + '<a style=cursor:pointer;color:blue onclick=cert_saveCertCer(' + h + ',1)>' + "Save&nbsp.cer" + '</a>';
if (certificate['privateKey']) { y += ", <a style=cursor:pointer;color:blue onclick=cert_saveCertP12(" + h + ")>Save&nbsp.p12</a>"; } if (certificate['privateKey']) { y += ', <a style=cursor:pointer;color:blue onclick=cert_saveCertP12(' + h + ')>' + "Save&nbsp.p12" + '</a>'; }
y += ", <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(" + h + ",2)>Save&nbsp.pem</a>"; y += ', <a style=cursor:pointer;color:blue onclick=cert_saveCertCer(" + h + ",2)>' + "Save&nbsp.pem" + '</a>';
x += addHtmlValueNoTitle("Certificate", y); x += addHtmlValueNoTitle("Certificate", y);
// Decode certificate usages // Decode certificate usages
y = []; y = [];

View File

@@ -1,6 +1,6 @@
{ {
"name": "MeshCommander", "name": "MeshCommander",
"version": "0.4.4", "version": "0.8.5",
"description": "Intel(R) Active Management Technology console tool", "description": "Intel(R) Active Management Technology console tool",
"main": "index-nw.html", "main": "index-nw.html",
"author": "Intel Corporation", "author": "Intel Corporation",

4
translate/translate.bat Normal file
View File

@@ -0,0 +1,4 @@
@ECHO OFF
%LOCALAPPDATA%\..\Roaming\nvm\v12.13.0\node translate.js minifyall
%LOCALAPPDATA%\..\Roaming\nvm\v12.13.0\node translate.js translateall
%LOCALAPPDATA%\..\Roaming\nvm\v12.13.0\node translate.js extractall

881
translate/translate.js Normal file
View File

@@ -0,0 +1,881 @@
/**
* @description MeshCentral MeshAgent
* @author Ylian Saint-Hilaire
* @copyright Intel Corporation 2019-2020
* @license Apache-2.0
* @version v0.0.1
*/
var fs = require('fs');
var path = require('path');
var performCheck = false;
var translationTable = null;
var sourceStrings = null;
var jsdom = null; //require('jsdom');
var esprima = null; //require('esprima'); // https://www.npmjs.com/package/esprima
var minifyLib = 2; // 0 = None, 1 = minify-js, 2 = HTMLMinifier
var minify = null;
var meshCentralSourceFiles = [
"../commander.htm"
];
var minifyMeshCentralSourceFiles = [
"../commander.htm"
];
// True is this module is run directly using NodeJS
var directRun = (require.main === module);
// Check NodeJS version
const NodeJSVer = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if (directRun && (NodeJSVer < 8)) { log("Translate.js requires Node v8 or above, current version is " + process.version + "."); return; }
// node translate.json CHECK ../meshcentral/views/default.handlebars
// node translate.json EXTRACT bob.json ../meshcentral/views/default.handlebars
// node translate.js TRANSLATE fr test2.json ../meshcentral/views/default.handlebars
var worker = null;
function log() {
if (worker == null) {
console.log(...arguments);
} else {
worker.parentPort.postMessage({ msg: arguments[0] })
}
}
if (directRun && (NodeJSVer >= 12)) {
const xworker = require('worker_threads');
try {
if (xworker.isMainThread == false) {
// We are being called to do some work
worker = xworker;
const op = worker.workerData.op;
const args = worker.workerData.args;
// Get things setup
jsdom = require('jsdom');
esprima = require('esprima'); // https://www.npmjs.com/package/esprima
if (minifyLib == 1) { minify = require('minify-js'); }
if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier
switch (op) {
case 'translate': {
translateSingleThreaded(args[0], args[1], args[2], args[3]);
break;
}
}
return;
}
} catch (ex) { log(ex); }
}
if (directRun) { setup(); }
function setup() {
var libs = ['jsdom', 'esprima', 'minify-js'];
if (minifyLib == 1) { libs.push('minify-js'); }
if (minifyLib == 2) { libs.push('html-minifier'); }
InstallModules(libs, start);
}
function start() { startEx(process.argv); }
function startEx(argv) {
// Load dependencies
jsdom = require('jsdom');
esprima = require('esprima'); // https://www.npmjs.com/package/esprima
if (minifyLib == 1) { minify = require('minify-js'); }
if (minifyLib == 2) { minify = require('html-minifier').minify; } // https://www.npmjs.com/package/html-minifier
var command = null;
if (argv.length > 2) { command = argv[2].toLowerCase(); }
if (['minify', 'check', 'extract', 'extractall', 'translate', 'translateall', 'minifyall', 'merge', 'totext', 'fromtext'].indexOf(command) == -1) { command = null; }
if (directRun) { log('MeshCentral web site translator'); }
if (command == null) {
log('Usage "node translate.js [command] [options]');
log('Possible commands:');
log('');
log(' CHECK [files]');
log(' Check will pull string out of a web page and display a report.');
log('');
log(' EXTRACT [languagefile] [files]');
log(' Extract strings from web pages and generate a language (.json) file.');
log('');
log(' EXTRACTALL (languagefile)');
log(' Extract all MeshCentral strings from web pages and generate the languages.json file.');
log('');
log(' TRANSLATE [language] [languagefile] [files]');
log(' Use a language (.json) file to translate web pages to a give language.');
log('');
log(' TRANSLATEALL (languagefile) (language code)');
log(' Translate all MeshCentral strings using the languages.json file.');
log('');
log(' MINIFY [sourcefile]');
log(' Minify a single file.');
log('');
log(' MINIFYALL');
log(' Minify the main MeshCentral english web pages.');
log('');
log(' MERGE [sourcefile] [targetfile] [language code]');
log(' Merge a language from a translation file into another translation file.');
log('');
log(' TOTEXT [translationfile] [textfile] [language code]');
log(' Save a text for with all strings of a given language.');
log('');
log(' FROMTEXT [translationfile] [textfile] [language code]');
log(' Import raw text string as translations for a language code.');
process.exit();
return;
}
// Extract strings from web pages and display a report
if (command == 'check') {
var sources = [];
for (var i = 3; i < argv.length; i++) { if (fs.existsSync(argv[i]) == false) { log('Missing file: ' + argv[i]); process.exit(); return; } sources.push(argv[i]); }
if (sources.length == 0) { log('No source files specified.'); process.exit(); return; }
performCheck = true;
sourceStrings = {};
for (var i = 0; i < sources.length; i++) { extractFromHtml(sources[i]); }
var count = 0;
for (var i in sourceStrings) { count++; }
log('Extracted ' + count + ' strings.');
process.exit();
return;
}
// Extract strings from web pages
if (command == 'extract') {
if (argv.length < 4) { log('No language file specified.'); process.exit(); return; }
var sources = [];
for (var i = 4; i < argv.length; i++) { if (fs.existsSync(argv[i]) == false) { log('Missing file: ' + argv[i]); process.exit(); return; } sources.push(argv[i]); }
if (sources.length == 0) { log('No source files specified.'); process.exit(); return; }
extract(argv[3], sources);
}
// Save a text file with all the strings for a given language
if (command == 'totext') {
if ((argv.length == 6)) {
if (fs.existsSync(argv[3]) == false) { log('Unable to find: ' + argv[3]); return; }
totext(argv[3], argv[4], argv[5]);
} else {
log('Usage: TOTEXT [translationfile] [textfile] [language code]');
}
return;
}
// Read a text file and use it as translation for a given language
if (command == 'fromtext') {
if ((argv.length == 6)) {
if (fs.existsSync(argv[3]) == false) { log('Unable to find: ' + argv[3]); return; }
if (fs.existsSync(argv[4]) == false) { log('Unable to find: ' + argv[4]); return; }
fromtext(argv[3], argv[4], argv[5]);
} else {
log('Usage: FROMTEXT [translationfile] [textfile] [language code]');
}
return;
}
// Merge one language from a language file into another language file.
if (command == 'merge') {
if ((argv.length == 6)) {
if (fs.existsSync(argv[3]) == false) { log('Unable to find: ' + argv[3]); return; }
if (fs.existsSync(argv[4]) == false) { log('Unable to find: ' + argv[4]); return; }
merge(argv[3], argv[4], argv[5]);
} else {
log('Usage: MERGE [sourcefile] [tartgetfile] [language code]');
}
return;
}
// Extract or translate all MeshCentral strings
if (command == 'extractall') {
if (argv.length > 4) { lang = argv[4].toLowerCase(); }
var translationFile = 'translate.json';
if (argv.length > 3) {
if (fs.existsSync(argv[3]) == false) { log('Unable to find: ' + argv[3]); return; } else { translationFile = argv[3]; }
}
extract(translationFile, meshCentralSourceFiles, translationFile);
}
if (command == 'translateall') {
//if (fs.existsSync('../translations') == false) { fs.mkdirSync('../translations'); }
//if (fs.existsSync('../public/translations') == false) { fs.mkdirSync('../public/translations'); }
var lang = null;
if (argv.length > 4) { lang = argv[4].toLowerCase(); }
if (argv.length > 3) {
if (fs.existsSync(argv[3]) == false) {
log('Unable to find: ' + argv[3]);
} else {
translate(lang, argv[3], meshCentralSourceFiles, null);
}
} else {
if (fs.existsSync('translate.json') == false) {
log('Unable to find translate.json.');
} else {
translate(lang, 'translate.json', meshCentralSourceFiles, null);
}
}
return;
}
// Translate web pages to a given language given a language file
if (command == 'translate') {
if (argv.length < 4) { log("No language specified."); process.exit(); return; }
if (argv.length < 5) { log("No language file specified."); process.exit(); return; }
var lang = argv[3].toLowerCase();
var langFile = argv[4];
if (fs.existsSync(langFile) == false) { log("Missing language file: " + langFile); process.exit(); return; }
var sources = [], subdir = null;
for (var i = 5; i < argv.length; i++) {
if (argv[i].startsWith('--subdir:')) {
subdir = argv[i].substring(9);
} else {
if (fs.existsSync(argv[i]) == false) { log("Missing file: " + argv[i]); process.exit(); return; } sources.push(argv[i]);
}
}
if (sources.length == 0) { log("No source files specified."); process.exit(); return; }
translate(lang, langFile, sources, subdir);
}
if (command == 'minifyall') {
for (var i in minifyMeshCentralSourceFiles) {
var outname = minifyMeshCentralSourceFiles[i];
var outnamemin = null;
if (outname.endsWith('.handlebars')) {
outnamemin = (outname.substring(0, outname.length - 11) + '-min.handlebars');
} else if (outname.endsWith('.html')) {
outnamemin = (outname.substring(0, outname.length - 5) + '-min.html');
} else if (outname.endsWith('.htm')) {
outnamemin = (outname.substring(0, outname.length - 4) + '-min.htm');
} else if (outname.endsWith('.js')) {
outnamemin = (outname.substring(0, outname.length - 3) + '-min.js');
} else {
outnamemin = (outname, outname + '.min');
}
log('Generating ' + outnamemin + '...');
/*
// Minify the file
if (minifyLib == 1) {
minify.file({
file: outname,
dist: outnamemin
}, function (e, compress) {
if (e) { log('ERROR ', e); return done(); }
compress.run((e) => { e ? log('Minification fail', e) : log('Minification sucess'); minifyDone(); });
}
);
}
*/
// Minify the file
if (minifyLib == 2) {
var inFile = fs.readFileSync(outname).toString();
// Perform minification pre-processing
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; }
var minifiedOut = minify(inFile, {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false, // This is not good.
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeOptionalTags: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeTagWhitespace: true,
preserveLineBreaks: false,
useShortDoctype: true
});
// Perform minification post-processing
if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); }
if (outname.endsWith('.handlebars') >= 0) { minifiedOut = minifiedOut.split('"{{{pluginHandler}}}"').join('{{{pluginHandler}}}'); }
fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
}
}
}
if (command == 'minify') {
var outname = argv[3];
var outnamemin = null;
if (outname.endsWith('.handlebars')) {
outnamemin = (outname.substring(0, outname.length - 11) + '-min.handlebars');
} else if (outname.endsWith('.html')) {
outnamemin = (outname.substring(0, outname.length - 5) + '-min.html');
} else if (outname.endsWith('.htm')) {
outnamemin = (outname.substring(0, outname.length - 4) + '-min.htm');
} else {
outnamemin = (outname, outname + '.min');
}
log('Generating ' + path.basename(outnamemin) + '...');
// Minify the file
if (minifyLib = 2) {
var inFile = fs.readFileSync(outname).toString()
// Perform minification pre-processing
if (outname.endsWith('.handlebars') >= 0) { inFile = inFile.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
if (outname.endsWith('.js')) { inFile = '<script>' + inFile + '</script>'; }
var minifiedOut = minify(inFile, {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false, // This is not good.
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeOptionalTags: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeTagWhitespace: true,
preserveLineBreaks: false,
useShortDoctype: true
});
// Perform minification post-processing
if (outname.endsWith('.js')) { minifiedOut = minifiedOut.substring(8, minifiedOut.length - 9); }
if (outname.endsWith('.handlebars') >= 0) { minifiedOut = minifiedOut.split('"{{{pluginHandler}}}"').join('{{{pluginHandler}}}'); }
fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
}
}
}
function totext(source, target, lang) {
// Load the source language file
var sourceLangFileData = null;
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
log('Writing ' + lang + '...');
// Generate raw text
var output = [];
var outputCharCount = 0; // Google has a 5000 character limit
var splitOutput = [];
var splitOutputPtr = 1;
var count = 0;
for (var i in sourceLangFileData.strings) {
if ((sourceLangFileData.strings[i][lang] != null) && (sourceLangFileData.strings[i][lang].indexOf('\r') == -1) && (sourceLangFileData.strings[i][lang].indexOf('\n') == -1)) {
output.push(sourceLangFileData.strings[i][lang]);
outputCharCount += (sourceLangFileData.strings[i][lang].length + 2);
if (outputCharCount > 4500) { outputCharCount = 0; splitOutputPtr++; }
if (splitOutput[splitOutputPtr] == null) { splitOutput[splitOutputPtr] = []; }
splitOutput[splitOutputPtr].push(sourceLangFileData.strings[i][lang]);
} else {
output.push('');
outputCharCount += 2;
if (outputCharCount > 4500) { outputCharCount = 0; splitOutputPtr++; }
if (splitOutput[splitOutputPtr] == null) { splitOutput[splitOutputPtr] = []; }
splitOutput[splitOutputPtr].push('');
}
count++;
}
if (splitOutputPtr == 1) {
// Save the target back
fs.writeFileSync(target + '-' + lang + '.txt', output.join('\r\n'), { flag: 'w+' });
log('Done.');
} else {
// Save the text in 1000 string bunches
for (var i in splitOutput) {
log('Writing ' + target + '-' + lang + '-' + i + '.txt...');
fs.writeFileSync(target + '-' + lang + '-' + i + '.txt', splitOutput[i].join('\r\n'), { flag: 'w+' });
}
log('Done.');
}
}
function fromtext(source, target, lang) {
// Load the source language file
var sourceLangFileData = null;
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
log('Updating ' + lang + '...');
// Read raw text
var rawText = fs.readFileSync(target).toString('utf8');
var rawTextArray = rawText.split('\r\n');
var rawTextPtr = 0;
log('Translation file: ' + sourceLangFileData.strings.length + ' string(s)');
log('Text file: ' + rawTextArray.length + ' string(s)');
if (sourceLangFileData.strings.length != rawTextArray.length) { log('String count mismatch, unable to import.'); process.exit(1); return; }
var output = [];
var splitOutput = [];
for (var i in sourceLangFileData.strings) {
if ((sourceLangFileData.strings[i]['en'] != null) && (sourceLangFileData.strings[i]['en'].indexOf('\r') == -1) && (sourceLangFileData.strings[i]['en'].indexOf('\n') == -1)) {
if (sourceLangFileData.strings[i][lang] == null) { sourceLangFileData.strings[i][lang] = rawTextArray[i]; }
}
}
fs.writeFileSync(source + '-new', translationsToJson(sourceLangFileData), { flag: 'w+' });
log('Done.');
}
function merge(source, target, lang) {
// Load the source language file
var sourceLangFileData = null;
try { sourceLangFileData = JSON.parse(fs.readFileSync(source)); } catch (ex) { }
if ((sourceLangFileData == null) || (sourceLangFileData.strings == null)) { log("Invalid source language file."); process.exit(); return; }
// Load the target language file
var targetLangFileData = null;
try { targetLangFileData = JSON.parse(fs.readFileSync(target)); } catch (ex) { }
if ((targetLangFileData == null) || (targetLangFileData.strings == null)) { log("Invalid target language file."); process.exit(); return; }
log('Merging ' + lang + '...');
// Index the target file
var index = {};
for (var i in targetLangFileData.strings) { if (targetLangFileData.strings[i].en != null) { index[targetLangFileData.strings[i].en] = targetLangFileData.strings[i]; } }
// Merge the translation
for (var i in sourceLangFileData.strings) {
if ((sourceLangFileData.strings[i].en != null) && (sourceLangFileData.strings[i][lang] != null) && (index[sourceLangFileData.strings[i].en] != null)) {
//if (sourceLangFileData.strings[i][lang] == null) {
index[sourceLangFileData.strings[i].en][lang] = sourceLangFileData.strings[i][lang];
//}
}
}
// Deindex the new target file
var targetData = { strings: [] };
for (var i in index) { targetData.strings.push(index[i]); }
// Save the target back
fs.writeFileSync(target, translationsToJson(targetData), { flag: 'w+' });
log('Done.');
}
function translate(lang, langFile, sources, createSubDir) {
if (directRun && (NodeJSVer >= 12) && (lang == null)) {
// Multi threaded translation
log("Multi-threaded translation.");
// Load the language file
var langFileData = null;
try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
langs = {};
for (var i in langFileData.strings) { var entry = langFileData.strings[i]; for (var j in entry) { if ((j != 'en') && (j != 'xloc') && (j != '*')) { langs[j.toLowerCase()] = true; } } }
for (var i in langs) {
const { Worker } = require('worker_threads')
const worker = new Worker('./translate.js', { stdout: true, workerData: { op: 'translate', args: [i, langFile, sources, createSubDir] } });
worker.stdout.on('data', function (msg) { console.log('wstdio:', msg.toString()); });
worker.on('message', function (message) { console.log(message.msg); });
worker.on('error', function (error) { console.log('error', error); });
worker.on('exit', function (code) { /*console.log('exit', code);*/ })
}
} else {
// Single threaded translation
translateSingleThreaded(lang, langFile, sources, createSubDir);
}
}
function translateSingleThreaded(lang, langFile, sources, createSubDir) {
// Load the language file
var langFileData = null;
try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
if ((lang != null) && (lang != '*')) {
// Translate a single language
translateEx(lang, langFileData, sources, createSubDir);
} else {
// See that languages are in the translation file
langs = {};
for (var i in langFileData.strings) { var entry = langFileData.strings[i]; for (var j in entry) { if ((j != 'en') && (j != 'xloc') && (j != '*')) { langs[j.toLowerCase()] = true; } } }
for (var i in langs) { translateEx(i, langFileData, sources, createSubDir); }
}
//process.exit();
return;
}
function translateEx(lang, langFileData, sources, createSubDir) {
// Build translation table, simple source->target for the given language.
translationTable = {};
for (var i in langFileData.strings) {
var entry = langFileData.strings[i];
if ((entry['en'] != null) && (entry[lang] != null)) { translationTable[entry['en']] = entry[lang]; }
}
// Translate the files
for (var i = 0; i < sources.length; i++) {
if (sources[i].endsWith('.html') || sources[i].endsWith('.htm') || sources[i].endsWith('.handlebars')) { translateFromHtml(lang, sources[i], createSubDir); }
else if (sources[i].endsWith('.txt')) { translateFromTxt(lang, sources[i], createSubDir); }
}
}
function extract(langFile, sources) {
sourceStrings = {};
if (fs.existsSync(langFile) == true) {
var langFileData = null;
try { langFileData = JSON.parse(fs.readFileSync(langFile)); } catch (ex) { }
if ((langFileData == null) || (langFileData.strings == null)) { log("Invalid language file."); process.exit(); return; }
for (var i in langFileData.strings) {
sourceStrings[langFileData.strings[i]['en']] = langFileData.strings[i];
delete sourceStrings[langFileData.strings[i]['en']].xloc;
}
}
for (var i = 0; i < sources.length; i++) {
if (sources[i].endsWith('.html') || sources[i].endsWith('.htm') || sources[i].endsWith('.handlebars')) { extractFromHtml(sources[i]); }
else if (sources[i].endsWith('.txt')) { extractFromTxt(sources[i]); }
}
var count = 0, output = [];
for (var i in sourceStrings) {
count++;
sourceStrings[i]['en'] = i;
//if ((sourceStrings[i].xloc != null) && (sourceStrings[i].xloc.length > 0)) { output.push(sourceStrings[i]); } // Only save results that have a source location.
output.push(sourceStrings[i]); // Save all results
}
fs.writeFileSync(langFile, translationsToJson({ strings: output }), { flag: 'w+' });
log(format("{0} strings in output file.", count));
//process.exit();
return;
}
function extractFromTxt(file) {
log("Processing TXT: " + path.basename(file));
var lines = fs.readFileSync(file).toString().split('\r\n');
var name = path.basename(file);
for (var i in lines) {
var line = lines[i];
if ((line.length > 1) && (line[0] != '~')) {
if (sourceStrings[line] == null) { sourceStrings[line] = { en: line, xloc: [name] }; } else { if (sourceStrings[line].xloc == null) { sourceStrings[line].xloc = []; } sourceStrings[line].xloc.push(name); }
}
}
}
function extractFromHtml(file) {
var data = fs.readFileSync(file);
var { JSDOM } = jsdom;
const dom = new JSDOM(data, { includeNodeLocations: true });
log("Processing HTML: " + path.basename(file));
getStringsHtml(path.basename(file), dom.window.document.querySelector('body'));
}
function getStringsHtml(name, node) {
for (var i = 0; i < node.childNodes.length; i++) {
var subnode = node.childNodes[i];
// Check if the "value" attribute exists and needs to be translated
var subnodeignore = false;
if ((subnode.attributes != null) && (subnode.attributes.length > 0)) {
var subnodevalue = null, subnodeplaceholder = null, subnodetitle = null;
for (var j in subnode.attributes) {
if ((subnode.attributes[j].name == 'notrans') && (subnode.attributes[j].value == '1')) { subnodeignore = true; }
if ((subnode.attributes[j].name == 'type') && (subnode.attributes[j].value == 'hidden')) { subnodeignore = true; }
if (subnode.attributes[j].name == 'value') { subnodevalue = subnode.attributes[j].value; }
if (subnode.attributes[j].name == 'placeholder') { subnodeplaceholder = subnode.attributes[j].value; }
if (subnode.attributes[j].name == 'title') { subnodetitle = subnode.attributes[j].value; }
}
if ((subnodevalue != null) && isNumber(subnodevalue) == true) { subnodevalue = null; }
if ((subnodeplaceholder != null) && isNumber(subnodeplaceholder) == true) { subnodeplaceholder = null; }
if ((subnodetitle != null) && isNumber(subnodetitle) == true) { subnodetitle = null; }
if ((subnodeignore == false) && (subnodevalue != null)) {
// Add a new string to the list (value)
if (sourceStrings[subnodevalue] == null) { sourceStrings[subnodevalue] = { en: subnodevalue, xloc: [name] }; } else { if (sourceStrings[subnodevalue].xloc == null) { sourceStrings[subnodevalue].xloc = []; } sourceStrings[subnodevalue].xloc.push(name); }
}
if (subnodeplaceholder != null) {
// Add a new string to the list (placeholder)
if (sourceStrings[subnodeplaceholder] == null) { sourceStrings[subnodeplaceholder] = { en: subnodeplaceholder, xloc: [name] }; } else { if (sourceStrings[subnodeplaceholder].xloc == null) { sourceStrings[subnodeplaceholder].xloc = []; } sourceStrings[subnodeplaceholder].xloc.push(name); }
}
if (subnodetitle != null) {
// Add a new string to the list (title)
if (sourceStrings[subnodetitle] == null) { sourceStrings[subnodetitle] = { en: subnodetitle, xloc: [name] }; } else { if (sourceStrings[subnodetitle].xloc == null) { sourceStrings[subnodetitle].xloc = []; } sourceStrings[subnodetitle].xloc.push(name); }
}
}
if (subnodeignore == false) {
// Check the content of the element
var subname = subnode.id;
if (subname == null || subname == '') { subname = i; }
if (subnode.hasChildNodes()) {
getStringsHtml(name + '->' + subname, subnode);
} else {
if (subnode.nodeValue == null) continue;
var nodeValue = subnode.nodeValue.trim().split('\\r').join('').split('\\n').join('').trim();
if ((nodeValue.length > 0) && (subnode.nodeType == 3)) {
if ((node.tagName != 'SCRIPT') && (node.tagName != 'STYLE') && (nodeValue.length < 8000) && (nodeValue.startsWith('{{{') == false) && (nodeValue != ' ')) {
if (performCheck) { log(' "' + nodeValue + '"'); }
// Add a new string to the list
if (sourceStrings[nodeValue] == null) { sourceStrings[nodeValue] = { en: nodeValue, xloc: [name] }; } else { if (sourceStrings[nodeValue].xloc == null) { sourceStrings[nodeValue].xloc = []; } sourceStrings[nodeValue].xloc.push(name); }
} else if (node.tagName == 'SCRIPT') {
// Parse JavaScript
getStringFromJavaScript(name, subnode.nodeValue);
}
}
}
}
}
}
function getStringFromJavaScript(name, script) {
if (performCheck) { log(format('Processing JavaScript of {0} bytes: {1}', script.length, name)); }
var tokenScript = esprima.tokenize(script), count = 0;
for (var i in tokenScript) {
var token = tokenScript[i];
if ((token.type == 'String') && (token.value.length > 2) && (token.value[0] == '"')) {
var str = token.value.substring(1, token.value.length - 1);
//if (performCheck) { log(' ' + name + '->' + (++count), token.value); }
if (performCheck) { log(' ' + token.value); }
if (sourceStrings[str] == null) { sourceStrings[str] = { en: str, xloc: [name + '->' + (++count)] }; } else { if (sourceStrings[str].xloc == null) { sourceStrings[str].xloc = []; } sourceStrings[str].xloc.push(name + '->' + (++count)); }
}
}
}
function translateFromTxt(lang, file, createSubDir) {
log("Translating TXT (" + lang + "): " + path.basename(file));
var lines = fs.readFileSync(file).toString().split('\r\n'), outlines = [];
for (var i in lines) {
var line = lines[i];
if ((line.length > 1) && (line[0] != '~')) {
if (translationTable[line] != null) { outlines.push(translationTable[line]); } else { outlines.push(line); }
} else {
outlines.push(line);
}
}
var outname = file, out = outlines.join('\r\n');
if (createSubDir != null) {
var outfolder = path.join(path.dirname(file), createSubDir);
if (fs.existsSync(outfolder) == false) { fs.mkdirSync(outfolder); }
outname = path.join(path.dirname(file), createSubDir, path.basename(file));
}
outname = (outname.substring(0, outname.length - 4) + '_' + lang + '.txt');
fs.writeFileSync(outname, out, { flag: 'w+' });
}
function translateFromHtml(lang, file, createSubDir) {
var data = fs.readFileSync(file);
var { JSDOM } = jsdom;
const dom = new JSDOM(data, { includeNodeLocations: true });
log("Translating HTML (" + lang + "): " + path.basename(file));
translateStrings(path.basename(file), dom.window.document.querySelector('body'));
var out = dom.serialize();
// Change the <html lang="en"> tag.
out = out.split('<html lang="en"').join('<html lang="' + lang + '"');
var outname = file;
var outnamemin = null;
if (createSubDir != null) {
var outfolder = path.join(path.dirname(file), createSubDir);
if (fs.existsSync(outfolder) == false) { fs.mkdirSync(outfolder); }
outname = path.join(path.dirname(file), createSubDir, path.basename(file));
}
if (outname.endsWith('.handlebars')) {
outnamemin = (outname.substring(0, outname.length - 11) + '-min_' + lang + '.handlebars');
outname = (outname.substring(0, outname.length - 11) + '_' + lang + '.handlebars');
} else if (outname.endsWith('.html')) {
outnamemin = (outname.substring(0, outname.length - 5) + '-min_' + lang + '.html');
outname = (outname.substring(0, outname.length - 5) + '_' + lang + '.html');
} else if (outname.endsWith('.htm')) {
outnamemin = (outname.substring(0, outname.length - 4) + '-min_' + lang + '.htm');
outname = (outname.substring(0, outname.length - 4) + '_' + lang + '.htm');
} else {
outnamemin = (outname + '_' + lang + '.min');
outname = (outname + '_' + lang);
}
fs.writeFileSync(outname, out, { flag: 'w+' });
// Minify the file
if (minifyLib == 1) {
minify.file({
file: outname,
dist: outnamemin
}, function(e, compress) {
if (e) { log('ERROR ', e); return done(); }
compress.run((e) => { e ? log('Minification fail', e) : log('Minification sucess'); minifyDone(); });
}
);
}
// Minify the file
if (minifyLib = 2) {
if (outnamemin.endsWith('.handlebars') >= 0) { out = out.split('{{{pluginHandler}}}').join('"{{{pluginHandler}}}"'); }
var minifiedOut = minify(out, {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: false, // This is not good.
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeOptionalTags: true,
removeEmptyAttributes: true,
removeAttributeQuotes: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeTagWhitespace: true,
preserveLineBreaks: false,
useShortDoctype: true
});
if (outnamemin.endsWith('.handlebars') >= 0) { minifiedOut = minifiedOut.split('"{{{pluginHandler}}}"').join('{{{pluginHandler}}}'); }
fs.writeFileSync(outnamemin, minifiedOut, { flag: 'w+' });
}
}
function minifyDone() { log('Completed minification.'); }
function translateStrings(name, node) {
for (var i = 0; i < node.childNodes.length; i++) {
var subnode = node.childNodes[i];
// Check if the "value" attribute exists and needs to be translated
var subnodeignore = false;
if ((subnode.attributes != null) && (subnode.attributes.length > 0)) {
var subnodevalue = null, subnodeindex = null, subnodeplaceholder = null, subnodeplaceholderindex = null, subnodetitle = null, subnodetitleindex = null;
for (var j in subnode.attributes) {
if ((subnode.attributes[j].name == 'notrans') && (subnode.attributes[j].value == '1')) { subnodeignore = true; }
if ((subnode.attributes[j].name == 'type') && (subnode.attributes[j].value == 'hidden')) { subnodeignore = true; }
if (subnode.attributes[j].name == 'value') { subnodevalue = subnode.attributes[j].value; subnodeindex = j; }
if (subnode.attributes[j].name == 'placeholder') { subnodeplaceholder = subnode.attributes[j].value; subnodeplaceholderindex = j; }
if (subnode.attributes[j].name == 'title') { subnodetitle = subnode.attributes[j].value; subnodetitleindex = j; }
}
if ((subnodevalue != null) && isNumber(subnodevalue) == true) { subnodevalue = null; }
if ((subnodeplaceholder != null) && isNumber(subnodeplaceholder) == true) { subnodeplaceholder = null; }
if ((subnodetitle != null) && isNumber(subnodetitle) == true) { subnodetitle = null; }
if ((subnodeignore == false) && (subnodevalue != null)) {
// Perform attribute translation for value
if (translationTable[subnodevalue] != null) { subnode.attributes[subnodeindex].value = translationTable[subnodevalue]; }
}
if (subnodeplaceholder != null) {
// Perform attribute translation for placeholder
if (translationTable[subnodeplaceholder] != null) { subnode.attributes[subnodeplaceholderindex].value = translationTable[subnodeplaceholder]; }
}
if (subnodetitle != null) {
// Perform attribute translation for title
if (translationTable[subnodetitle] != null) { subnode.attributes[subnodetitleindex].value = translationTable[subnodetitle]; }
}
}
if (subnodeignore == false) {
var subname = subnode.id;
if (subname == null || subname == '') { subname = i; }
if (subnode.hasChildNodes()) {
translateStrings(name + '->' + subname, subnode);
} else {
if (subnode.nodeValue == null) continue;
var nodeValue = subnode.nodeValue.trim().split('\\r').join('').split('\\n').join('').trim();
// Look for the front trim
var frontTrim = '', backTrim = '';;
var x1 = subnode.nodeValue.indexOf(nodeValue);
if (x1 > 0) { frontTrim = subnode.nodeValue.substring(0, x1); }
if (x1 != -1) { backTrim = subnode.nodeValue.substring(x1 + nodeValue.length); }
if ((nodeValue.length > 0) && (subnode.nodeType == 3)) {
if ((node.tagName != 'SCRIPT') && (node.tagName != 'STYLE') && (nodeValue.length < 8000) && (nodeValue.startsWith('{{{') == false) && (nodeValue != ' ')) {
// Check if we have a translation for this string
if (translationTable[nodeValue]) { subnode.nodeValue = (frontTrim + translationTable[nodeValue] + backTrim); }
} else if (node.tagName == 'SCRIPT') {
// Translate JavaScript
subnode.nodeValue = translateStringsFromJavaScript(name, subnode.nodeValue);
}
}
}
}
}
}
function translateStringsFromJavaScript(name, script) {
if (performCheck) { log(format('Translating JavaScript of {0} bytes: {1}', script.length, name)); }
var tokenScript = esprima.tokenize(script, { range: true }), count = 0;
var output = [], ptr = 0;
for (var i in tokenScript) {
var token = tokenScript[i];
if ((token.type == 'String') && (token.value.length > 2) && (token.value[0] == '"')) {
var str = token.value.substring(1, token.value.length - 1);
if (translationTable[str]) {
output.push(script.substring(ptr, token.range[0]));
output.push('"' + translationTable[str] + '"');
ptr = token.range[1];
}
}
}
output.push(script.substring(ptr));
return output.join('');
}
function isNumber(x) { return (('' + parseInt(x)) === x) || (('' + parseFloat(x)) === x); }
function format(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); };
// Check if a list of modules are present and install any missing ones
var InstallModuleChildProcess = null;
var previouslyInstalledModules = {};
function InstallModules(modules, func) {
var missingModules = [];
if (previouslyInstalledModules == null) { previouslyInstalledModules = {}; }
if (modules.length > 0) {
for (var i in modules) {
try {
var xxmodule = require(modules[i]);
} catch (e) {
if (previouslyInstalledModules[modules[i]] !== true) { missingModules.push(modules[i]); }
}
}
if (missingModules.length > 0) { InstallModule(missingModules.shift(), InstallModules, modules, func); } else { func(); }
}
}
// Check if a module is present and install it if missing
function InstallModule(modulename, func, tag1, tag2) {
log('Installing ' + modulename + '...');
var child_process = require('child_process');
var parentpath = __dirname;
// Get the working directory
if ((__dirname.endsWith('/node_modules/meshcentral')) || (__dirname.endsWith('\\node_modules\\meshcentral')) || (__dirname.endsWith('/node_modules/meshcentral/')) || (__dirname.endsWith('\\node_modules\\meshcentral\\'))) { parentpath = require('path').join(__dirname, '../..'); }
// Looks like we need to keep a global reference to the child process object for this to work correctly.
InstallModuleChildProcess = child_process.exec('npm install --no-optional --save ' + modulename, { maxBuffer: 512000, timeout: 120000, cwd: parentpath }, function (error, stdout, stderr) {
InstallModuleChildProcess = null;
if ((error != null) && (error != '')) {
log('ERROR: Unable to install required module "' + modulename + '". May not have access to npm, or npm may not have suffisent rights to load the new module. Try "npm install ' + modulename + '" to manualy install this module.\r\n');
process.exit();
return;
}
previouslyInstalledModules[modulename] = true;
func(tag1, tag2);
return;
});
}
// Convert the translations to a standardized JSON we can use in GitHub
// Strings are sorder by english source and object keys are sorted
function translationsToJson(t) {
var arr2 = [], arr = t.strings;
for (var i in arr) {
var names = [], el = arr[i], el2 = {};
for (var j in el) { names.push(j); }
names.sort(function (a, b) { if (a == b) { return 0; } if (a == 'xloc') { return 1; } if (b == 'xloc') { return -1; } return a - b });
for (var j in names) { el2[names[j]] = el[names[j]]; }
if (el2.xloc != null) { el2.xloc.sort(); }
arr2.push(el2);
}
arr2.sort(function (a, b) { if (a.en > b.en) return 1; if (a.en < b.en) return -1; return 0; });
return JSON.stringify({ strings: arr2 }, null, ' ');
}
// Export table
module.exports.startEx = startEx;

25112
translate/translate.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -61,7 +61,7 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
obj.socket.on('error', _OnSocketClosed); obj.socket.on('error', _OnSocketClosed);
} }
obj.disconnect = function () { _OnSocketClosed("UserDisconnect"); } obj.disconnect = function () { _OnSocketClosed('UserDisconnect'); }
obj.send = function (obj) { _Send(obj); } obj.send = function (obj) { _Send(obj); }
obj.setEncoding = function(encoding) { } obj.setEncoding = function(encoding) { }
obj.setTimeout = function (timeout) { } obj.setTimeout = function (timeout) { }
@@ -77,10 +77,10 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
// Check if this is really the MeshServer we want to connect to // Check if this is really the MeshServer we want to connect to
obj.xtlsCertificate = obj.socket.getPeerCertificate(); obj.xtlsCertificate = obj.socket.getPeerCertificate();
obj.xtlsFingerprint = obj.xtlsCertificate.fingerprint.split(':').join('').toLowerCase(); obj.xtlsFingerprint = obj.xtlsCertificate.fingerprint.split(':').join('').toLowerCase();
if (obj.xtlsFingerprint != obj.certhash.split(':').join('').toLowerCase()) { console.error("Hash match fail", obj.xtlsFingerprint, obj.certhash.split(':').join('').toLowerCase()); _OnSocketClosed("HashMatchFail"); return; } if (obj.xtlsFingerprint != obj.certhash.split(':').join('').toLowerCase()) { console.error('Hash match fail', obj.xtlsFingerprint, obj.certhash.split(':').join('').toLowerCase()); _OnSocketClosed('HashMatchFail'); return; }
// Send the websocket switching header // Send the websocket switching header
obj.socket.write(new Buffer("GET " + obj.path + " HTTP/1.1\r\nHost: " + obj.host + "\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n", "binary")); obj.socket.write(new Buffer('GET ' + obj.path + ' HTTP/1.1\r\nHost: ' + obj.host + '\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\nSec-WebSocket-Version: 13\r\n\r\n', 'binary'));
} }
// Called when socket data is received from the server // Called when socket data is received from the server
@@ -100,7 +100,7 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
if (obj.onconnect) { obj.onconnect(); } if (obj.onconnect) { obj.onconnect(); }
} else { } else {
// Fail // Fail
if (header == null) { _OnSocketClosed("Bad header"); } else { _OnSocketClosed(header._Path); } if (header == null) { _OnSocketClosed('Bad header'); } else { _OnSocketClosed(header._Path); }
} }
} }
} }
@@ -168,7 +168,7 @@ var CreateWebSocketWrapper = function (host, port, path, certhash) {
// Called to send websocket data to the server // Called to send websocket data to the server
function _Send(object) { function _Send(object) {
if (obj.socketState < 2) { return; } if (obj.socketState < 2) { return; }
var data = new Buffer(JSON.stringify(object), "binary"); var data = new Buffer(JSON.stringify(object), 'binary');
var header = String.fromCharCode(129); // 129 is default full fragment op code (129 = text, 130 = binary) var header = String.fromCharCode(129); // 129 is default full fragment op code (129 = text, 130 = binary)
if (data.length < 126) { header += String.fromCharCode(data.length); } if (data.length < 126) { header += String.fromCharCode(data.length); }
else if (data.length < 65536) { header += String.fromCharCode(126) + ShortToStr(data.length); } else if (data.length < 65536) { header += String.fromCharCode(126) + ShortToStr(data.length); }

View File

@@ -884,7 +884,7 @@ ZLIB.inflateReset = function(strm, windowBits)
if (!strm || !strm.state) return ZLIB.Z_STREAM_ERROR; if (!strm || !strm.state) return ZLIB.Z_STREAM_ERROR;
state = strm.state; state = strm.state;
if(typeof windowBits === "undefined") if(typeof windowBits === 'undefined')
windowBits = DEF_WBITS; windowBits = DEF_WBITS;
/* extract wrap request from windowBits parameter */ /* extract wrap request from windowBits parameter */
@@ -1283,12 +1283,12 @@ inf_leave: for (;;) {
if(!NEEDBITS(s, 16)) break inf_leave; if(!NEEDBITS(s, 16)) break inf_leave;
state.flags = s.hold; state.flags = s.hold;
if ((state.flags & 0xff) != ZLIB.Z_DEFLATED) { if ((state.flags & 0xff) != ZLIB.Z_DEFLATED) {
strm.msg = "unknown compression method"; strm.msg = 'unknown compression method';
state.mode = BAD; state.mode = BAD;
break; break;
} }
if (state.flags & 0xe000) { if (state.flags & 0xe000) {
strm.msg = "unknown header flags set"; strm.msg = 'unknown header flags set';
state.mode = BAD; state.mode = BAD;
break; break;
} }
@@ -1330,7 +1330,7 @@ inf_leave: for (;;) {
CRC2(strm, s.hold); CRC2(strm, s.hold);
} }
INITBITS(s); INITBITS(s);
state.head.extra = ""; state.head.extra = '';
} }
else if (state.head !== null) { else if (state.head !== null) {
state.head.extra = null; state.head.extra = null;
@@ -1368,14 +1368,14 @@ inf_leave: for (;;) {
if (state.flags & 0x0800) { if (state.flags & 0x0800) {
if (s.have == 0) break inf_leave; if (s.have == 0) break inf_leave;
if (state.head !== null && state.head.name === null) { if (state.head !== null && state.head.name === null) {
state.head.name = ""; state.head.name = '';
} }
copy = 0; copy = 0;
// TODO end = strm.input_data.indexOf("\0", s.next); // TODO end = strm.input_data.indexOf("\0", s.next);
// TODO state.length => state.head.name.length // TODO state.length => state.head.name.length
do { do {
len = strm.input_data.charAt(s.next + copy); copy++; len = strm.input_data.charAt(s.next + copy); copy++;
if(len === "\0") if(len === '\0')
break; break;
if (state.head !== null && if (state.head !== null &&
state.length < state.head.name_max) { state.length < state.head.name_max) {
@@ -1388,7 +1388,7 @@ inf_leave: for (;;) {
} }
s.have -= copy; s.have -= copy;
s.next += copy; s.next += copy;
if (len !== "\0") break inf_leave; if (len !== '\0') break inf_leave;
} }
else if (state.head !== null) else if (state.head !== null)
state.head.name = null; state.head.name = null;
@@ -1399,13 +1399,13 @@ inf_leave: for (;;) {
if (s.have == 0) break inf_leave; if (s.have == 0) break inf_leave;
copy = 0; copy = 0;
if (state.head !== null && state.head.comment === null) { if (state.head !== null && state.head.comment === null) {
state.head.comment = ""; state.head.comment = '';
} }
// TODO end = strm.input_data.indexOf("\0", s.next); // TODO end = strm.input_data.indexOf("\0", s.next);
// TODO state.length => state.head.comment.length // TODO state.length => state.head.comment.length
do { do {
len = strm.input_data.charAt(s.next + copy); copy++; len = strm.input_data.charAt(s.next + copy); copy++;
if(len === "\0") if(len === '\0')
break; break;
if (state.head !== null && if (state.head !== null &&
state.length < state.head.comm_max) { state.length < state.head.comm_max) {
@@ -1417,7 +1417,7 @@ inf_leave: for (;;) {
state.check = strm.checksum_function(state.check, strm.input_data, s.next, copy); state.check = strm.checksum_function(state.check, strm.input_data, s.next, copy);
s.have -= copy; s.have -= copy;
s.next += copy; s.next += copy;
if (len !== "\0") break inf_leave; if (len !== '\0') break inf_leave;
} }
else if (state.head !== null) else if (state.head !== null)
state.head.comment = null; state.head.comment = null;
@@ -1426,7 +1426,7 @@ inf_leave: for (;;) {
if (state.flags & 0x0200) { if (state.flags & 0x0200) {
if(!NEEDBITS(s, 16)) break inf_leave; if(!NEEDBITS(s, 16)) break inf_leave;
if (s.hold != (state.check & 0xffff)) { if (s.hold != (state.check & 0xffff)) {
strm.msg = "header crc mismatch"; strm.msg = 'header crc mismatch';
state.mode = BAD; state.mode = BAD;
break; break;
} }
@@ -1839,7 +1839,7 @@ inf_leave: for (;;) {
state.flags ? s.hold : state.flags ? s.hold :
//#endif //#endif
REVERSE(s.hold)) != state.check) { REVERSE(s.hold)) != state.check) {
strm.msg = "incorrect data check"; strm.msg = 'incorrect data check';
state.mode = BAD; state.mode = BAD;
break; break;
} }