Merge branch 'generic-oidc' of https://github.com/mstrhakr/MeshCentral into generic-oidc

This commit is contained in:
mstrhakr 2022-04-08 11:41:18 -04:00
commit c46761c4e5
17 changed files with 583 additions and 372 deletions

View File

@ -153,6 +153,7 @@ function run(argv) {
if ((typeof args.scan) == 'string') { settings.scan = args.scan; }
if ((typeof args.token) == 'string') { settings.token = args.token; }
if ((typeof args.timeout) == 'string') { settings.timeout = parseInt(args.timeout); }
if ((typeof args.iderstart) == 'string') { settings.iderstart = args.iderstart; }
if ((typeof args.uuidoutput) == 'string' || args.uuidoutput) { settings.uuidoutput = args.uuidoutput; }
if ((typeof args.desc) == 'string') { settings.desc = args.desc; }
if ((typeof args.dnssuffix) == 'string') { settings.dnssuffix = args.dnssuffix; }
@ -295,10 +296,10 @@ function run(argv) {
console.log(' --pass [password] The Intel AMT login password.');
console.log('\r\nOptional arguments:\r\n');
console.log(' --reset, --poweron, --poweroff, --powercycle, --sleep, --hibernate');
console.log(' --user [username] The Intel AMT login username, admin is default.');
console.log(' --tls Specifies that TLS must be used.');
console.log(' --bootdevice [pxe|hdd|cd] Specifies the boot device to use after reset, poweron or powercycle.');
console.log(' --bootindex [number] Specifies the index of boot device to use.');
console.log(' --user [username] The Intel AMT login username, admin is default.');
console.log(' --tls Specifies that TLS must be used.');
console.log(' --bootdevice [pxe|hdd|cd|ider-floppy|ider-cdrom] Specifies the boot device to use after reset, poweron or powercycle.');
console.log(' --bootindex [number] Specifies the index of boot device to use.');
} else if (action == 'amtnetwork') {
console.log('AmtNetwork is used to get/set Intel AMT network interface configuration. Example usage:\r\n\r\n meshcmd amtnetwork --host 1.2.3.4 --user admin --pass mypassword --dhcp');
console.log('\r\nRequired arguments:\r\n');
@ -357,13 +358,14 @@ function run(argv) {
} else if (action == 'amtider') {
console.log('AmtIDER will mount a local disk images to a remote Intel AMT computer. Example usage:\r\n\r\n meshcmd amtider --host 1.2.3.4 --user admin --pass mypassword --tls --floppy disk.img --cdrom disk.iso');
console.log('\r\nPossible arguments:\r\n');
console.log(' --host [hostname] The IP address or DNS name of Intel AMT.');
console.log(' --user [username] The Intel AMT login username, admin is default.');
console.log(' --pass [password] The Intel AMT login password.');
console.log(' --tls Specifies that TLS must be used.');
console.log(' --floppy [file] Specifies .img file to be mounted as a flppy disk.');
console.log(' --cdrom [file] Specifies .img file to be mounted as a CDROM disk.');
console.log(' --timeout [seconds] Optional, disconnect after number of seconds without disk read.');
console.log(' --host [hostname] The IP address or DNS name of Intel AMT.');
console.log(' --user [username] The Intel AMT login username, admin is default.');
console.log(' --pass [password] The Intel AMT login password.');
console.log(' --tls Specifies that TLS must be used.');
console.log(' --floppy [file] Specifies .img file to be mounted as a flppy disk.');
console.log(' --cdrom [file] Specifies .img file to be mounted as a CDROM disk.');
console.log(' --timeout [seconds] Optional, disconnect after number of seconds without disk read.');
console.log(' --iderstart [onreboot|graceful|now] Optional, when to start the IDER session.');
} else if (action == 'amtscan') {
console.log('AmtSCAN will look for Intel AMT device on the network. Example usage:\r\n\r\n meshcmd amtscan --scan 192.168.1.0/24');
console.log('\r\Required arguments:\r\n');
@ -842,20 +844,26 @@ function run(argv) {
//if (settings.poweraction == 0) { console.log('No power action, specify --poweron, --sleep, --powercycle, --poweroff, --hibernate, --reset.'); exit(1); return; }
// Accepted option for boot device are: pxe, hdd, cd
var bootdevices = ['pxe','hdd','cd'];
var ider_bootdevices = ['ider-floppy', 'ider-cdrom']
if (args.bootdevice) {
if (bootdevices.indexOf(args.bootdevice.toLowerCase())>=0) {
settings.bootdevice = args.bootdevice
// Set bootindex to 0 by default, unless overriden
settings.bootindex = 0
settings.ider_bootindex = 0
settings.ider_boot = false;
} else if (ider_bootdevices.indexOf(args.bootdevice.toLowerCase())>=0) {
settings.bootindex = 0
settings.ider_bootindex = ider_bootdevices.indexOf(args.bootdevice.toLowerCase());
settings.ider_boot = true;
} else {
console.log('Supported boot devices are pxe, hdd, cd'); exit(1); return;
console.log('Supported boot devices are pxe, hdd, cd, ider-floppy, ider-cdrom'); exit(1); return;
}
}
// boot index for cd and hdd
if (args.bootindex && args.bootindex >=0) {
settings.bootindex = args.bootindex;
}
performAmtPowerAction();
} else {
console.log('Invalid "action" specified.'); exit(1); return;
@ -2284,6 +2292,8 @@ iderIdleTimer = null;
function performIder() {
if ((settings.floppy != null) && fs.existsSync(settings.floppy) == false) { console.log("Unable to floppy image file: " + settings.floppy); exit(); return; }
if ((settings.cdrom != null) && fs.existsSync(settings.cdrom) == false) { console.log("Unable to CDROM image file: " + settings.cdrom); exit(); return; }
var iderStarts = ['onreboot', 'graceful', 'now'];
if ((settings.iderstart != null) && iderStarts.indexOf(settings.iderstart) < 0) { console.log("Unknown iderstart option: " + settings.iderstart); exit(); return; }
try {
var sfloppy = null, scdrom = null;
if (settings.floppy) { try { if (sfloppy = fs.statSync(settings.floppy)) { sfloppy.file = fs.openSync(settings.floppy, 'rbN'); } } catch (ex) { console.log(ex); exit(1); return; } }
@ -2293,9 +2303,16 @@ function performIder() {
ider.onStateChanged = onIderStateChange;
ider.m.floppy = sfloppy;
ider.m.cdrom = scdrom;
ider.m.iderStart = 1; // OnReboot = 0, Graceful = 1, Now = 2
if (settings.iderstart) {
ider.m.iderStart = iderStarts.indexOf(settings.iderstart);
} else {
ider.m.iderStart = 1; // OnReboot = 0, Graceful = 1, Now = 2
}
ider.m.debug = (settings.debuglevel > 0);
if (settings.timeout > 0) { ider.m.sectorStats = iderSectorStats; }
if (settings.timeout > 0) {
ider.m.sectorStats = iderSectorStats;
ider.m.rx_timeout = settings.timeout;
}
//ider.digestRealmMatch = wsstack.comm.digestRealm;
//ider.tlsv1only = amtstack.wsman.comm.tlsv1only;
ider.Start(settings.hostname, (settings.tls == true) ? 16995 : 16994, settings.username ? 'admin' : settings.username, settings.password, settings.tls);
@ -2945,7 +2962,7 @@ function performAmtPowerAction() {
amtstack = new amt(wsstack);
if (settings.poweraction != 0) {
// Check if there is bootdevice and the command is either poweron, powercycle or reset
if (settings.bootdevice && [2,5,10].indexOf(settings.poweraction)>=0) {
if ((settings.bootdevice || settings.ider_boot) && [2,5,10].indexOf(settings.poweraction)>=0) {
// Change boot order
amtstack.Get('AMT_BootSettingData', powerActionResponse1, 0, 1);
} else {
@ -2972,14 +2989,14 @@ function powerActionResponse1(stack, name, response, status) {
}
r['FirmwareVerbosity'] = 0;
r['ForcedProgressEvents'] = false;
r['IDERBootDevice'] = 0;
r['IDERBootDevice'] = settings.ider_bootindex;
r['LockKeyboard'] = false;
r['LockPowerButton'] = false;
r['LockResetButton'] = false;
r['LockSleepButton'] = false;
r['ReflashBIOS'] = false;
r['UseIDER'] = false;
r['UseSOL'] = false;//
r['UseIDER'] = settings.ider_boot;
r['UseSOL'] = settings.ider_boot
r['UseSafeMode'] = false;
r['UserPasswordBypass'] = false;
if (r['SecureErase'] != null) {
@ -3014,9 +3031,9 @@ function powerActionResponse3(stack, name, response, status) {
if (status != 200) { console.log('SetBootConfigRole failed.'); exit(1); return; }
var bootsources = { 'pxe' : 'Force PXE Boot', 'hdd' : 'Force Hard-drive Boot', 'cd' : 'Force CD/DVD Boot'};
var cbparam='<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_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: ' + bootsources[settings.bootdevice] + '</Selector></SelectorSet></ReferenceParameters>';
if (!settings.bootdevice) { cbparam=null;}
if (!(settings.bootdevice in bootsources)) { cbparam=null;}
amtstack.CIM_BootConfigSetting_ChangeBootOrder(cbparam, function(st, nm, resp, sts) {
if (resp.Body['ReturnValue'] != 0) { console.log('(2) Change Boot Order returns '+ response.Body.ReturnValueStr); exit(1); return; }
if (resp.Body['ReturnValue'] != 0) { console.log('(2) Change Boot Order returns '+ resp.Body.ReturnValueStr); exit(1); return; }
amtstack.RequestPowerStateChange(settings.poweraction, performAmtPowerActionEx);
});
}

View File

@ -30,32 +30,32 @@ module.exports = function CreateAmtRemoteIder() {
obj.debug = false;
// Mode Sense
var IDE_ModeSence_LS120Disk_Page_Array = Buffer.from([0x00, 0x26, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]);
var IDE_ModeSence_3F_LS120_Array = Buffer.from([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]);
var IDE_ModeSence_FloppyDisk_Page_Array = Buffer.from([0x00, 0x26, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x04, 0xB0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]);
var IDE_ModeSence_3F_Floppy_Array = Buffer.from([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1e, 0x04, 0xb0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]);
var IDE_ModeSence_CD_1A_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
//var IDE_ModeSence_CD_1B_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CD_1D_Array = Buffer.from([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CD_2A_Array = Buffer.from([0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
//var IDE_ModeSence_CD_01_Array = Buffer.from([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_3F_CD_Array = Buffer.from([0x00, 0x28, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_LS120Disk_Page_Array = new Buffer([0x00, 0x26, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]);
var IDE_ModeSence_3F_LS120_Array = new Buffer([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x10, 0xA9, 0x08, 0x20, 0x02, 0x00, 0x03, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]);
var IDE_ModeSence_FloppyDisk_Page_Array = new Buffer([0x00, 0x26, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1E, 0x04, 0xB0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xD0, 0x00, 0x00]);
var IDE_ModeSence_3F_Floppy_Array = new Buffer([0x00, 0x5c, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x16, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x05, 0x1e, 0x04, 0xb0, 0x02, 0x12, 0x02, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x00, 0x00, 0x08, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x11, 0x24, 0x31]);
var IDE_ModeSence_CD_1A_Array = new Buffer([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
//var IDE_ModeSence_CD_1B_Array = new Buffer([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CD_1D_Array = new Buffer([0x00, 0x12, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CD_2A_Array = new Buffer([0x00, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
//var IDE_ModeSence_CD_01_Array = new Buffer([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_3F_CD_Array = new Buffer([0x00, 0x28, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
// 0x46 constant data
var IDE_CD_ConfigArrayHeader = Buffer.from([0x00, 0x00,0x00, 0x28, 0x00, 0x00, 0x00, 0x08]);
var IDE_CD_ConfigArrayProfileList = Buffer.from([0x00, 0x00, 0x03, 0x04, 0x00, 0x08, 0x01, 0x00]);
var IDE_CD_ConfigArrayCore = Buffer.from([0x00, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x02]);
var IDE_CD_Morphing = Buffer.from([0x00, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00]);
var IDE_CD_ConfigArrayRemovable = Buffer.from([0x00, 0x03, 0x03, 0x04, 0x29, 0x00, 0x00, 0x02]);
var IDE_CD_ConfigArrayRandom = Buffer.from([0x00, 0x10, 0x01, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00]);
var IDE_CD_Read = Buffer.from([0x00, 0x1E, 0x03, 0x00]);
var IDE_CD_PowerManagement = Buffer.from([0x01, 0x00, 0x03, 0x00]);
var IDE_CD_Timeout = Buffer.from([0x01, 0x05, 0x03, 0x00]);
var IDE_CD_ConfigArrayHeader = new Buffer([0x00, 0x00,0x00, 0x28, 0x00, 0x00, 0x00, 0x08]);
var IDE_CD_ConfigArrayProfileList = new Buffer([0x00, 0x00, 0x03, 0x04, 0x00, 0x08, 0x01, 0x00]);
var IDE_CD_ConfigArrayCore = new Buffer([0x00, 0x01, 0x03, 0x04, 0x00, 0x00, 0x00, 0x02]);
var IDE_CD_Morphing = new Buffer([0x00, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00]);
var IDE_CD_ConfigArrayRemovable = new Buffer([0x00, 0x03, 0x03, 0x04, 0x29, 0x00, 0x00, 0x02]);
var IDE_CD_ConfigArrayRandom = new Buffer([0x00, 0x10, 0x01, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00]);
var IDE_CD_Read = new Buffer([0x00, 0x1E, 0x03, 0x00]);
var IDE_CD_PowerManagement = new Buffer([0x01, 0x00, 0x03, 0x00]);
var IDE_CD_Timeout = new Buffer([0x01, 0x05, 0x03, 0x00]);
// 0x01 constant data
var IDE_ModeSence_FloppyError_Recovery_Array = Buffer.from([0x00, 0x12, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]);
var IDE_ModeSence_Ls120Error_Recovery_Array = Buffer.from([0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CDError_Recovery_Array = Buffer.from([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00]);
var IDE_ModeSence_FloppyError_Recovery_Array = new Buffer([0x00, 0x12, 0x24, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]);
var IDE_ModeSence_Ls120Error_Recovery_Array = new Buffer([0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CDError_Recovery_Array = new Buffer([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00]);
// Private method, called by parent when it change state
@ -125,28 +125,28 @@ module.exports = function CreateAmtRemoteIder() {
// CommandEndResponse (SCSI_SENSE)
obj.SendCommandEndResponse = function (error, sense, device, asc, asq) {
if (error) { obj.SendCommand(0x51, Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc5, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0]), true); }
else { obj.SendCommand(0x51, Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87, (sense << 4), 3, 0, 0, 0, device, 0x51, sense, asc, asq]), true); }
if (error) { obj.SendCommand(0x51, new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xc5, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0]), true); }
else { obj.SendCommand(0x51, new Buffer([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x87, (sense << 4), 3, 0, 0, 0, device, 0x51, sense, asc, asq]), true); }
}
// DataToHost (SCSI_READ)
obj.SendDataToHost = function (device, completed, data, dma) {
var dmalen = (dma) ? 0 : data.length;
if (completed == true) {
obj.SendCommand(0x54, Buffer.concat([Buffer.from([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0x85, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0, 0, 0, 0]), data ]), completed, dma);
obj.SendCommand(0x54, Buffer.concat([new Buffer([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0x85, 0, 3, 0, 0, 0, device, 0x50, 0, 0, 0, 0, 0, 0]), data ]), completed, dma);
} else {
obj.SendCommand(0x54, Buffer.concat([Buffer.from([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), data]), completed, dma);
obj.SendCommand(0x54, Buffer.concat([new Buffer([0, (data.length & 0xff), (data.length >> 8), 0, dma ? 0xb4 : 0xb5, 0, 2, 0, (dmalen & 0xff), (dmalen >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), data]), completed, dma);
}
}
// GetDataFromHost (SCSI_CHUNK)
obj.SendGetDataFromHost = function (device, chunksize) {
obj.SendCommand(0x52, Buffer.from([0, (chunksize & 0xff), (chunksize >> 8), 0, 0xb5, 0, 0, 0, (chunksize & 0xff), (chunksize >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), false);
obj.SendCommand(0x52, new Buffer([0, (chunksize & 0xff), (chunksize >> 8), 0, 0xb5, 0, 0, 0, (chunksize & 0xff), (chunksize >> 8), device, 0x58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), false);
}
// DisableEnableFeatures (STATUS_DATA)
// If type is REGS_TOGGLE (3), 4 bytes of data must be provided.
obj.SendDisableEnableFeatures = function (type, data) { if (data == null) { data = ''; } obj.SendCommand(0x48, Buffer.concat([Buffer.from([type]), data])); }
obj.SendDisableEnableFeatures = function (type, data) { if (data == null) { data = ''; } obj.SendCommand(0x48, Buffer.concat([new Buffer([type]), data])); }
// Private method
obj.ProcessDataEx = function () {
@ -260,7 +260,7 @@ module.exports = function CreateAmtRemoteIder() {
var len = ReadShortX(obj.acc, 9);
if (obj.acc.length < (14 + len)) return 0;
if (obj.debug) console.log('SCSI_WRITE, len = ' + (14 + len));
obj.SendCommand(0x51, Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x70, 0x03, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x07, 0x27, 0x00]), true);
obj.SendCommand(0x51, new Buffer([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x70, 0x03, 0x00, 0x00, 0x00, 0xa0, 0x51, 0x07, 0x27, 0x00]), true);
return 14 + len;
default:
if (obj.debug) console.log('Unknown IDER command', obj.acc[0]);
@ -333,7 +333,7 @@ module.exports = function CreateAmtRemoteIder() {
if (obj.debug) console.log("SCSI Internal error 6", dev);
return -1;
}
obj.SendDataToHost(dev, true, Buffer.from([0, a, b, 0]), featureRegister & 1);
obj.SendDataToHost(dev, true, new Buffer([0, a, b, 0]), featureRegister & 1);
return;
}
obj.SendCommandEndResponse(1, 0x05, dev, 0x24, 0x00);
@ -370,7 +370,7 @@ module.exports = function CreateAmtRemoteIder() {
return -1;
}
obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(8), Buffer.from([0x00, 0x00, 0x0b, 0x40, 0x02, 0x00, 0x02, 0x00]) ]), featureRegister & 1);
obj.SendDataToHost(dev, true, Buffer.concat([IntToStr(8), new Buffer([0x00, 0x00, 0x0b, 0x40, 0x02, 0x00, 0x02, 0x00]) ]), featureRegister & 1);
break;
case 0x25: // READ_CAPACITY
if (obj.debug) console.log("SCSI: READ_CAPACITY", dev);
@ -393,7 +393,7 @@ module.exports = function CreateAmtRemoteIder() {
}
//if (dev == 0xA0) { dev = 0x00; } else { dev = 0x10; } // Weird but seems to work.
if (obj.debug) console.log("SCSI: READ_CAPACITY2", dev, deviceFlags);
obj.SendDataToHost(deviceFlags, true, Buffer.concat([IntToStr(len), Buffer.from([0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0])]), featureRegister & 1);
obj.SendDataToHost(deviceFlags, true, Buffer.concat([IntToStr(len), new Buffer([0, 0, ((dev == 0xB0) ? 0x08 : 0x02), 0])]), featureRegister & 1);
break;
case 0x28: // READ_10
lba = ReadInt(cdb, 2);
@ -427,12 +427,12 @@ module.exports = function CreateAmtRemoteIder() {
return -1;
}
if (format == 1) { obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1); }
if (format == 1) { obj.SendDataToHost(dev, true, new Buffer([0x00, 0x0a, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1); }
else if (format == 0) {
if (msf) {
obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x34, 0x13]), featureRegister & 1);
obj.SendDataToHost(dev, true, new Buffer([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x34, 0x13]), featureRegister & 1);
} else {
obj.SendDataToHost(dev, true, Buffer.from([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1);
obj.SendDataToHost(dev, true, new Buffer([0x00, 0x12, 0x01, 0x01, 0x00, 0x14, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00]), featureRegister & 1);
}
}
break;
@ -482,10 +482,10 @@ module.exports = function CreateAmtRemoteIder() {
var present = 0x00;
if ((dev == 0xA0) && (obj.floppy != null)) { present = 0x02; }
else if ((dev == 0xB0) && (obj.cdrom != null)) { present = 0x02; }
obj.SendDataToHost(dev, true, Buffer.from([0x00, present, 0x80, 0x00]), featureRegister & 1); // This is the original version, 4 bytes long
obj.SendDataToHost(dev, true, new Buffer([0x00, present, 0x80, 0x00]), featureRegister & 1); // This is the original version, 4 bytes long
break;
case 0x4c:
obj.SendCommand(0x51, Buffer.concat([IntToStrX(0), IntToStrX(0), IntToStrX(0), Buffer.from([0x87, 0x50, 0x03, 0x00, 0x00, 0x00, 0xb0, 0x51, 0x05, 0x20, 0x00]) ]), true);
obj.SendCommand(0x51, Buffer.concat([IntToStrX(0), IntToStrX(0), IntToStrX(0), new Buffer([0x87, 0x50, 0x03, 0x00, 0x00, 0x00, 0xb0, 0x51, 0x05, 0x20, 0x00]) ]), true);
break;
case 0x51: // READ_DISC_INFO
if (obj.debug) console.log("SCSI READ_DISC_INFO", dev);
@ -590,10 +590,10 @@ module.exports = function CreateAmtRemoteIder() {
return obj;
}
function ShortToStr(v) { return Buffer.from([(v >> 8) & 0xFF, v & 0xFF]); }
function ShortToStrX(v) { return Buffer.from([v & 0xFF, (v >> 8) & 0xFF]); }
function IntToStr(v) { return Buffer.from([(v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]); }
function IntToStrX(v) { return Buffer.from([v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF]); }
function ShortToStr(v) { return new Buffer([(v >> 8) & 0xFF, v & 0xFF]); }
function ShortToStrX(v) { return new Buffer([v & 0xFF, (v >> 8) & 0xFF]); }
function IntToStr(v) { return new Buffer([(v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF]); }
function IntToStrX(v) { return new Buffer([v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF]); }
function ReadShort(v, p) { return (v[p] << 8) + v[p + 1]; }
function ReadShortX(v, p) { return (v[p + 1] << 8) + v[p]; }
function ReadInt(v, p) { return (v[p] * 0x1000000) + (v[p + 1] << 16) + (v[p + 2] << 8) + v[p + 3]; } // We use "*0x1000000" instead of "<<24" because the shift converts the number to signed int32.

View File

@ -175,8 +175,8 @@ module.exports = function CreateAmtRedirect(module) {
var digest = hex_md5(hex_md5(obj.user + ":" + realm + ":" + obj.pass) + ":" + nonce + ":" + extra + hex_md5("POST:" + obj.authuri));
var totallen = obj.user.length + realm.length + nonce.length + obj.authuri.length + cnonce.length + snc.length + digest.length + 7;
if (authType == 4) totallen += (qop.length + 1);
var buf = Buffer.concat([Buffer.from([0x13, 0x00, 0x00, 0x00, authType]), new Buffer([totallen & 0xFF, (totallen >> 8) & 0xFF, 0x00, 0x00]), new Buffer([obj.user.length]), new Buffer(obj.user), new Buffer([realm.length]), new Buffer(realm), new Buffer([nonce.length]), new Buffer(nonce), new Buffer([obj.authuri.length]), new Buffer(obj.authuri), new Buffer([cnonce.length]), new Buffer(cnonce), new Buffer([snc.length]), new Buffer(snc), new Buffer([digest.length]), new Buffer(digest)]);
if (authType == 4) buf = Buffer.concat([buf, Buffer.from([qop.length]), new Buffer(qop) ]);
var buf = Buffer.concat([new Buffer([0x13, 0x00, 0x00, 0x00, authType]), new Buffer([totallen & 0xFF, (totallen >> 8) & 0xFF, 0x00, 0x00]), new Buffer([obj.user.length]), new Buffer(obj.user), new Buffer([realm.length]), new Buffer(realm), new Buffer([nonce.length]), new Buffer(nonce), new Buffer([obj.authuri.length]), new Buffer(obj.authuri), new Buffer([cnonce.length]), new Buffer(cnonce), new Buffer([snc.length]), new Buffer(snc), new Buffer([digest.length]), new Buffer(digest)]);
if (authType == 4) buf = Buffer.concat([buf, new Buffer([qop.length]), new Buffer(qop) ]);
obj.xxSend(buf);
}
else if (status == 0) { // Success
@ -194,7 +194,7 @@ module.exports = function CreateAmtRedirect(module) {
}
if (obj.protocol == 2) {
// Remote Desktop: Send traffic directly...
obj.xxSend(Buffer.from([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
obj.xxSend(new Buffer([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]));
}
if (obj.protocol == 3) {
// Remote IDER: Send traffic directly...
@ -264,7 +264,7 @@ module.exports = function CreateAmtRedirect(module) {
obj.xxRandomValueHex = function (len) {
var t = [], l = Math.floor(len / 2);
for (var i = 0; i < l; i++) { t.push(obj.tls.generateRandomInteger("0", "255")); }
return Buffer.from(t).toString('hex');
return new Buffer(t).toString('hex');
}
obj.xxOnSocketClosed = function () {
@ -291,9 +291,9 @@ module.exports = function CreateAmtRedirect(module) {
if (obj.amtkeepalivetimer != null) { clearInterval(obj.amtkeepalivetimer); obj.amtkeepalivetimer = null; }
}
obj.RedirectStartSol = Buffer.from([0x10, 0x00, 0x00, 0x00, 0x53, 0x4F, 0x4C, 0x20]);
obj.RedirectStartKvm = Buffer.from([0x10, 0x01, 0x00, 0x00, 0x4b, 0x56, 0x4d, 0x52]);
obj.RedirectStartIder = Buffer.from([0x10, 0x00, 0x00, 0x00, 0x49, 0x44, 0x45, 0x52]);
obj.RedirectStartSol = new Buffer([0x10, 0x00, 0x00, 0x00, 0x53, 0x4F, 0x4C, 0x20]);
obj.RedirectStartKvm = new Buffer([0x10, 0x01, 0x00, 0x00, 0x4b, 0x56, 0x4d, 0x52]);
obj.RedirectStartIder = new Buffer([0x10, 0x00, 0x00, 0x00, 0x49, 0x44, 0x45, 0x52]);
return obj;
}

View File

@ -269,8 +269,7 @@ function AmtStackCreateService(wsmanStack) {
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_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_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); }
@ -992,17 +991,21 @@ function AmtStackCreateService(wsmanStack) {
var endTag = hasNamespace ? '</q:' : '</';
var namespaceDef = hasNamespace ? (' xmlns:q="' + inInstance['__namespace'] + '"') : '';
var result = '<r:' + instanceName + namespaceDef + '>';
for (var prop in inInstance) {
if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
if (typeof inInstance == 'string') {
result += inInstance;
} else {
for (var prop in inInstance) {
if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop])) continue;
if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop])) continue;
if (typeof inInstance[prop] === 'object') {
//result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
console.error('only convert one level down...');
}
else {
result += startTag + prop + '>' + inInstance[prop].toString() + endTag + prop + '>';
if (typeof inInstance[prop] === 'object') {
//result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
console.error('only convert one level down...');
}
else {
result += startTag + prop + '>' + inInstance[prop].toString() + endTag + prop + '>';
}
}
}
result += '</r:' + instanceName + '>';

View File

@ -131,7 +131,7 @@ module.exports.CreateAmtManager = function (parent) {
if ((typeof wifiProfile.password != 'string') || (wifiProfile.password.length < 8) || (wifiProfile.password.length > 63)) continue;
} else if ([5, 7, 32768, 32769].indexOf(wifiProfile.authentication) >= 0) {
// 802.1x authentication
if (domain.amtmanager['802.1x'] == null) continue;
if ((domain.amtmanager['802.1x'] == null) || (typeof domain.amtmanager['802.1x'] != 'object')) continue;
}
goodWifiProfiles.push(wifiProfile);
@ -438,34 +438,7 @@ module.exports.CreateAmtManager = function (parent) {
// We got a new 802.1x profile
devFound.netAuthCredentials = event.response;
console.log('devFound.netAuthCredentials', devFound.netAuthCredentials);
if (devFound.netAuthCredentials.certificate) {
// The new 802.1x profile includes a new certificate, add it now before adding the 802.1x profiles
// devFound.netAuthCredentials.certificate must be in DER encoded format
devFound.consoleMsg("Setting up new 802.1x certificate...");
const f = function AddCertificateResponse(stack, name, response, status) {
if ((status != 200) || (response.Body['ReturnValue'] != 0)) {
AddCertificateResponse.dev.consoleMsg("Unable to set 802.1x certificate.");
} else {
console.log('AddCertificate - TODO', response);
// TODO: Keep the certificate reference since we need it to add 802.1x profiles
// Set the 802.1x wired profile in the device
AddCertificateResponse.dev.consoleMsg("Setting MeshCentral Satellite 802.1x profile...");
const netAuthSatReqData = AddCertificateResponse.dev.netAuthSatReqData;
attempt8021xSyncEx(AddCertificateResponse.dev, netAuthSatReqData);
}
}
f.dev = devFound;
devFound.amtstack.AMT_PublicKeyManagementService_AddCertificate(devFound.netAuthCredentials.certificate, f);
} else {
// No 802.1x certificate, set the 802.1x wired profile in the device
devFound.consoleMsg("Setting MeshCentral Satellite 802.1x profile...");
const netAuthSatReqData = devFound.netAuthSatReqData;
delete devFound.netAuthSatReqData;
attempt8021xSyncEx(devFound, netAuthSatReqData);
}
perform8021xRootCertCheck(devFound);
break;
}
}
@ -764,23 +737,26 @@ module.exports.CreateAmtManager = function (parent) {
attemptCiraSync(dev, function (dev) {
// Check Intel AMT settings
attemptSettingsSync(dev, function (dev) {
// See if we need to get hardware inventory
attemptFetchHardwareInventory(dev, function (dev) {
dev.consoleMsg('Done.');
// Clean unused certificates
attemptCleanCertsSync(dev, function (dev) {
// See if we need to get hardware inventory
attemptFetchHardwareInventory(dev, function (dev) {
dev.consoleMsg('Done.');
// Remove from task limiter if needed
if (dev.taskid != null) { obj.parent.taskLimiter.completed(dev.taskid); delete dev.taskLimiter; }
// Remove from task limiter if needed
if (dev.taskid != null) { obj.parent.taskLimiter.completed(dev.taskid); delete dev.taskLimiter; }
if (dev.connType != 2) {
// Start power polling if not connected to LMS
var ppfunc = function powerPoleFunction() { fetchPowerState(powerPoleFunction.dev); }
ppfunc.dev = dev;
dev.polltimer = new setTimeout(ppfunc, 290000); // Poll for power state every 4 minutes 50 seconds.
fetchPowerState(dev);
} else {
// For LMS connections, close now.
dev.controlMsg({ action: 'close' });
}
if (dev.connType != 2) {
// Start power polling if not connected to LMS
var ppfunc = function powerPoleFunction() { fetchPowerState(powerPoleFunction.dev); }
ppfunc.dev = dev;
dev.polltimer = new setTimeout(ppfunc, 290000); // Poll for power state every 4 minutes 50 seconds.
fetchPowerState(dev);
} else {
// For LMS connections, close now.
dev.controlMsg({ action: 'close' });
}
});
});
});
});
@ -1360,9 +1336,26 @@ module.exports.CreateAmtManager = function (parent) {
//
// Intel AMT WIFI
// Intel AMT WIFI & Wired 802.1x
//
// Check which key pair matches the public key in the certificate
function amtcert_linkCertPrivateKey(certs, keys) {
for (var i in certs) {
var cert = certs[i];
try {
if (keys.length == 0) return;
var publicKeyPEM = forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(cert.X509Certificate)).publicKey).substring(28 + 32).replace(/(\r\n|\n|\r)/gm, "");
for (var j = 0; j < keys.length; j++) {
if (publicKeyPEM === (keys[j]['DERKey'] + '-----END PUBLIC KEY-----')) {
keys[j].XCert = cert; // Link the key pair to the certificate
cert.XPrivateKey = keys[j]; // Link the certificate to the key pair
}
}
} catch (e) { console.log(e); }
}
}
// This method will sync the WIFI profiles from the device and the server, but does not care about profile priority.
// We also sync wired 802.1x at the same time since we only allow a single 802.1x profile per device shared between wired and wireless
// We may want to work on an alternate version that does do priority if requested.
@ -1377,17 +1370,39 @@ module.exports.CreateAmtManager = function (parent) {
dev.taskCount = 1;
dev.taskCompleted = func;
const objQuery = ['CIM_WiFiEndpointSettings', '*CIM_WiFiPort', '*AMT_WiFiPortConfigurationService', 'CIM_IEEE8021xSettings'];
const objQuery = ['CIM_WiFiEndpointSettings', '*CIM_WiFiPort', '*AMT_WiFiPortConfigurationService', 'CIM_IEEE8021xSettings', 'AMT_PublicKeyCertificate', 'AMT_PublicPrivateKeyPair'];
if (parent.config.domains[dev.domainid].amtmanager['802.1x'] != null) { objQuery.push('*AMT_8021XProfile'); }
dev.amtstack.BatchEnum(null, objQuery, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
const domain = parent.config.domains[dev.domainid];
if ((responses['AMT_PublicKeyCertificate'].status != 200) || (responses['AMT_PublicKeyCertificate'].status != 200)) { devTaskCompleted(dev); return; } // We can't get the certificate list, fail and carry on.
const wiredConfig = ((parent.config.domains[dev.domainid].amtmanager['802.1x'] != null) && (responses['AMT_8021XProfile'].status == 200));
// See if we need to perform wired or wireless 802.1x configuration
var wiredConfig = ((parent.config.domains[dev.domainid].amtmanager['802.1x'] != null) && (responses['AMT_8021XProfile'].status == 200));
const wirelessConfig = ((responses['CIM_WiFiEndpointSettings'].status == 200) && (responses['AMT_WiFiPortConfigurationService'].status == 200) && (responses['CIM_WiFiPort'].status == 200) && (responses['CIM_IEEE8021xSettings'].status == 200));
if (!wiredConfig && !wirelessConfig) { devTaskCompleted(dev); return; } // We can't get wired or wireless settings, ignore and carry on.
// Sort out the certificates
var xxCertificates = responses['AMT_PublicKeyCertificate'].responses;
var xxCertPrivateKeys = responses['AMT_PublicPrivateKeyPair'].responses;
for (var i in xxCertificates) {
xxCertificates[i].TrustedRootCertficate = (xxCertificates[i]['TrustedRootCertficate'] == true);
xxCertificates[i].X509CertificateBin = Buffer.from(xxCertificates[i]['X509Certificate'], 'base64').toString('binary');
xxCertificates[i].XIssuer = parseCertName(xxCertificates[i]['Issuer']);
xxCertificates[i].XSubject = parseCertName(xxCertificates[i]['Subject']);
}
amtcert_linkCertPrivateKey(xxCertificates, xxCertPrivateKeys); // This links all certificates and private keys
// Remove any unlinked private keys
for (var i in xxCertPrivateKeys) {
if (!xxCertPrivateKeys[i].XCert) {
dev.amtstack.Delete('AMT_PublicPrivateKeyPair', { 'InstanceID': xxCertPrivateKeys[i]['InstanceID'] }, function (stack, name, response, status) {
//if (status == 200) { dev.consoleMsg("Removed unassigned private key pair."); }
});
}
}
// Check if wired 802.1x needs updating
var newNetAuthProfileRequested = false;
var srvNetAuthProfile = domain.amtmanager['802.1x'];
@ -1504,12 +1519,16 @@ module.exports.CreateAmtManager = function (parent) {
}
}
// Figure out is there are no changes to 802.1x wired configuration
if ((wiredMatch == 0) && (newNetAuthProfileRequested == false)) { wiredConfig = false; }
// See if we need to ask MeshCentral Satellite for a new 802.1x profile
if (newNetAuthProfileRequested && (typeof srvNetAuthProfile.satellitecredentials == 'string')) {
// Credentials for this 802.1x profile are provided using MeshCentral Satellite
// Send a message to Satellite requesting a 802.1x profile for this device
dev.consoleMsg("Requesting 802.1x credentials for " + netAuthStrings[srvNetAuthProfile.authenticationprotocol] + " from MeshCentral Satellite...");
dev.netAuthSatReqId = Buffer.from(parent.crypto.randomBytes(16), 'binary').toString('base64'); // Generate a crypto-secure request id.
dev.netAuthSatReqData = { domain: domain, wiredConfig: wiredConfig, wirelessConfig: wirelessConfig, devNetAuthProfile: devNetAuthProfile, srvNetAuthProfile: srvNetAuthProfile, profilesToAdd: profilesToAdd, prioritiesInUse: prioritiesInUse, responses: responses }
dev.netAuthSatReqData = { domain: domain, wiredConfig: wiredConfig, wirelessConfig: wirelessConfig, devNetAuthProfile: devNetAuthProfile, srvNetAuthProfile: srvNetAuthProfile, profilesToAdd: profilesToAdd, prioritiesInUse: prioritiesInUse, responses: responses, xxCertificates: xxCertificates, xxCertPrivateKeys: xxCertPrivateKeys }
parent.DispatchEvent([srvNetAuthProfile.satellitecredentials], obj, { action: 'satellite', subaction: '802.1x-ProFile-Request', satelliteFlags: 2, nodeid: dev.nodeid, icon: dev.icon, domain: dev.nodeid.split('/')[1], nolog: 1, reqid: dev.netAuthSatReqId, authProtocol: srvNetAuthProfile.authenticationprotocol, devname: dev.name, osname: dev.rname });
// Set a response timeout
@ -1527,14 +1546,89 @@ module.exports.CreateAmtManager = function (parent) {
return;
} else {
// No need to call MeshCentral Satellite for a 802.1x profile, so configure everything now.
attempt8021xSyncEx(dev, { domain: domain, wiredConfig: wiredConfig, wirelessConfig: wirelessConfig, devNetAuthProfile: devNetAuthProfile, srvNetAuthProfile: srvNetAuthProfile, profilesToAdd: profilesToAdd, prioritiesInUse: prioritiesInUse, responses: responses });
attempt8021xSyncEx(dev, { domain: domain, wiredConfig: wiredConfig, wirelessConfig: wirelessConfig, devNetAuthProfile: devNetAuthProfile, srvNetAuthProfile: srvNetAuthProfile, profilesToAdd: profilesToAdd, prioritiesInUse: prioritiesInUse, responses: responses, xxCertificates: xxCertificates, xxCertPrivateKeys: xxCertPrivateKeys });
}
}
});
}
// Check 802.1x root certificate
function perform8021xRootCertCheck(dev) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
// Check if there is a root certificate to add, if we already have it, get the instance id.
if (dev.netAuthCredentials.rootcert) {
var matchingRootCertId = null;
for (var i in dev.netAuthSatReqData.xxCertificates) {
if ((dev.netAuthSatReqData.xxCertificates[i].X509Certificate == dev.netAuthCredentials.rootcert) && (dev.netAuthSatReqData.xxCertificates[i].TrustedRootCertficate)) {
matchingRootCertId = dev.netAuthSatReqData.xxCertificates[i].InstanceID;
}
}
if (matchingRootCertId == null) {
// Root certificate not found, add it
dev.consoleMsg("Setting up new 802.1x root certificate...");
const f = function perform8021xRootCertCheckResponse(stack, name, response, status) {
if ((status != 200) || (response.Body['ReturnValue'] != 0)) {
// Failed to add the root certificate
dev.consoleMsg("Failed to sign the certificate request.");
} else {
// Root certificate added, move on to client certificate checking
perform8021xRootCertCheckResponse.dev.netAuthSatReqData.rootCertInstanceId = response.Body.CreatedCertificate.ReferenceParameters.SelectorSet.Selector.Value;
perform8021xClientCertCheck(perform8021xRootCertCheckResponse.dev);
}
}
f.dev = dev;
dev.amtstack.AMT_PublicKeyManagementService_AddTrustedRootCertificate(dev.netAuthCredentials.rootcert, f);
} else {
// Root certificate already present, move on to client certificate checking
dev.netAuthSatReqData.rootCertInstanceId = matchingRootCertId;
perform8021xClientCertCheck(dev);
}
} else {
// No root certificate to check, move on to client certificate checking
perform8021xClientCertCheck(dev);
}
}
// Check 802.1x client certificate
function perform8021xClientCertCheck(dev) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (dev.netAuthCredentials.certificate) {
// The new 802.1x profile includes a new certificate, add it now before adding the 802.1x profiles
// dev.netAuthCredentials.certificate must be in DER encoded format
dev.consoleMsg("Setting up new 802.1x client certificate...");
const f = function AddCertificateResponse(stack, name, response, status) {
if ((status != 200) || (response.Body['ReturnValue'] != 0)) {
AddCertificateResponse.dev.consoleMsg("Unable to set 802.1x certificate.");
} else {
// Keep the certificate reference since we need it to add 802.1x profiles
const certInstanceId = response.Body.CreatedCertificate.ReferenceParameters.SelectorSet.Selector.Value;
// Set the 802.1x wired profile in the device
AddCertificateResponse.dev.consoleMsg("Setting MeshCentral Satellite 802.1x profile...");
const netAuthSatReqData = AddCertificateResponse.dev.netAuthSatReqData;
delete dev.netAuthSatReqData;
netAuthSatReqData.certInstanceId = certInstanceId;
attempt8021xSyncEx(AddCertificateResponse.dev, netAuthSatReqData);
}
}
f.dev = dev;
dev.amtstack.AMT_PublicKeyManagementService_AddCertificate(dev.netAuthCredentials.certificate, f);
} else {
// No 802.1x certificate, set the 802.1x wired profile in the device
dev.consoleMsg("Setting MeshCentral Satellite 802.1x profile...");
const netAuthSatReqData = dev.netAuthSatReqData;
delete dev.netAuthSatReqData;
attempt8021xSyncEx(dev, netAuthSatReqData);
}
}
// Set the 802.1x wired profile
function attempt8021xSyncEx(dev, devNetAuthData) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
// Unpack
const domain = devNetAuthData.domain;
const devNetAuthProfile = devNetAuthData.devNetAuthProfile;
@ -1548,7 +1642,7 @@ module.exports.CreateAmtManager = function (parent) {
var netAuthProfile = Clone(devNetAuthProfile);
netAuthProfile['Enabled'] = ((srvNetAuthProfile != null) && (typeof srvNetAuthProfile == 'object'));
if (netAuthProfile['Enabled']) {
netAuthProfile['ActiveInS0'] = (srvNetAuthProfile.availableInS0 !== false);
netAuthProfile['ActiveInS0'] = (srvNetAuthProfile.availableins0 !== false);
netAuthProfile['AuthenticationProtocol'] = srvNetAuthProfile.authenticationprotocol;
if (srvNetAuthProfile.roamingidentity && (srvNetAuthProfile.roamingidentity != '')) { netAuthProfile['RoamingIdentity'] = srvNetAuthProfile.roamingidentity; } else { delete netAuthProfile['RoamingIdentity']; }
if (srvNetAuthProfile.servercertificatename && (srvNetAuthProfile.servercertificatename != '')) {
@ -1568,8 +1662,21 @@ module.exports.CreateAmtManager = function (parent) {
delete netAuthProfile['ProtectedAccessCredential'];
delete netAuthProfile['PACPassword'];
}
//if (parseInt(Q('idx_d27clientcert').value) >= 0) { netAuthProfile['ClientCertificate'] = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + xxCertificates[parseInt(Q('idx_d27clientcert').value)]['InstanceID'] + '</w:Selector></w:SelectorSet></a:ReferenceParameters>'; } else { delete sc['ClientCertificate']; }
//if (parseInt(Q('idx_d27servercert').value) >= 0) { netAuthProfile['ServerCertificateIssuer'] = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + xxCertificates[parseInt(Q('idx_d27servercert').value)]['InstanceID'] + '</w:Selector></w:SelectorSet></a:ReferenceParameters>'; } else { delete sc['ServerCertificateIssuer']; }
// Setup Client Certificate
if (devNetAuthData.certInstanceId) {
netAuthProfile['ClientCertificate'] = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + dev.amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + devNetAuthData.certInstanceId + '</w:Selector></w:SelectorSet></a:ReferenceParameters>';
} else {
delete netAuthProfile['ClientCertificate'];
}
// Setup Server Certificate
if (devNetAuthData.rootCertInstanceId) {
netAuthProfile['ServerCertificateIssuer'] = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + dev.amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + devNetAuthData.rootCertInstanceId + '</w:Selector></w:SelectorSet></a:ReferenceParameters>';
} else {
delete netAuthProfile['ServerCertificateIssuer'];
}
netAuthProfile['PxeTimeout'] = (typeof srvNetAuthProfile.pxetimeoutinseconds == 'number') ? srvNetAuthProfile.pxetimeoutinseconds : 120;
// If we have a MeshCentral Satellite profile, use that
@ -1580,10 +1687,11 @@ module.exports.CreateAmtManager = function (parent) {
if (srvNetAuthProfile2.domain && (srvNetAuthProfile2.domain != '')) { netAuthProfile['Domain'] = srvNetAuthProfile2.domain; }
}
}
dev.amtstack.Put('AMT_8021XProfile', netAuthProfile, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (status == 200) { dev.consoleMsg("802.1x wired profile set."); }
if (status == 200) { dev.consoleMsg("802.1x wired profile set."); } else { dev.consoleMsg("Unable to set 802.1x wired profile."); }
attemptWifiSyncEx(dev, devNetAuthData);
});
} else {
@ -1593,6 +1701,8 @@ module.exports.CreateAmtManager = function (parent) {
}
function attemptWifiSyncEx(dev, devNetAuthData) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
// Unpack
const domain = devNetAuthData.domain;
const devNetAuthProfile = devNetAuthData.devNetAuthProfile;
@ -1603,9 +1713,10 @@ module.exports.CreateAmtManager = function (parent) {
const wiredConfig = devNetAuthData.wiredConfig;
const wirelessConfig = devNetAuthData.wirelessConfig;
var taskCounter = 0;
if (wirelessConfig) {
// Add missing WIFI profiles
var nextPriority = 0;
var nextPriority = 1;
for (var i in profilesToAdd) {
while (prioritiesInUse.indexOf(nextPriority) >= 0) { nextPriority++; } // Figure out the next available priority slot.
var profileToAdd = profilesToAdd[i];
@ -1641,8 +1752,15 @@ module.exports.CreateAmtManager = function (parent) {
if (domain.amtmanager['802.1x'].password) { netAuthProfile['Password'] = domain.amtmanager['802.1x'].password; }
if (domain.amtmanager['802.1x'].domain) { netAuthProfile['Domain'] = domain.amtmanager['802.1x'].domain; }
if (domain.amtmanager['802.1x'].authenticationprotocol > 3) { domain.amtmanager['ProtectedAccessCredential'] = profileToAdd['802.1x'].protectedaccesscredentialhex; netAuthProfile['PACPassword'] = profileToAdd['802.1x'].pacpassword; }
//if (parseInt(Q('idx_d12clientcert').value) >= 0) { netAuthSettingsClientCert = '<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://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">' + xxCertificates[parseInt(Q('idx_d12clientcert').value)]['InstanceID'] + '</Selector></SelectorSet></ReferenceParameters>'; }
//if (parseInt(Q('idx_d12servercert').value) >= 0) { netAuthSettingsServerCaCert = '<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://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">' + xxCertificates[parseInt(Q('idx_d12servercert').value)]['InstanceID'] + '</Selector></SelectorSet></ReferenceParameters>'; }
// Setup Client Certificate
if (devNetAuthData.certInstanceId) {
netAuthSettingsClientCert = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + dev.amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + devNetAuthData.certInstanceId + '</w:Selector></w:SelectorSet></a:ReferenceParameters>';
}
// Setup Server Certificate
if (devNetAuthData.rootCertInstanceId) {
netAuthSettingsServerCaCert = '<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>' + dev.amtstack.CompleteName('AMT_PublicKeyCertificate') + '</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + devNetAuthData.rootCertInstanceId + '</w:Selector></w:SelectorSet></a:ReferenceParameters>';
}
// If we have credentials from MeshCentral Satelite, use that
if (dev.netAuthCredentials != null) {
@ -1653,34 +1771,46 @@ module.exports.CreateAmtManager = function (parent) {
}
}
prioritiesInUse.push(nextPriority); // Occupy the priority slot and add the WIFI profile.
dev.amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings(wifiep, wifiepsettinginput, netAuthProfile, netAuthSettingsClientCert, netAuthSettingsServerCaCert, function (stack, name, responses, status) { });
}
// Check if local WIFI profile sync is enabled, if not, enabled it.
if ((responses['AMT_WiFiPortConfigurationService'] != null) && (responses['AMT_WiFiPortConfigurationService'].response != null) && (responses['AMT_WiFiPortConfigurationService'].response['localProfileSynchronizationEnabled'] == 0)) {
responses['AMT_WiFiPortConfigurationService'].response['localProfileSynchronizationEnabled'] = 1;
dev.amtstack.Put('AMT_WiFiPortConfigurationService', responses['AMT_WiFiPortConfigurationService'].response, function (stack, name, response, status) {
if (status != 200) { dev.consoleMsg("Unable to enable local WIFI profile sync."); } else { dev.consoleMsg("Enabled local WIFI profile sync."); }
taskCounter++;
dev.amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings(wifiep, wifiepsettinginput, netAuthProfile, netAuthSettingsClientCert, netAuthSettingsServerCaCert, function (stack, name, response, status) {
if (status != 200) { dev.consoleMsg("Unable to set WIFI profile."); }
if (--taskCounter == 0) { attemptWifiSyncEx2(dev, devNetAuthData); } // All done, complete WIFI configuration
});
}
}
// Change the WIFI state if needed. Right now, we always enable it.
// WifiState = { 3: "Disabled", 32768: "Enabled in S0", 32769: "Enabled in S0, Sx/AC" };
var wifiState = 32769; // For now, always enable WIFI
if (responses['CIM_WiFiPort'].responses.Body.EnabledState != 32769) {
if (wifiState == 3) {
dev.amtstack.CIM_WiFiPort_RequestStateChange(wifiState, null, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (status == 200) { dev.consoleMsg("Disabled WIFI."); }
});
} else {
dev.amtstack.CIM_WiFiPort_RequestStateChange(wifiState, null, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (status == 200) { dev.consoleMsg("Enabled WIFI."); }
});
}
if (taskCounter == 0) { attemptWifiSyncEx2(dev, devNetAuthData); } // All done, complete WIFI configuration
}
function attemptWifiSyncEx2(dev, devNetAuthData) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
const responses = devNetAuthData.responses;
// Check if local WIFI profile sync is enabled, if not, enabled it.
if ((responses['AMT_WiFiPortConfigurationService'] != null) && (responses['AMT_WiFiPortConfigurationService'].response != null) && (responses['AMT_WiFiPortConfigurationService'].response['localProfileSynchronizationEnabled'] == 0)) {
responses['AMT_WiFiPortConfigurationService'].response['localProfileSynchronizationEnabled'] = 1;
dev.amtstack.Put('AMT_WiFiPortConfigurationService', responses['AMT_WiFiPortConfigurationService'].response, function (stack, name, response, status) {
if (status != 200) { dev.consoleMsg("Unable to enable local WIFI profile sync."); } else { dev.consoleMsg("Enabled local WIFI profile sync."); }
});
}
// Change the WIFI state if needed. Right now, we always enable it.
// WifiState = { 3: "Disabled", 32768: "Enabled in S0", 32769: "Enabled in S0, Sx/AC" };
var wifiState = 32769; // For now, always enable WIFI
if (responses['CIM_WiFiPort'].responses.Body.EnabledState != 32769) {
if (wifiState == 3) {
dev.amtstack.CIM_WiFiPort_RequestStateChange(wifiState, null, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (status == 200) { dev.consoleMsg("Disabled WIFI."); }
});
} else {
dev.amtstack.CIM_WiFiPort_RequestStateChange(wifiState, null, function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if (status == 200) { dev.consoleMsg("Enabled WIFI."); }
});
}
}
@ -1690,6 +1820,8 @@ module.exports.CreateAmtManager = function (parent) {
// Request for a RSA key pair generation. This will be used to generate the 802.1x certificate
function attempt8021xKeyGeneration(dev) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
dev.amtstack.AMT_PublicKeyManagementService_GenerateKeyPair(0, 2048, function (stack, name, response, status) {
if ((status != 200) || (response.Body['ReturnValue'] != 0)) {
// Failed to generate a key pair
@ -1706,11 +1838,6 @@ module.exports.CreateAmtManager = function (parent) {
if (xresponse[i]['InstanceID'] == keyInstanceId) {
// We found our matching DER key
DERKey = xresponse[i]['DERKey'];
} else {
// This is not a matching key, since we are here, clean it up.
dev.amtstack.Delete('AMT_PublicPrivateKeyPair', { 'InstanceID': xresponse[i]['InstanceID'] }, function (stack, name, response, status) {
//if (status == 200) { dev.consoleMsg("Removed unassigned private key pair."); }
});
}
}
if (DERKey == null) { dev.consoleMsg("Failed to match the generated RSA key pair."); return; }
@ -1725,6 +1852,8 @@ module.exports.CreateAmtManager = function (parent) {
// 802.1x request to process a Certificate Signing Request, we ask Intel AMT to sign the request
function attempt8021xCRSRequest(dev, event) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
if ((event.response == null) || (event.response.keyInstanceId == null)) return;
var keyPair = '<a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicPrivateKeyPair</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">' + event.response.keyInstanceId + '</w:Selector></w:SelectorSet></a:ReferenceParameters>'; // keyPair EPR Reference
var signingAlgorithm = 1; // 0 = SHA1-RSA, 1 = SHA256-RSA
@ -2119,6 +2248,64 @@ module.exports.CreateAmtManager = function (parent) {
}
//
// Intel AMT Certificate cleanup
//
// Remove any unused, non-trusted certificates
function attemptCleanCertsSync(dev, func) {
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
dev.amtstack.BatchEnum(null, ['AMT_PublicKeyCertificate', 'AMT_PublicPrivateKeyPair'], function (stack, name, responses, status) {
const dev = stack.dev;
if (isAmtDeviceValid(dev) == false) return; // Device no longer exists, ignore this request.
const domain = parent.config.domains[dev.domainid];
if ((responses['AMT_PublicKeyCertificate'].status != 200) || (responses['AMT_PublicKeyCertificate'].status != 200)) { func(dev); return; } // We can't get the certificate list, fail and carry on.
// Sort out the certificates
var xxCertificates = responses['AMT_PublicKeyCertificate'].responses;
var xxCertPrivateKeys = responses['AMT_PublicPrivateKeyPair'].responses;
for (var i in xxCertificates) {
xxCertificates[i].TrustedRootCertficate = (xxCertificates[i]['TrustedRootCertficate'] == true);
xxCertificates[i].X509CertificateBin = Buffer.from(xxCertificates[i]['X509Certificate'], 'base64').toString('binary');
xxCertificates[i].XIssuer = parseCertName(xxCertificates[i]['Issuer']);
xxCertificates[i].XSubject = parseCertName(xxCertificates[i]['Subject']);
}
amtcert_linkCertPrivateKey(xxCertificates, xxCertPrivateKeys); // This links all certificates and private keys
dev.certDeleteTasks = 0;
// Remove any unlinked private keys
for (var i in xxCertPrivateKeys) {
if (!xxCertPrivateKeys[i].XCert) {
dev.certDeleteTasks++;
dev.amtstack.Delete('AMT_PublicPrivateKeyPair', { 'InstanceID': xxCertPrivateKeys[i]['InstanceID'] }, function (stack, name, response, status) {
//if (status == 200) { dev.consoleMsg("Removed unassigned private key pair."); }
if (--dev.certDeleteTasks == 0) { delete dev.certDeleteTasks; func(dev); }
});
}
}
// Try to remove all untrusted certificates
for (var i in xxCertificates) {
if (xxCertificates[i].TrustedRootCertficate == false) {
var privateKeyInstanceId = null;
if (xxCertificates[i].XPrivateKey) { privateKeyInstanceId = { 'InstanceID': xxCertificates[i].XPrivateKey['InstanceID'] }; }
dev.certDeleteTasks++;
dev.amtstack.Delete('AMT_PublicKeyCertificate', { 'InstanceID': xxCertificates[i]['InstanceID'] }, function (stack, name, response, status, tag) {
if ((status == 200) && (tag != null)) {
// If there is a private key, delete it.
dev.amtstack.Delete('AMT_PublicPrivateKeyPair', tag, function () {
if (--dev.certDeleteTasks == 0) { delete dev.certDeleteTasks; func(dev); }
}, 0, 1);
} else {
if (--dev.certDeleteTasks == 0) { delete dev.certDeleteTasks; func(dev); }
}
}, privateKeyInstanceId);
}
}
});
}
//
// Intel AMT Hardware Inventory and Networking
//

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";

View File

@ -56,13 +56,13 @@ e.PendingAjax.shift();b[1](null,a,b[2])}null!=e.websocket&&(e.websocket.close(),
function(a,b,n,k,p){d.host=a;d.port=b;d.user=n;d.pass=k;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof k?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),v=v+(e+
1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+k+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var k=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=k)if(0==k)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var v=0,p=n[v],k=a(new Uint8Array(n.buffer.slice(v+1,v+1+p))),v=v+(p+1),e=n[v],p=a(new Uint8Array(n.buffer.slice(v+
1,v+1+e))),v=v+(e+1),e=0,e=null,B;B="";for(var w=0;32>w;w++)B+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(e=n[v],e=a(new Uint8Array(n.buffer.slice(v+1,v+1+e))),w="00000002:"+B+":"+e+":");n=hex_md5(hex_md5(d.user+":"+k+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));v=d.user.length+k.length+p.length+d.authuri.length+B.length+8+n.length+7;4==c&&(v+=e.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(v)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(k.length)+
k+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(B.length)+B+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(e.length)+e);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(k){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,g,u){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var l=b;if(null!=d.attributes&&0<d.attributes.length)for(l={Value:b},
b=0;b<d.attributes.length;b++)l["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(l):c[d.localName]=null==c[d.localName]?l:[c[d.localName],l]}return c}function k(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";
@ -126,33 +126,33 @@ e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,b){e.Exec
"GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout=
function(a){e.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};e.AMT_SystemDefensePolicy_SetTimeout=function(a,b){e.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:a},b)};e.AMT_SystemDefensePolicy_UpdateStatistics=function(a,b,c,p,d,h){e.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:b},c,p,d,h)};e.AMT_SystemPowerScheme_SetPowerScheme=function(a,b,c){e.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,c,0,{InstanceID:b})};e.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=
function(a,b){e.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,b)};e.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(a,b,c,p,d){e.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:b,Tm2:c},p,d)};e.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,b,c){e.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_WebUIService_RequestStateChange=function(a,b,c){e.Exec("AMT_WebUIService",
"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,p,d,h){e.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,b,c,p,d,h){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,
IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:a},b)};e.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},b)};e.CIM_Account_RequestStateChange=function(a,b,c){e.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},
c)};e.CIM_AccountManagementService_CreateAccount=function(a,b,c){e.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};e.CIM_BootConfigSetting_ChangeBootOrder=function(a,b){e.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};e.CIM_BootService_SetBootConfigRole=function(a,b,c){e.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:b},c,0,1)};e.CIM_BootService_RequestStateChange=function(a,b,c,p){e.Exec("CIM_BootService","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c,p,1)};e.CIM_Card_ConnectorPower=function(a,b,c){e.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},c)};e.CIM_Card_IsCompatible=function(a,b){e.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};e.CIM_Chassis_IsCompatible=function(a,b){e.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};e.CIM_Fan_SetSpeed=function(a,b){e.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},b)};e.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){e.Exec("CIM_KVMRedirectionSAP",
"RequestStateChange",{RequestedState:a},c)};e.CIM_MediaAccessDevice_LockMedia=function(a,b){e.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},b)};e.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){e.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_MediaAccessDevice_Reset=function(a){e.Exec("CIM_MediaAccessDevice","Reset",{},a)};e.CIM_MediaAccessDevice_EnableDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},b)};e.CIM_MediaAccessDevice_OnlineDevice=
function(a,b){e.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},b)};e.CIM_MediaAccessDevice_QuiesceDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},b)};e.CIM_MediaAccessDevice_SaveProperties=function(a){e.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};e.CIM_MediaAccessDevice_RestoreProperties=function(a){e.Exec("CIM_MediaAccessDevice","RestoreProperties",{},a)};e.CIM_MediaAccessDevice_RequestStateChange=function(a,b,c){e.Exec("CIM_MediaAccessDevice","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_PhysicalFrame_IsCompatible=function(a,b){e.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:a},b)};e.CIM_PhysicalPackage_IsCompatible=function(a,b){e.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},b)};e.CIM_PowerManagementService_RequestPowerStateChange=function(a,b,c,p,d){e.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.CIM_PowerSupply_SetPowerState=function(a,
b,c){e.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_PowerSupply_Reset=function(a){e.Exec("CIM_PowerSupply","Reset",{},a)};e.CIM_PowerSupply_EnableDevice=function(a,b){e.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};e.CIM_PowerSupply_OnlineDevice=function(a,b){e.Exec("CIM_PowerSupply","OnlineDevice",{Online:a},b)};e.CIM_PowerSupply_QuiesceDevice=function(a,b){e.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:a},b)};e.CIM_PowerSupply_SaveProperties=function(a){e.Exec("CIM_PowerSupply",
"SaveProperties",{},a)};e.CIM_PowerSupply_RestoreProperties=function(a){e.Exec("CIM_PowerSupply","RestoreProperties",{},a)};e.CIM_PowerSupply_RequestStateChange=function(a,b,c){e.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Processor_SetPowerState=function(a,b,c){e.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Processor_Reset=function(a){e.Exec("CIM_Processor","Reset",{},a)};e.CIM_Processor_EnableDevice=function(a,b){e.Exec("CIM_Processor",
"EnableDevice",{Enabled:a},b)};e.CIM_Processor_OnlineDevice=function(a,b){e.Exec("CIM_Processor","OnlineDevice",{Online:a},b)};e.CIM_Processor_QuiesceDevice=function(a,b){e.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Processor_SaveProperties=function(a){e.Exec("CIM_Processor","SaveProperties",{},a)};e.CIM_Processor_RestoreProperties=function(a){e.Exec("CIM_Processor","RestoreProperties",{},a)};e.CIM_Processor_RequestStateChange=function(a,b,c){e.Exec("CIM_Processor","RequestStateChange",
{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RecordLog_ClearLog=function(a){e.Exec("CIM_RecordLog","ClearLog",{},a)};e.CIM_RecordLog_RequestStateChange=function(a,b,c){e.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RedirectionService_RequestStateChange=function(a,b,c){e.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Sensor_SetPowerState=function(a,b,c){e.Exec("CIM_Sensor","SetPowerState",{PowerState:a,Time:b},
c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sensor_EnableDevice=function(a,b){e.Exec("CIM_Sensor","EnableDevice",{Enabled:a},b)};e.CIM_Sensor_OnlineDevice=function(a,b){e.Exec("CIM_Sensor","OnlineDevice",{Online:a},b)};e.CIM_Sensor_QuiesceDevice=function(a,b){e.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Sensor_SaveProperties=function(a){e.Exec("CIM_Sensor","SaveProperties",{},a)};e.CIM_Sensor_RestoreProperties=function(a){e.Exec("CIM_Sensor","RestoreProperties",
{},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog",
"Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange=
function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a,
b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,
NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin=
function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData",
"DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService",
"StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange=
function(a,b,c){e.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_ProvisioningRecordLog_ClearLog=function(a,b){e.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};e.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){e.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};e.IPS_SecIOService_RequestStateChange=function(a,b,c){e.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,
TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p,d){e.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:p},d)};e.AmtStatusToStr=function(a){return e.AmtStatusCodes[a]?e.AmtStatusCodes[a]:"UNKNOWN_ERROR"};e.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",
9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",
30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",
1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",
2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n,
[a,b,[]])};var E="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
"RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,b,c,p,d,h){console.log(JSON.stringify({WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},null,2));e.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=
function(a,b,c,p,d,h){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:b,IEEE8021xSettingsInput:c,ClientCredential:p,CACredential:d},h)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",{_method_dummy:a},b)};e.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,b){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},
b)};e.CIM_Account_RequestStateChange=function(a,b,c){e.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_AccountManagementService_CreateAccount=function(a,b,c){e.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:b},c)};e.CIM_BootConfigSetting_ChangeBootOrder=function(a,b){e.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},b)};e.CIM_BootService_SetBootConfigRole=function(a,b,c){e.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,
Role:b},c,0,1)};e.CIM_BootService_RequestStateChange=function(a,b,c,p){e.Exec("CIM_BootService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c,p,1)};e.CIM_Card_ConnectorPower=function(a,b,c){e.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:b},c)};e.CIM_Card_IsCompatible=function(a,b){e.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},b)};e.CIM_Chassis_IsCompatible=function(a,b){e.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},b)};e.CIM_Fan_SetSpeed=function(a,b){e.Exec("CIM_Fan",
"SetSpeed",{DesiredSpeed:a},b)};e.CIM_KVMRedirectionSAP_RequestStateChange=function(a,b,c){e.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},c)};e.CIM_MediaAccessDevice_LockMedia=function(a,b){e.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},b)};e.CIM_MediaAccessDevice_SetPowerState=function(a,b,c){e.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_MediaAccessDevice_Reset=function(a){e.Exec("CIM_MediaAccessDevice","Reset",{},a)};e.CIM_MediaAccessDevice_EnableDevice=
function(a,b){e.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},b)};e.CIM_MediaAccessDevice_OnlineDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},b)};e.CIM_MediaAccessDevice_QuiesceDevice=function(a,b){e.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},b)};e.CIM_MediaAccessDevice_SaveProperties=function(a){e.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};e.CIM_MediaAccessDevice_RestoreProperties=function(a){e.Exec("CIM_MediaAccessDevice","RestoreProperties",
{},a)};e.CIM_MediaAccessDevice_RequestStateChange=function(a,b,c){e.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_PhysicalFrame_IsCompatible=function(a,b){e.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:a},b)};e.CIM_PhysicalPackage_IsCompatible=function(a,b){e.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},b)};e.CIM_PowerManagementService_RequestPowerStateChange=function(a,b,c,p,d){e.Exec("CIM_PowerManagementService","RequestPowerStateChange",
{PowerState:a,ManagedElement:b,Time:c,TimeoutPeriod:p},d,0,1)};e.CIM_PowerSupply_SetPowerState=function(a,b,c){e.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_PowerSupply_Reset=function(a){e.Exec("CIM_PowerSupply","Reset",{},a)};e.CIM_PowerSupply_EnableDevice=function(a,b){e.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},b)};e.CIM_PowerSupply_OnlineDevice=function(a,b){e.Exec("CIM_PowerSupply","OnlineDevice",{Online:a},b)};e.CIM_PowerSupply_QuiesceDevice=function(a,b){e.Exec("CIM_PowerSupply",
"QuiesceDevice",{Quiesce:a},b)};e.CIM_PowerSupply_SaveProperties=function(a){e.Exec("CIM_PowerSupply","SaveProperties",{},a)};e.CIM_PowerSupply_RestoreProperties=function(a){e.Exec("CIM_PowerSupply","RestoreProperties",{},a)};e.CIM_PowerSupply_RequestStateChange=function(a,b,c){e.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Processor_SetPowerState=function(a,b,c){e.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Processor_Reset=function(a){e.Exec("CIM_Processor",
"Reset",{},a)};e.CIM_Processor_EnableDevice=function(a,b){e.Exec("CIM_Processor","EnableDevice",{Enabled:a},b)};e.CIM_Processor_OnlineDevice=function(a,b){e.Exec("CIM_Processor","OnlineDevice",{Online:a},b)};e.CIM_Processor_QuiesceDevice=function(a,b){e.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Processor_SaveProperties=function(a){e.Exec("CIM_Processor","SaveProperties",{},a)};e.CIM_Processor_RestoreProperties=function(a){e.Exec("CIM_Processor","RestoreProperties",{},a)};e.CIM_Processor_RequestStateChange=
function(a,b,c){e.Exec("CIM_Processor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RecordLog_ClearLog=function(a){e.Exec("CIM_RecordLog","ClearLog",{},a)};e.CIM_RecordLog_RequestStateChange=function(a,b,c){e.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_RedirectionService_RequestStateChange=function(a,b,c){e.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_Sensor_SetPowerState=function(a,
b,c){e.Exec("CIM_Sensor","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sensor_EnableDevice=function(a,b){e.Exec("CIM_Sensor","EnableDevice",{Enabled:a},b)};e.CIM_Sensor_OnlineDevice=function(a,b){e.Exec("CIM_Sensor","OnlineDevice",{Online:a},b)};e.CIM_Sensor_QuiesceDevice=function(a,b){e.Exec("CIM_Sensor","QuiesceDevice",{Quiesce:a},b)};e.CIM_Sensor_SaveProperties=function(a){e.Exec("CIM_Sensor","SaveProperties",{},a)};e.CIM_Sensor_RestoreProperties=
function(a){e.Exec("CIM_Sensor","RestoreProperties",{},a)};e.CIM_Sensor_RequestStateChange=function(a,b,c){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_StatisticalData_ResetSelectedStats=function(a,b){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},b)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog","KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,b,c){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:b},
c)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog","Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,b){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},b)};e.CIM_Watchdog_OnlineDevice=function(a,b){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},b)};e.CIM_Watchdog_QuiesceDevice=function(a,b){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},b)};e.CIM_Watchdog_SaveProperties=function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog",
"RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange=function(a,b,c){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.CIM_WiFiPort_SetPowerState=function(a,b,c){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:b},c)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,b){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},b)};e.CIM_WiFiPort_OnlineDevice=function(a,b){e.Exec("CIM_WiFiPort","OnlineDevice",
{Online:a},b)};e.CIM_WiFiPort_QuiesceDevice=function(a,b){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},b)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,b,c){e.Exec("CIM_WiFiPort","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HostBasedSetupService_Setup=function(a,b,c,p,d,h,l){e.Exec("IPS_HostBasedSetupService",
"Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,Certificate:p,SigningAlgorithm:d,DigitalSignature:h},l)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:b,IsRootCertificate:c},p)};e.IPS_HostBasedSetupService_AdminSetup=function(a,b,c,p,d,h){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:b,McNonce:c,SigningAlgorithm:p,
DigitalSignature:d},h)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,b,c,p){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:b,DigitalSignature:c},p)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,b){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},b)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=
function(a){e.Exec("IPS_KVMRedirectionSettingData","DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,b){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},b)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,b){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},b)};
e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService","StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,b,c){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_PowerManagementService_RequestOSPowerSavingStateChange=function(a,b,c,p,d){e.Exec("IPS_PowerManagementService","RequestOSPowerSavingStateChange",{OSPowerSavingState:a,ManagedElement:b,
Time:c,TimeoutPeriod:p},d,0,1)};e.IPS_ProvisioningRecordLog_RequestStateChange=function(a,b,c){e.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_ProvisioningRecordLog_ClearLog=function(a,b){e.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},b)};e.IPS_ScreenConfigurationService_SetSessionState=function(a,b,c){e.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:b},c)};e.IPS_SecIOService_RequestStateChange=
function(a,b,c){e.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,TimeoutPeriod:b},c)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,b,c,p,d){e.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:b,Port:c,NetworkDnsSuffix:p},d)};e.AmtStatusToStr=function(a){return e.AmtStatusCodes[a]?e.AmtStatusCodes[a]:"UNKNOWN_ERROR"};e.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",
6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",
26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",
47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",
2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",
4106:"URL_REQUIRED"};e.GetMessageLog=function(a,b){e.AMT_MessageLog_PositionToFirstRecord(n,[a,b,[]])};var E="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
m="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;Entering BIOS 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(";"),
l="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(";");
e.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(";");e.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var h="Boot parameters received from CSME;CSME Boot Option % added successfully;HTTPS URI name resolved;HTTPS connected successfully;HTTPSBoot download is completed;Attempt to boot;Exit boot services".split(";"),
@ -212,14 +212,14 @@ function(a,b){for(var c="",p="",e,d,h,l=0;l<a.byteLength;)e=a[l++],d=a[l++],h=a[
b)+"\r\n",c=c.substr(b));return p+c};e.binary.base64.decode=function(a,b,c){var p=b;p||(p=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");c=c||0;for(var e,h,l,m,g=0,r=c;g<a.length;)e=d[a.charCodeAt(g++)-43],h=d[a.charCodeAt(g++)-43],l=d[a.charCodeAt(g++)-43],m=d[a.charCodeAt(g++)-43],p[r++]=e<<2|h>>4,64!==l&&(p[r++]=(h&15)<<4|l>>2,64!==m&&(p[r++]=(l&3)<<6|m));return b?r-c:p.subarray(0,r)};e.text={utf8:{},utf16:{}};e.text.utf8.encode=function(a,b,c){a=e.encodeUtf8(a);
var p=b;p||(p=new Uint8Array(a.length));for(var d=c=c||0,h=0;h<a.length;++h)p[d++]=a.charCodeAt(h);return b?d-c:p};e.text.utf8.decode=function(a){return e.decodeUtf8(String.fromCharCode.apply(null,a))};e.text.utf16.encode=function(a,b,c){var p=b;p||(p=new Uint8Array(2*a.length));for(var e=new Uint16Array(p.buffer),d=c=c||0,h=c,l=0;l<a.length;++l)e[h++]=a.charCodeAt(l),d+=2;return b?d-c:p};e.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};e.deflate=function(a,
b,c){b=e.decode64(a.deflate(e.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,b.length-4));return b};e.inflate=function(a,b,c){a=a.inflate(e.encode64(b)).rval;return null===a?null:e.decode64(a)};var g=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=e.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},k=function(a,b){if(!a)throw Error("WebStorage not available.");
var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var p=Error(c.error.message);p.id=c.error.id;p.name=c.error.name;throw p;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(e.decode64(c)));return c},m=function(a,b,c,p){var e=k(a,b);null===e&&(e={});e[c]=p;g(a,b,e)},l=function(a,b,c){a=k(a,b);null!==a&&(a=c in a?a[c]:null);return a},h=function(a,b,c){var p=k(a,b);if(null!==p&&c in p){delete p[c];c=!0;for(var e in p){c=!1;break}c&&(p=null);g(a,b,p)}},r=function(a,b){g(a,b,null)},O=function(a,b,
c){var p=null;"undefined"===typeof c&&(c=["web","flash"]);var e,d=!1,h=null,l;for(l in c){e=c[l];try{if("flash"===e||"both"===e){if(null===b[0])throw Error("Flash local storage not available.");p=a.apply(this,b);d="flash"===e}if("web"===e||"both"===e)b[0]=localStorage,p=a.apply(this,b),d=!0}catch(m){h=m}if(d)break}if(!d)throw h;return p};e.setItem=function(a,b,c,p,e){O(m,arguments,e)};e.getItem=function(a,b,c,p){return O(l,arguments,p)};e.removeItem=function(a,b,c,p){O(h,arguments,p)};e.clearItems=
var c=a.getItem(b);if(a.init)if(null===c.rval){if(c.error){var p=Error(c.error.message);p.id=c.error.id;p.name=c.error.name;throw p;}c=null}else c=c.rval;null!==c&&(c=JSON.parse(e.decode64(c)));return c},m=function(a,b,c,p){var d=k(a,b);null===d&&(d={});d[c]=p;g(a,b,d)},l=function(a,b,c){a=k(a,b);null!==a&&(a=c in a?a[c]:null);return a},h=function(a,b,c){var p=k(a,b);if(null!==p&&c in p){delete p[c];c=!0;for(var d in p){c=!1;break}c&&(p=null);g(a,b,p)}},r=function(a,b){g(a,b,null)},O=function(a,b,
c){var p=null;"undefined"===typeof c&&(c=["web","flash"]);var d,e=!1,h=null,l;for(l in c){d=c[l];try{if("flash"===d||"both"===d){if(null===b[0])throw Error("Flash local storage not available.");p=a.apply(this,b);e="flash"===d}if("web"===d||"both"===d)b[0]=localStorage,p=a.apply(this,b),e=!0}catch(m){h=m}if(e)break}if(!e)throw h;return p};e.setItem=function(a,b,c,p,d){O(m,arguments,d)};e.getItem=function(a,b,c,p){return O(l,arguments,p)};e.removeItem=function(a,b,c,p){O(h,arguments,p)};e.clearItems=
function(a,b,c){O(r,arguments,c)};e.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var C=null;e.getQueryVariables=function(a){var b=function(a){var b=
{};a=a.split("&");for(var c=0;c<a.length;c++){var p=a[c].indexOf("="),e;0<p?(e=a[c].substring(0,p),p=a[c].substring(p+1)):(e=a[c],p=null);e in b||(b[e]=[]);e in Object.prototype||null===p||b[e].push(unescape(p))}return b};"undefined"===typeof a?(null===C&&(C="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=C):a=b(a);return a};e.parseFragment=function(a){var b=a,c="",p=a.indexOf("?");0<p&&(b=a.substring(0,p),c=a.substring(p+1));a=b.split("/");
{};a=a.split("&");for(var c=0;c<a.length;c++){var p=a[c].indexOf("="),d;0<p?(d=a[c].substring(0,p),p=a[c].substring(p+1)):(d=a[c],p=null);d in b||(b[d]=[]);d in Object.prototype||null===p||b[d].push(unescape(p))}return b};"undefined"===typeof a?(null===C&&(C="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=C):a=b(a);return a};e.parseFragment=function(a){var b=a,c="",p=a.indexOf("?");0<p&&(b=a.substring(0,p),c=a.substring(p+1));a=b.split("/");
0<a.length&&""===a[0]&&a.shift();p=""===c?{}:e.getQueryVariables(c);return{pathString:b,queryString:c,path:a,query:p}};e.makeRequest=function(a){var b=e.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){var p;"undefined"===typeof a?p=b.query:(p=b.query[a])&&"undefined"!==typeof c&&(p=p[c]);return p},getQueryLast:function(a,b){var p=c.getQuery(a);return p?p[p.length-1]:b}};return c};e.makeLink=function(a,
b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};e.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var p=0,e=b.length;p<e;){var d=b[p++];if(p==e)a[d]=c;else{var h=d in a;if(!h||h&&"object"!==typeof a[d]||h&&null===a[d])a[d]={};a=a[d]}}};e.getPath=function(a,b,c){for(var p=0,e=b.length,d=!0;d&&p<e&&"object"===typeof a&&null!==a;){var h=b[p++];(d=h in a)&&(a=a[h])}return d?a:c};e.deletePath=function(a,b){if("object"===
typeof a&&null!==a)for(var c=0,p=b.length;c<p;){var e=b[c++];if(c==p)delete a[e];else{if(!(e in a)||"object"!==typeof a[e]||null===a[e])break;a=a[e]}}};e.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};e.format=function(a){var b=/%./g,c,p,e=0,d=[];for(p=0;c=b.exec(a);)switch(p=a.substring(p,b.lastIndex-2),0<p.length&&d.push(p),p=b.lastIndex,c=c[0][1],c){case "s":case "o":e<arguments.length?d.push(arguments[e++ +1]):d.push("<?>");break;case "%":d.push("%");break;default:d.push("<#"+
c+"?>")}d.push(a.substring(p));return d.join("")};e.formatNumber=function(a,b,c,p){var e=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var d=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3<d.length?d.length%3:0;return c+(h?d.substr(0,h)+p:"")+d.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+p)+(e?b+Math.abs(a-d).toFixed(e).slice(2):"")};e.formatSize=function(a){return a=1073741824<=a?e.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?e.formatNumber(a/1048576,2,".","")+
b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:"")+(0<c.length?"#"+c:"")};e.setPath=function(a,b,c){if("object"===typeof a&&null!==a)for(var p=0,d=b.length;p<d;){var e=b[p++];if(p==d)a[e]=c;else{var h=e in a;if(!h||h&&"object"!==typeof a[e]||h&&null===a[e])a[e]={};a=a[e]}}};e.getPath=function(a,b,c){for(var p=0,d=b.length,e=!0;e&&p<d&&"object"===typeof a&&null!==a;){var h=b[p++];(e=h in a)&&(a=a[h])}return e?a:c};e.deletePath=function(a,b){if("object"===
typeof a&&null!==a)for(var c=0,p=b.length;c<p;){var d=b[c++];if(c==p)delete a[d];else{if(!(d in a)||"object"!==typeof a[d]||null===a[d])break;a=a[d]}}};e.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};e.format=function(a){var b=/%./g,c,p,d=0,e=[];for(p=0;c=b.exec(a);)switch(p=a.substring(p,b.lastIndex-2),0<p.length&&e.push(p),p=b.lastIndex,c=c[0][1],c){case "s":case "o":d<arguments.length?e.push(arguments[d++ +1]):e.push("<?>");break;case "%":e.push("%");break;default:e.push("<#"+
c+"?>")}e.push(a.substring(p));return e.join("")};e.formatNumber=function(a,b,c,p){var d=isNaN(b=Math.abs(b))?2:b;b=void 0===c?",":c;p=void 0===p?".":p;c=0>a?"-":"";var e=parseInt(a=Math.abs(+a||0).toFixed(d),10)+"",h=3<e.length?e.length%3:0;return c+(h?e.substr(0,h)+p:"")+e.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+p)+(d?b+Math.abs(a-e).toFixed(d).slice(2):"")};e.formatSize=function(a){return a=1073741824<=a?e.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?e.formatNumber(a/1048576,2,".","")+
" MiB":1024<=a?e.formatNumber(a/1024,0)+" KiB":e.formatNumber(a,0)+" bytes"};e.bytesFromIP=function(a){return-1!==a.indexOf(".")?e.bytesFromIPv4(a):-1!==a.indexOf(":")?e.bytesFromIPv6(a):null};e.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=e.createBuffer(),c=0;c<a.length;++c){var p=parseInt(a[c],10);if(isNaN(p))return null;b.putByte(p)}return b.getBytes()};e.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=
2*(8-a.length+b),p=e.createBuffer(),d=0;8>d;++d)if(a[d]&&0!==a[d].length){var h=e.hexToBytes(a[d]);2>h.length&&p.putByte(0);p.putBytes(h)}else p.fillWithByte(0,c),c=0;return p.getBytes()};e.bytesToIP=function(a){return 4===a.length?e.bytesToIPv4(a):16===a.length?e.bytesToIPv6(a):null};e.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};e.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],p=0,d=0;d<a.length;d+=
2){for(var h=e.bytesToHex(a[d]+a[d+1]);"0"===h[0]&&"0"!==h;)h=h.substr(1);if("0"===h){var l=c[c.length-1],m=b.length;l&&m===l.end+1?(l.end=m,l.end-l.start>c[p].end-c[p].start&&(p=c.length-1)):c.push({start:m,end:m})}b.push(h)}0<c.length&&(a=c[p],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};e.estimateCores=function(a,b){function c(a,l,m){if(0===l){var g=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);e.cores=
@ -258,10 +258,10 @@ this._ints;++r)this.tag.putInt32(this._s[r]^e[r]);this.tag.truncate(this.tag.len
p=c>>>1,d=Array(c);d[p]=a.slice(0);for(var e=p>>>1;0<e;)this.pow(d[2*e],d[e]=[]),e>>=1;for(e=2;e<p;){for(var g=1;g<e;++g){var v=d[e],w=d[g];d[e+g]=[v[0]^w[0],v[1]^w[1],v[2]^w[2],v[3]^w[3]]}e*=2}d[0]=[0,0,0,0];for(e=p+1;e<c;++e)g=d[e^p],d[e]=[a[0]^g[0],a[1]^g[1],a[2]^g[2],a[3]^g[3]];return d}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=
u.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.cipherModes)return c.cipherModes;c.defined.cipherModes=!0;for(var v=0;v<g.length;++v)g[v](c);return c.cipherModes}},k=a;a=function(b,c){u="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/cipherModes",["require","module","./util"],function(){n.apply(null,Array.prototype.slice.call(arguments,
0))})})();(function(){function b(a){function c(b,d){a.cipher.registerAlgorithm(b,function(){return new a.aes.Algorithm(b,d)})}function d(){m=!0;O=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),b=0;128>b;++b)a[b]=b<<1,a[b+128]=b+128<<1^283;h=Array(256);r=Array(256);C=Array(4);x=Array(4);for(b=0;4>b;++b)C[b]=Array(256),x[b]=Array(256);for(var c=0,p=0,e,l,g,v,q,b=0;256>b;++b){v=p^p<<1^p<<2^p<<3^p<<4;v=v>>8^v&255^99;h[c]=v;r[v]=c;q=a[v];e=a[c];l=a[e];g=a[l];q^=q<<24^v<<16^v<<8^v;l=(e^l^g)<<24^(c^
g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),p,d=1,e=c.length,m=l*(e+6+1),r=e;r<m;++r)p=c[r-1],0===r%e?(p=h[p>>>16&255]<<24^h[p>>>8&255]<<16^h[p&255]<<8^h[p>>>24]^O[d]<<24,d++):6<e&&4===r%e&&(p=h[p>>>24]<<24^h[p>>>16&255]<<16^h[p>>>8&255]<<8^h[p&255]),c[r]=c[r-e]^p;if(b){for(var d=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r<m;r+=l,L-=l)if(0===r||r===m-l)k[r]=
c[L],k[r+1]=c[L+3],k[r+2]=c[L+2],k[r+3]=c[L+1];else for(var C=0;C<l;++C)p=c[L+C],k[r+(3&-C)]=d[h[p>>>24]]^e[h[p>>>16&255]]^v[h[p>>>8&255]]^w[h[p&255]];c=k}return c}function w(a,b,c,p){var d=a.length/4-1,e,l,g,m,v;p?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[p?3:1]^a[1];B=b[2]^a[2];b=b[p?1:3]^a[3];for(var n=3,u=1;u<d;++u)K=e[w>>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^
l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[p?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[p?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}function k(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
a.cipher.createCipher(c,b.key);var e=d.start;d.start=function(b,c){var h=null;c instanceof a.util.ByteBuffer&&(h=c,c={});c=c||{};c.output=h;c.iv=b;e.call(d,c)};return d}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,p){a=k({key:a,output:c,decrypt:!1,mode:p});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return k({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,p){a=k({key:a,output:c,decrypt:!0,mode:p});a.start(b);return a};a.aes.createDecryptionCipher=
g)<<16^(c^l^g)<<8^c^e^g;for(var w=0;4>w;++w)C[w][c]=q,x[w][v]=l,q=q<<24|q>>>8,l=l<<24|l>>>8;0===c?c=p=1:(c=e^a[a[a[e^g]]],p^=a[a[p]])}}function g(a,b){for(var c=a.slice(0),d,p=1,e=c.length,m=l*(e+6+1),r=e;r<m;++r)d=c[r-1],0===r%e?(d=h[d>>>16&255]<<24^h[d>>>8&255]<<16^h[d&255]<<8^h[d>>>24]^O[p]<<24,p++):6<e&&4===r%e&&(d=h[d>>>24]<<24^h[d>>>16&255]<<16^h[d>>>8&255]<<8^h[d&255]),c[r]=c[r-e]^d;if(b){for(var p=x[0],e=x[1],v=x[2],w=x[3],k=c.slice(0),m=c.length,r=0,L=m-l;r<m;r+=l,L-=l)if(0===r||r===m-l)k[r]=
c[L],k[r+1]=c[L+3],k[r+2]=c[L+2],k[r+3]=c[L+1];else for(var C=0;C<l;++C)d=c[L+C],k[r+(3&-C)]=p[h[d>>>24]]^e[h[d>>>16&255]]^v[h[d>>>8&255]]^w[h[d&255]];c=k}return c}function w(a,b,c,d){var p=a.length/4-1,e,l,g,m,v;d?(e=x[0],l=x[1],g=x[2],m=x[3],v=r):(e=C[0],l=C[1],g=C[2],m=C[3],v=h);var w,k,B,K,E,O;w=b[0]^a[0];k=b[d?3:1]^a[1];B=b[2]^a[2];b=b[d?1:3]^a[3];for(var n=3,u=1;u<p;++u)K=e[w>>>24]^l[k>>>16&255]^g[B>>>8&255]^m[b&255]^a[++n],E=e[k>>>24]^l[B>>>16&255]^g[b>>>8&255]^m[w&255]^a[++n],O=e[B>>>24]^
l[b>>>16&255]^g[w>>>8&255]^m[k&255]^a[++n],b=e[b>>>24]^l[w>>>16&255]^g[k>>>8&255]^m[B&255]^a[++n],w=K,k=E,B=O;c[0]=v[w>>>24]<<24^v[k>>>16&255]<<16^v[B>>>8&255]<<8^v[b&255]^a[++n];c[d?3:1]=v[k>>>24]<<24^v[B>>>16&255]<<16^v[b>>>8&255]<<8^v[w&255]^a[++n];c[2]=v[B>>>24]<<24^v[b>>>16&255]<<16^v[w>>>8&255]<<8^v[k&255]^a[++n];c[d?1:3]=v[b>>>24]<<24^v[w>>>16&255]<<16^v[k>>>8&255]<<8^v[B&255]^a[++n]}function k(b){b=b||{};var c="AES-"+(b.mode||"CBC").toUpperCase(),d;d=b.decrypt?a.cipher.createDecipher(c,b.key):
a.cipher.createCipher(c,b.key);var e=d.start;d.start=function(b,c){var h=null;c instanceof a.util.ByteBuffer&&(h=c,c={});c=c||{};c.output=h;c.iv=b;e.call(d,c)};return d}a.aes=a.aes||{};a.aes.startEncrypting=function(a,b,c,d){a=k({key:a,output:c,decrypt:!1,mode:d});a.start(b);return a};a.aes.createEncryptionCipher=function(a,b){return k({key:a,output:null,decrypt:!1,mode:b})};a.aes.startDecrypting=function(a,b,c,d){a=k({key:a,output:c,decrypt:!0,mode:d});a.start(b);return a};a.aes.createDecryptionCipher=
function(a,b){return k({key:a,output:null,decrypt:!0,mode:b})};a.aes.Algorithm=function(a,b){m||d();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return w(c._w,a,b,!1)},decrypt:function(a,b){return w(c._w,a,b,!0)}}});c._init=!1};a.aes.Algorithm.prototype.initialize=function(b){if(!this._init){var c=b.key,d;if("string"===typeof c&&(16===c.length||24===c.length||32===c.length))c=a.util.createBuffer(c);else if(a.util.isArray(c)&&(16===c.length||24===c.length||32===c.length)){d=
c;for(var c=a.util.createBuffer(),e=0;e<d.length;++e)c.putByte(d[e])}if(!a.util.isArray(c)){d=c;var c=[],h=d.length();if(16===h||24===h||32===h)for(h>>>=2,e=0;e<h;++e)c.push(d.getInt32())}if(!a.util.isArray(c)||4!==c.length&&6!==c.length&&8!==c.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=g(c,b.decrypt&&!d);this._init=!0}};a.aes._expandKey=function(a,b){m||d();return g(a,b)};a.aes._updateBlock=w;c("AES-ECB",a.cipher.modes.ecb);c("AES-CBC",
a.cipher.modes.cbc);c("AES-CFB",a.cipher.modes.cfb);c("AES-OFB",a.cipher.modes.ofb);c("AES-CTR",a.cipher.modes.ctr);c("AES-GCM",a.cipher.modes.gcm);var m=!1,l=4,h,r,O,C,x}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,n=function(a,c){c.exports=function(c){var g=u.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.aes)return c.aes;c.defined.aes=
@ -395,32 +395,32 @@ function(a){a.divRemTo(this.m,null,a)};r.prototype.mulTo=function(a,b,c){a.multi
a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM,c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};u.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};u.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};c.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};
c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};c.prototype.fromString=function(a,b){var d;if(16==b)d=4;else if(8==b)d=3;else if(256==b)d=8;else if(2==b)d=1;else if(32==b)d=5;else if(4==b)d=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var e=a.length,p=!1,g=0;0<=--e;){var h=8==d?a[e]&255:m(a,e);0>h?"-"==a.charAt(e)&&(p=!0):(p=!1,0==g?this.data[this.t++]=h:g+d>this.DB?(this.data[this.t-1]|=(h&(1<<this.DB-g)-1)<<g,this.data[this.t++]=
h>>this.DB-g):this.data[this.t-1]|=h<<g,g+=d,g>=this.DB&&(g-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<g&&(this.data[this.t-1]|=(1<<this.DB-g)-1<<g));this.clamp();p&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,p=Math.floor(a/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+p+1]=this.data[h]>>d|g,g=(this.data[h]&e)<<c;for(h=p-1;0<=h;--h)b.data[h]=0;b.data[p]=g;b.t=this.t+p+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,p=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var g=
c+1;g<this.t;++g)b.data[g-c-1]|=(this.data[g]&p)<<e,b.data[g-c]=this.data[g]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&p)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),p=d.t;for(b.t=p+e.t;0<=--p;)b.data[p]=0;for(p=0;p<e.t;++p)b.data[p+d.t]=d.am(0,e.data[p],b,p,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,p){var g=a.abs();if(!(0>=g.t)){var y=this.abs();if(y.t<g.t)null!=b&&b.fromInt(0),null!=p&&this.copyTo(p);else{null==p&&(p=d());var l=d(),k=this.s;a=a.s;var m=this.DB-h(g.data[g.t-1]);0<m?(g.lShiftTo(m,l),y.lShiftTo(m,p)):(g.copyTo(l),y.copyTo(p));g=l.t;y=l.data[g-1];if(0!=y){var D=y*(1<<this.F1)+(1<g?l.data[g-2]>>this.F2:0),q=this.FV/D,D=(1<<this.F1)/D,r=1<<this.F2,A=p.t,x=A-g,G=null==b?d():b;l.dlShiftTo(x,G);0<=p.compareTo(G)&&
(p.data[p.t++]=1,p.subTo(G,p));c.ONE.dlShiftTo(g,G);for(G.subTo(l,l);l.t<g;)l.data[l.t++]=0;for(;0<=--x;){var w=p.data[--A]==y?this.DM:Math.floor(p.data[A]*q+(p.data[A-1]+r)*D);if((p.data[A]+=l.am(0,w,p,x,0,g))<w)for(l.dlShiftTo(x,G),p.subTo(G,p);p.data[A]<--w;)p.subTo(G,p)}null!=b&&(p.drShiftTo(g,b),k!=a&&c.ZERO.subTo(b,b));p.t=g;p.clamp();0<m&&p.rShiftTo(m,p);0>k&&c.ZERO.subTo(p,p)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var p=d(),g=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(p);0<=--l;)if(b.sqrTo(p,g),0<(a&1<<l))b.mulTo(g,y,p);else var k=p,p=g,g=k;return b.revert(p)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",p=this.t,g=this.DB-p*this.DB%a;if(0<p--)for(g<this.DB&&0<(c=this.data[p]>>g)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=p;)g<a?(c=(this.data[p]&(1<<g)-1)<<a-g,c|=this.data[--p]>>(g+=this.DB-a)):(c=this.data[p]>>(g-=a)&b,0>=g&&(g+=this.DB,--p)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,g=Math.floor(a/this.DB),p=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+g+1]=this.data[h]>>d|p,p=(this.data[h]&e)<<c;for(h=g-1;0<=h;--h)b.data[h]=0;b.data[g]=p;b.t=this.t+g+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,g=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var p=
c+1;p<this.t;++p)b.data[p-c-1]|=(this.data[p]&g)<<e,b.data[p-c]=this.data[p]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&g)<<e);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),e=a.abs(),g=d.t;for(b.t=g+e.t;0<=--g;)b.data[g]=0;for(g=0;g<e.t;++g)b.data[g+d.t]=d.am(0,e.data[g],b,g,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,g){var p=a.abs();if(!(0>=p.t)){var y=this.abs();if(y.t<p.t)null!=b&&b.fromInt(0),null!=g&&this.copyTo(g);else{null==g&&(g=d());var l=d(),k=this.s;a=a.s;var m=this.DB-h(p.data[p.t-1]);0<m?(p.lShiftTo(m,l),y.lShiftTo(m,g)):(p.copyTo(l),y.copyTo(g));p=l.t;y=l.data[p-1];if(0!=y){var D=y*(1<<this.F1)+(1<p?l.data[p-2]>>this.F2:0),q=this.FV/D,D=(1<<this.F1)/D,r=1<<this.F2,A=g.t,x=A-p,G=null==b?d():b;l.dlShiftTo(x,G);0<=g.compareTo(G)&&
(g.data[g.t++]=1,g.subTo(G,g));c.ONE.dlShiftTo(p,G);for(G.subTo(l,l);l.t<p;)l.data[l.t++]=0;for(;0<=--x;){var w=g.data[--A]==y?this.DM:Math.floor(g.data[A]*q+(g.data[A-1]+r)*D);if((g.data[A]+=l.am(0,w,g,x,0,p))<w)for(l.dlShiftTo(x,G),g.subTo(G,g);g.data[A]<--w;)g.subTo(G,g)}null!=b&&(g.drShiftTo(p,b),k!=a&&c.ZERO.subTo(b,b));g.t=p;g.clamp();0<m&&g.rShiftTo(m,g);0>k&&c.ZERO.subTo(g,g)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var g=d(),p=d(),y=b.convert(this),l=h(a)-1;for(y.copyTo(g);0<=--l;)if(b.sqrTo(g,p),0<(a&1<<l))b.mulTo(p,y,g);else var k=g,g=p,p=k;return b.revert(g)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,p=this.DB-g*this.DB%a;if(0<g--)for(p<this.DB&&0<(c=this.data[g]>>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p<a?(c=(this.data[g]&(1<<p)-1)<<a-p,c|=this.data[--g]>>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new r(b):new u(b);return this.exp(a,c)};c.ZERO=l(0);c.ONE=l(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};D.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};D.prototype.revert=function(a){return a};D.prototype.reduce=function(a){a.drShiftTo(this.m.t-
1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};D.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};D.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var N=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],U=67108864/N[N.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
b),c=l(b),p=d(),g=d(),h="";for(this.divRemTo(c,p,g);0<p.signum();)h=(b+g.intValue()).toString(a).substr(1)+h,p.divRemTo(c,p,g);return g.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),p=!1,g=0,h=0,y=0;y<a.length;++y){var l=m(a,y);0>l?"-"==a.charAt(y)&&0==this.signum()&&(p=!0):(h=b*h+l,++g>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=g=0))}0<g&&(this.dMultiply(Math.pow(b,g)),this.dAddOffset(h,0));p&&c.ZERO.subTo(this,
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,p=Math.min(a.t,this.t);for(d=
0;d<p;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=p;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=p;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
b),c=l(b),g=d(),p=d(),h="";for(this.divRemTo(c,g,p);0<g.signum();)h=(b+p.intValue()).toString(a).substr(1)+h,g.divRemTo(c,g,p);return p.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),g=!1,p=0,h=0,y=0;y<a.length;++y){var l=m(a,y);0>l?"-"==a.charAt(y)&&0==this.signum()&&(g=!0):(h=b*h+l,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0<p&&(this.dMultiply(Math.pow(b,p)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),p=G(),g,h=0;h<a;++h){do g=new c(this.bitLength(),p);while(0>=g.compareTo(c.ONE)||0<=g.compareTo(b));g=g.modPow(e,this);if(0!=g.compareTo(c.ONE)&&0!=g.compareTo(b)){for(var y=1;y++<d&&0!=
g.compareTo(b);)if(g=g.modPowInt(2,this),0==g.compareTo(c.ONE))return!1;if(0!=g.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),g=G(),p,h=0;h<a;++h){do p=new c(this.bitLength(),g);while(0>=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var y=1;y++<d&&0!=
p.compareTo(b);)if(p=p.modPowInt(2,this),0==p.compareTo(c.ONE))return!1;if(0!=p.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,C,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,x,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,z,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
A,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,x)};c.prototype.clearBit=function(a){return this.changeBit(a,
A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),p,g=l(1),y;if(0>=c)return g;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=p-1,A=(1<<p)-1;k[1]=y.convert(this);if(1<p)for(c=d(),y.sqrTo(k[1],c);m<=A;)k[m]=d(),y.mulTo(c,k[m-2],k[m]),m+=2;for(var v=a.t-1,x,G=!0,w=d(),c=h(a.data[v])-1;0<=v;){c>=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<<c+1)-1)<<q-c,0<v&&(x|=a.data[v-1]>>this.DB+c-q));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v);
if(G)k[x].copyTo(g),G=!1;else{for(;1<m;)y.sqrTo(g,w),y.sqrTo(w,g),m-=2;0<m?y.sqrTo(g,w):(m=g,g=w,w=m);y.mulTo(w,k[x],g)}for(;0<=v&&0==(a.data[v]&1<<c);)y.sqrTo(g,w),m=g,g=w,w=m,0>--c&&(c=this.DB-1,--v)}return y.revert(g)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),p=l(1),g=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1,
p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a,
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),g,p=l(1),y;if(0>=c)return p;g=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new r(b):b.isEven()?new D(b):new u(b);var k=[],m=3,q=g-1,A=(1<<g)-1;k[1]=y.convert(this);if(1<g)for(c=d(),y.sqrTo(k[1],c);m<=A;)k[m]=d(),y.mulTo(c,k[m-2],k[m]),m+=2;for(var v=a.t-1,x,G=!0,w=d(),c=h(a.data[v])-1;0<=v;){c>=q?x=a.data[v]>>c-q&A:(x=(a.data[v]&(1<<c+1)-1)<<q-c,0<v&&(x|=a.data[v-1]>>this.DB+c-q));for(m=g;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--v);
if(G)k[x].copyTo(p),G=!1;else{for(;1<m;)y.sqrTo(p,w),y.sqrTo(w,p),m-=2;0<m?y.sqrTo(p,w):(m=p,p=w,w=m);y.mulTo(w,k[x],p)}for(;0<=v&&0==(a.data[v]&1<<c);)y.sqrTo(p,w),m=p,p=w,w=m,0>--c&&(c=this.DB-1,--v)}return y.revert(p)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),g=l(1),p=l(0),h=l(0),y=l(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&p.isEven()||(g.addTo(this,g),p.subTo(a,p)),g.rShiftTo(1,
g)):p.isEven()||p.subTo(a,p),p.rShiftTo(1,p);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&g.subTo(h,g),p.subTo(y,p)):(e.subTo(d,e),b&&h.subTo(g,h),y.subTo(p,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a,
new R)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=N[N.length-1]){for(b=0;b<N.length;++b)if(c.data[0]==N[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<N.length;){for(var d=N[b],e=b+1;e<N.length&&d<U;)d*=N[e++];for(d=c.modInt(d);b<e;)if(0==d%N[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var g=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var u,
n=function(a,c){c.exports=function(c){var g=u.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var k=0;k<g.length;++k)g[k](c);return c.jsbn}},k=a;a=function(b,c){u="string"===typeof b?c.slice(2):b.slice(2);if(g)return delete a,k.apply(null,Array.prototype.slice.call(arguments,0));a=k;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,
@ -532,8 +532,8 @@ type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.Algori
tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},A={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},C,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,
type:l.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};h.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,g,h=0;h<a.value.length;++h){d=a.value[h];for(var p=0;p<d.value.length;++p)g={},e=d.value[p],g.type=l.derToOid(e.value[0].value),g.value=e.value[1].value,g.valueTagClass=e.value[1].type,g.type in r&&(g.name=r[g.type],g.name in u&&(g.shortName=u[g.name])),b&&(b.update(g.type),b.update(g.value)),c.push(g)}return c};h.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
a[c],e=l.derToOid(d.value[0].value),d=d.value[1].value,g=0;g<d.length;++g){var p={};p.type=e;p.value=d[g].value;p.valueTagClass=d[g].type;p.type in r&&(p.name=r[p.type],p.name in u&&(p.shortName=u[p.name]));if(p.type===r.extensionRequest){p.extensions=[];for(var k=0;k<p.value.length;++k)p.extensions.push(h.certificateExtensionFromAsn1(p.value[k]))}b.push(p)}return b};var R=function(a,b,c){var d={};if(a!==r["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:r.sha1},mgf:{algorithmOid:r.mgf1,hash:{algorithmOid:r.sha1}},
type:l.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};h.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,g,h=0;h<a.value.length;++h){d=a.value[h];for(var k=0;k<d.value.length;++k)g={},e=d.value[k],g.type=l.derToOid(e.value[0].value),g.value=e.value[1].value,g.valueTagClass=e.value[1].type,g.type in r&&(g.name=r[g.type],g.name in u&&(g.shortName=u[g.name])),b&&(b.update(g.type),b.update(g.value)),c.push(g)}return c};h.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c)for(var d=
a[c],e=l.derToOid(d.value[0].value),d=d.value[1].value,g=0;g<d.length;++g){var k={};k.type=e;k.value=d[g].value;k.valueTagClass=d[g].type;k.type in r&&(k.name=r[k.type],k.name in u&&(k.shortName=u[k.name]));if(k.type===r.extensionRequest){k.extensions=[];for(var p=0;p<k.value.length;++p)k.extensions.push(h.certificateExtensionFromAsn1(k.value[p]))}b.push(k)}return b};var R=function(a,b,c){var d={};if(a!==r["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:r.sha1},mgf:{algorithmOid:r.mgf1,hash:{algorithmOid:r.sha1}},
saltLength:20});c={};a=[];if(!l.validate(b,z,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=l.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=l.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=l.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};h.certificateFromPem=function(b,c,d){b=a.pem.decode(b)[0];if("CERTIFICATE"!==
b.type&&"X509 CERTIFICATE"!==b.type&&"TRUSTED CERTIFICATE"!==b.type)throw c=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),c.headerType=b.type,c;if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=l.fromDer(b.body,d);return h.certificateFromAsn1(d,c)};h.certificateToPem=function(b,c){var d={type:"CERTIFICATE",body:l.toDer(h.certificateToAsn1(b)).getBytes()};
return a.pem.encode(d,{maxline:c})};h.publicKeyFromPem=function(b){b=a.pem.decode(b)[0];if("PUBLIC KEY"!==b.type&&"RSA PUBLIC KEY"!==b.type){var c=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');c.headerType=b.type;throw c;}if(b.procType&&"ENCRYPTED"===b.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");b=l.fromDer(b.body);return h.publicKeyFromAsn1(b)};h.publicKeyToPem=function(b,c){var d={type:"PUBLIC KEY",

File diff suppressed because one or more lines are too long

View File

@ -896,20 +896,24 @@ function instanceToXml(instanceName, inInstance) {
var startTag = hasNamespace ? '<q:' : '<';
var endTag = hasNamespace ? '</q:' : '</';
var namespaceDef = hasNamespace ? (' xmlns:q="' + inInstance['__namespace'] + '"' ): '';
var result = '<r:' + instanceName + namespaceDef + '>';
for(var prop in inInstance) {
if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop]) ) continue;
if (typeof inInstance[prop] === 'object') {
//result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
console.error('only convert one level down...');
}
else {
result += startTag + prop +'>' + inInstance[prop].toString() + endTag + prop +'>';
}
}
var result = '<r:' + instanceName + namespaceDef + '>';
if (typeof inInstance == 'string') {
result += inInstance;
} else {
for (var prop in inInstance) {
if (!inInstance.hasOwnProperty(prop) || prop.indexOf('__') === 0) continue;
if (typeof inInstance[prop] === 'function' || Array.isArray(inInstance[prop])) continue;
if (typeof inInstance[prop] === 'object') {
//result += startTag + prop +'>' + instanceToXml('prop', inInstance[prop]) + endTag + prop +'>';
console.error('only convert one level down...');
}
else {
result += startTag + prop + '>' + inInstance[prop].toString() + endTag + prop + '>';
}
}
}
result += '</r:' + instanceName + '>';
return result;
}