MeshCentral/public/scripts/amt-ider-ws-0.0.1-min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2022-07-24 11:12:00 -04:00
var CreateAmtRemoteIder=function(){var m={};function l(){urlvars&&urlvars.idertrace&&console.log(...arguments)}m.protocol=3,m.bytesToAmt=0,m.bytesFromAmt=0,m.rx_timeout=3e4,m.tx_timeout=0,m.heartbeat=2e4,m.version=1,m.acc="",m.inSequence=0,m.outSequence=0,m.iderinfo=null,m.enabled=!1,m.iderStart=0,m.floppy=null,m.cdrom=null,m.floppyReady=!1,m.cdromReady=!1,m.pingTimer=null;var f=String.fromCharCode(0,38,49,128,0,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),u=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,16,169,8,32,2,0,3,195,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),h=String.fromCharCode(0,38,36,128,0,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0),p=String.fromCharCode(0,92,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0,3,22,0,160,0,0,0,0,0,18,2,0,0,0,0,0,0,0,160,0,0,0,5,30,4,176,2,18,2,0,0,80,0,0,0,0,0,0,0,0,0,0,40,0,0,0,0,0,0,0,2,208,0,0,8,10,0,0,0,0,0,0,0,0,0,0,11,6,0,0,0,17,36,49),R=String.fromCharCode(0,18,1,128,0,0,0,0,26,10,0,0,0,0,0,0,0,0,0,0),E=String.fromCharCode(0,18,1,128,0,0,0,0,29,10,0,0,0,0,0,0,0,0,0,0),I=String.fromCharCode(0,32,1,128,0,0,0,0,42,24,0,0,0,0,32,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),g=String.fromCharCode(0,40,1,128,0,0,0,0,1,6,0,255,0,0,0,0,42,24,0,0,0,0,2,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0),b=(String.fromCharCode(0,0,0,40,0,0,0,8),String.fromCharCode(0,0,3,4,0,8,1,0)),A=String.fromCharCode(0,1,3,4,0,0,0,2),T=String.fromCharCode(0,2,3,4,0,0,0,0),D=String.fromCharCode(0,3,3,4,41,0,0,2),y=String.fromCharCode(0,16,1,8,0,0,8,0,0,1,0,0),_=String.fromCharCode(0,30,3,0),k=String.fromCharCode(1,0,3,0),v=String.fromCharCode(1,5,3,0),O=String.fromCharCode(0,18,36,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),X=String.fromCharCode(0,18,49,128,0,0,0,0,1,10,0,1,0,0,0,0,2,0,0,0),w=String.fromCharCode(0,14,1,128,0,0,0,0,1,6,0,255,0,0,0,0);function F(e,r,n,a){var o=null,t=0;160==e&&(o=m.floppy,null!=m.floppy&&(t=m.floppy.size>>9)),176==e&&(o=m.cdrom,null!=m.cdrom&&(t=m.cdrom.size>>11)),n<0||t<r+n?m.SendCommandEndResponse(1,5,e,33,0):0==n?m.SendCommandEndResponse(1,0,e,0,0):null!=o&&(160==e?(r<<=9,n<<=9):(r<<=11,n<<=11),null!==i?(console.log("IDERERROR: Read while performing read"),m.Stop()):(i=o,d=e,S=r,c=n,function e(r){var n=c,a=S;c>m.iderinfo.readbfr&&(n=m.iderinfo.readbfr);c-=n;S+=n;var o=new FileReader;o.onload=function(){m.SendDataToHost(d,0==c,this.result,1&r),0<c&&0==C?e(r):(i=null,C&&(m.SendCommand(71),C=!1))};o.readAsBinaryString(i.slice(a,a+n))}(a)))}m.xxStateChange=function(e){l("IDER-StateChange",e),0==e&&m.Stop(),3==e&&m.Start()},m.Start=function(){l("IDER-Start"),l(m.floppy,m.cdrom),m.bytesToAmt=0,m.bytesFromAmt=0,m.inSequence=0,m.outSequence=0,m.SendCommand(64,ShortToStrX(m.rx_timeout)+ShortToStrX(m.tx_timeout)+ShortToStrX(m.heartbeat)+IntToStrX(m.version))},m.Stop=function(){l("IDER-Stop"),m.pingTimer&&(clearInterval(m.pingTimer),m.pingTimer=null),m.parent.Stop()},m.ProcessData=function(e){for(m.bytesFromAmt+=e.length,m.acc+=e,l("IDER-ProcessData",m.acc.length,rstr2hex(m.acc));;){var r=m.ProcessDataEx();if(0==r)return;if(m.inSequence!=ReadIntX(m.acc,4))return l("ERROR: Out of sequence",m.inSequence,ReadIntX(m.acc,4)),void m.Stop();m.inSequence++,m.acc=m.acc.substring(r)}},m.SendCommand=function(e,r,n,a){null==r&&(r="");n=50<e&&1==n?2:0,a&&(n+=1),a=String.fromCharCode(e,0,0,n)+IntToStrX(m.outSequence++)+r;m.parent.xxSend(a),m.bytesToAmt+=a.length,75!=e&&l("IDER-SendData",a.length,rstr2hex(a))},m.SendCommandEndResponse=function(e,r,n,a,o){e?m.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,197,0,3,0,0,0,n,80,0,0,0),!0):m.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,r<<4,3,0,0,0,n,81,r,a,o),!0)},m.SendDataToHost=function(e,r,n,a){var o=a?0:n.length;1==r?m.SendCommand(84,String.fromCharCode(0,255&n.length,n.length>>8,0,a?180:181,0,2,0,255&o,o>>8,e,88,133,0,3,0,0,0,e,80,0,0,0,0,0,0)+n,r,a):m.SendCommand(84,String.fromCharCode(0,255&n.length,n.length>>8,0,a?180:181,0,2,0,255&o,o>>8,e,