MeshCentral/public/scripts/amt-0.2.0-min.js

1 line
40 KiB
JavaScript
Raw Normal View History

2022-04-09 19:33:02 +03:00
function AmtStackCreateService(e){var C=new Object;C.wsman=e,C.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"],C.PendingEnums=[],C.PendingBatchOperations=0,C.ActiveEnumsCount=0,C.MaxActiveEnumsCount=1,C.onProcessChanged=null;var t=0,n=0;function A(){var e=C.GetPendingActions();t<e&&(t=e),null!=C.onProcessChanged&&n!=e&&(n=e,C.onProcessChanged(e,t)),0==e&&(t=0)}function _(e){C.ActiveEnumsCount-=e,C.ActiveEnumsCount>=C.MaxActiveEnumsCount||0==C.PendingEnums.length||(e=C.PendingEnums.shift(),C.Enum(e[0],e[1],e[2]),_(0))}function c(r){r.names.length<=r.current?r.callback(C,r.name,r.responses,200,r.tag):(C.wsman.ExecGet(C.CompleteName(r.names[r.current]),function(e,t,n,i){var o;o=r,i=i,null==(n=n)||200!=i?o.callback(C,o.name,null,i,o.tag):(o.responses[n.Header.Method]=n,c(o))},r.pri),r.current++),A()}function i(e,t,n,i,o){200==i&&"0"==n.Body.ReturnValue?C.AMT_MessageLog_GetRecords(n.Body.IterationIdentifier,390,m,o):o[0](C,null,o[2])}function m(e,t,n,i,o){if(200==i&&"0"==n.Body.ReturnValue){var r,c,a,s,u,d,S,A,_=o[2],l=new Date,E=n.Body.RecordArray;for(r in"string"==typeof E&&(n.Body.RecordArray=[n.Body.RecordArray]),E){s=null;try{s=window.atob(E[r])}catch(e){}if(null!=s&&0<(u=ReadIntX(s,0))&&u<4294967295){for(a={DeviceAddress:s.charCodeAt(4),EventSensorType:s.charCodeAt(5),EventType:s.charCodeAt(6),EventOffset:s.charCodeAt(7),EventSourceType:s.charCodeAt(8),EventSeverity:s.charCodeAt(9),SensorNumber:s.charCodeAt(10),Entity:s.charCodeAt(11),EntityInstance:s.charCodeAt(12),EventData:[],Time:new Date(1e3*(u+60*l.getTimezoneOffset()))},c=13;c<21;c++)a.EventData.push(s.charCodeAt(c));a.EntityStr=I[a.Entity],a.Desc=(d=a.EventSensorType,S=a.EventOffset,A=a.EventData,a.Entity,15!=d?18!=d||170!=A[0]?6==d?"Authentication failed "+(A[1]+(A[2]<<8))+" times. The system may be under attack.":30==d?"No bootable media":32==d?"Operating system lockup or power interrupt":35!=d?37==d?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+d:64==A[0]?"BIOS POST (Power On Self-Test) Watchdog Timeout.":"System boot failure":"Agent watchdog "+char2hex(A[4])+char2hex(A[3])+char2hex(A[2])+char2hex(A[1])+"-"+char2hex(A[6])+char2hex(A[5])+"-... changed to "+C.WatchdogCurrentStates[A[7]]:235==A[0]?"Invalid Data":(0==S?g:M)[A[1]]),a.EntityStr||(a.EntityStr="Unknown"),_.push(a)}}1!=n.Body.NoMoreRecords?C.AMT_MessageLog_GetRecords(n.Body.IterationIdentifier,390,m,[o[0],_,o[2]]):o[0](C,_,o[2])}else o[0](C,null,o[2])}C.GetPendingActions=function(){return 2*C.PendingEnums.length+C.ActiveEnumsCount+C.wsman.comm.PendingAjax.length+C.wsman.comm.ActiveAjaxCount+C.PendingBatchOperations},C.Subscribe=function(o,e,t,r,c,n,i,a,s,u){C.wsman.ExecSubscribe(C.CompleteName(o),e,t,function(e,t,n,i){A(),r(C,o,n,i,c)},0,n,i,a,s,u),A()},C.UnSubscribe=function(o,r,c,e,t){C.wsman.ExecUnSubscribe(C.CompleteName(o),function(e,t,n,i){A(),r(C,o,n,i,c)},0,e,t),A()},C.Get=function(o,r,c,e){C.wsman.ExecGet(C.CompleteName(o),function(e,t,n,i){A(),r(C,o,n,i,c)},0,e),A()},C.Put=function(o,e,r,c,t,n){C.wsman.ExecPut(C.CompleteName(o),e,function(e,t,n,i){A(),r(C,o,n,i,c)},0,t,n),A()},C.Create=function(o,e,r,c,t){C.wsman.ExecCreate(C.CompleteName(o),e,function(e,t,n,i){A(),r(C,o,n,i,c)},0,t),A()},C.Delete=function(o,e,r,c,t){C.wsman.ExecDelete(C.CompleteName(o),e,function(e,t,n,i){A(),r(C,o,n,i,c)},0,t),A()},C.Exec=function(o,e,t,r,c,n,i){C.wsman.ExecMethod(C.CompleteName(o),e,t,function(e,t,n,i){A(),r(C,o,C.CompleteExecResponse(n),i,c)},0,n,i),A()},C.ExecWithXml=function(o,e,t,r,c,n,i){C.wsman.ExecMethodXml(C.CompleteName(o),e,execArgumentsToXml(t),function(e,t,n,i){A(),r(C,o,C.CompleteExecResponse(n),i,c)},0,n,i),A()},C.Enum=function(r,c,e,t){C.ActiveEnumsCount<C.MaxActiveEnumsCount?(C.ActiveEnumsCount++,C.wsman.ExecEnum(C.CompleteName(r),function(e,t,n,i,o){A(),function(o,e,r,t,n,c){if(200!=n)return r(C,o,null,n,c),_(1);if(null==e||"EnumerateResponse"!=e.Header.Method||!e.Body.EnumerationContext)return r(C,o,null,603,c),_(1);e=e.Body.EnumerationCont