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

1 line
40 KiB
JavaScript
Raw Normal View History

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