var CreateAmtRedirect=function(e,t){var n={};function r(e){return String.fromCharCode.apply(null,e)}function a(e){for(var t="",n=0;n=1;){var o=0,c=new Uint8Array(n.acc);switch(c[0]){case 17:if(c.byteLength<4)return;if(0===c[1]){if(c.byteLength<13)return;var s=c[12];if(c.byteLength<13+s)return;n.directSend(new Uint8Array([19,0,0,0,0,0,0,0,0])),o=13+s}else n.Stop(1);break;case 20:if(c.byteLength<9)return;var l=new DataView(n.acc).getUint32(5,!0);if(c.byteLength<9+l)return;var h=c[1],u=c[4],S=[];for(i=0;i=0?n.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(n.user.length+n.authuri.length+8)+String.fromCharCode(n.user.length)+n.user+String.fromCharCode(0,0)+String.fromCharCode(n.authuri.length)+n.authuri+String.fromCharCode(0,0,0,0)):n.Stop(2);else if(3!=u&&4!=u||1!=h)if(0==h)switch(n.protocol){case 1:n.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(n.amtsequence++)+ShortToStrX(1e4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1e4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:n.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:n.connectstate=1,n.xxStateChange(3)}else n.Stop(3);else{var d=0,g=f[d],C=r(new Uint8Array(f.buffer.slice(d+1,d+1+g))),m=f[d+=g+1],x=r(new Uint8Array(f.buffer.slice(d+1,d+1+m)));d+=m+1;var y=0,b=null,p=a(32),k="00000002",w="";4==u&&(y=f[d],b=r(new Uint8Array(f.buffer.slice(d+1,d+1+y))),d+=y+1,w=k+":"+p+":"+b+":");var v=hex_md5(hex_md5(n.user+":"+C+":"+n.pass)+":"+x+":"+w+hex_md5("POST:"+n.authuri)),A=n.user.length+C.length+x.length+n.authuri.length+p.length+8+v.length+7;4==u&&(A+=b.length+1);var U=String.fromCharCode(19,0,0,0,u)+IntToStrX(A)+String.fromCharCode(n.user.length)+n.user+String.fromCharCode(C.length)+C+String.fromCharCode(x.length)+x+String.fromCharCode(n.authuri.length)+n.authuri+String.fromCharCode(p.length)+p+String.fromCharCode(8)+k+String.fromCharCode(v.length)+v;4==u&&(U+=String.fromCharCode(b.length)+b),n.xxSend(U)}break;case 33:if(c.byteLength<23)break;o=23,n.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(n.amtsequence++)+String.fromCharCode(0,0,27,0,0,0)),1==n.protocol&&(n.amtkeepalivetimer=setInterval(n.xxSendAmtKeepAlive,2e3)),n.connectstate=1,n.xxStateChange(3);break;case 41:if(c.byteLength<10)break;o=10;break;case 42:if(c.byteLength<10)break;var L=10+(c[9]<<8)+c[8];if(c.byteLength8&&(n.m.ProcessBinaryData?n.m.ProcessBinaryData(new Uint8Array(c.buffer.slice(8))):n.m.ProcessData(r(new Uint8Array(c.buffer.slice(8))))),o=c.byteLength;break;case 240:n.serverIsRecording=!0,o=1;break;default:return console.log("Unknown Intel AMT command: "+c[0]+" acclen="+c.byteLength),void n.Stop(4)}if(0==o)return;o!=n.acc.byteLength?n.acc=n.acc.slice(o):n.acc=null}}},n.directSend=function(e){try{n.socket.send(e.buffer)}catch(e){}},n.xxSend=function(e){if(null!=n.socket&&n.socket.readyState==WebSocket.OPEN){for(var t=new Uint8Array(e.length),r=0;r