1 line
6.8 KiB
JavaScript
1 line
6.8 KiB
JavaScript
"use strict";(globalThis["webpackChunksyseye"]=globalThis["webpackChunksyseye"]||[]).push([[773],{3875:(t,e,a)=>{a.d(e,{Z:()=>i});a(5363);function o(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";this.encode=function(a){let o,i,s,r,l,n,c,h="",d=0;a=e(a);while(d<a.length)o=a.charCodeAt(d++),i=a.charCodeAt(d++),s=a.charCodeAt(d++),r=o>>2,l=(3&o)<<4|i>>4,n=(15&i)<<2|s>>6,c=63&s,isNaN(i)?n=c=64:isNaN(s)&&(c=64),h=h+t.charAt(r)+t.charAt(l)+t.charAt(n)+t.charAt(c);return h},this.decode=function(e){let o,i,s,r,l,n,c,h="",d=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(d<e.length)r=t.indexOf(e.charAt(d++)),l=t.indexOf(e.charAt(d++)),n=t.indexOf(e.charAt(d++)),c=t.indexOf(e.charAt(d++)),o=r<<2|l>>4,i=(15&l)<<4|n>>2,s=(3&n)<<6|c,h+=String.fromCharCode(o),64!=n&&(h+=String.fromCharCode(i)),64!=c&&(h+=String.fromCharCode(s));return h=a(h),h};var e=function(t){t=t.replace(/\r\n/g,"\n");let e="";for(let a=0;a<t.length;a++){const o=t.charCodeAt(a);o<128?e+=String.fromCharCode(o):o>127&&o<2048?(e+=String.fromCharCode(o>>6|192),e+=String.fromCharCode(63&o|128)):(e+=String.fromCharCode(o>>12|224),e+=String.fromCharCode(o>>6&63|128),e+=String.fromCharCode(63&o|128))}return e},a=function(t){let e="",a=0,o=0,i=0,s=0;while(a<t.length)o=t.charCodeAt(a),o<128?(e+=String.fromCharCode(o),a++):o>191&&o<224?(s=t.charCodeAt(a+1),e+=String.fromCharCode((31&o)<<6|63&s),a+=2):(s=t.charCodeAt(a+1),i=t.charCodeAt(a+2),e+=String.fromCharCode((15&o)<<12|(63&s)<<6|63&i),a+=3);return e}}const i=o},4773:(t,e,a)=>{a.r(e),a.d(e,{default:()=>Q});var o=a(3673),i=a(2323);const s={class:"q-gutter-md q-mb-sm q-pa-lg"},r={class:"row q-col-gutter-sm"},l={class:"text-h6"},n=(0,o.Uk)(" 由于python+sqlite数据库作为后端,理论上最高支持的主机数量为50. "),c={class:"text-subtitle2"},h={ref:"main_draw",style:{width:"100%",height:"600px"}};function d(t,e,a,d,m,u){const g=(0,o.up)("q-icon"),p=(0,o.up)("q-item-section"),f=(0,o.up)("q-item-label"),w=(0,o.up)("q-color"),C=(0,o.up)("q-banner"),_=(0,o.up)("q-popup-proxy"),S=(0,o.up)("q-item"),b=(0,o.up)("q-card-section"),y=(0,o.up)("q-card");return(0,o.wg)(),(0,o.iD)("div",s,[(0,o._)("div",null,[(0,o.Wm)(y,{class:"bg-transparent no-shadow no-border"},{default:(0,o.w5)((()=>[(0,o.Wm)(b,{class:"q-pa-none"},{default:(0,o.w5)((()=>[(0,o._)("div",r,[((0,o.wg)(!0),(0,o.iD)(o.HY,null,(0,o.Ko)(t.Threatitems,((e,a)=>((0,o.wg)(),(0,o.iD)("div",{key:a,class:"col-md-3 col-sm-12 col-xs-12"},[(0,o.Wm)(S,{style:(0,i.j5)(`background-color: ${e.color1}`),class:"q-pa-none"},{default:(0,o.w5)((()=>[(0,o.Wm)(p,{side:"",style:(0,i.j5)(`background-color: ${e.color2}`),class:"q-pa-lg q-mr-none text-white"},{default:(0,o.w5)((()=>[(0,o.Wm)(g,{name:e.icon,color:"white",size:"24px"},null,8,["name"])])),_:2},1032,["style"]),(0,o.Wm)(p,{class:"q-pa-md q-ml-none text-white"},{default:(0,o.w5)((()=>[(0,o.Wm)(f,{class:"text-white text-h6 text-weight-bolder"},{default:(0,o.w5)((()=>[(0,o.Uk)((0,i.zw)(e.value),1)])),_:2},1024),(0,o.Wm)(f,null,{default:(0,o.w5)((()=>[(0,o.Uk)((0,i.zw)(e.title),1)])),_:2},1024),(0,o.Wm)(_,null,{default:(0,o.w5)((()=>[(0,o.Wm)(C,null,{default:(0,o.w5)((()=>[(0,o.Wm)(w,{modelValue:e.color1,"onUpdate:modelValue":t=>e.color1=t,onChange:e=>t.updateCookie(t.Threatitems[a].color1),class:"my-picker"},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:2},1024)])),_:2},1024)])),_:2},1024),(0,o.Wm)(_,null,{default:(0,o.w5)((()=>[(0,o.Wm)(C,null,{default:(0,o.w5)((()=>[(0,o.Wm)(w,{modelValue:e.color2,"onUpdate:modelValue":t=>e.color2=t,onChange:e=>t.updateCookie(t.Threatitems[a].color2),class:"my-picker"},null,8,["modelValue","onUpdate:modelValue","onChange"])])),_:2},1024)])),_:2},1024)])),_:2},1032,["style"])])))),128))])])),_:1})])),_:1})]),(0,o.Wm)(y,{class:"no-shadow",style:{background:"rbg(255,255,255)"}},{default:(0,o.w5)((()=>[(0,o.Wm)(b,null,{default:(0,o.w5)((()=>[(0,o._)("div",l,[(0,o.Uk)(" 主机数量: "+(0,i.zw)(t.threatStatistics.host_num)+"/50 ",1),(0,o.Wm)(g,{name:"info",class:"text-brown cursor-pointer"},{default:(0,o.w5)((()=>[(0,o.Wm)(_,{"transition-show":"flip-up","transition-hide":"flip-down"},{default:(0,o.w5)((()=>[(0,o.Wm)(C,{class:"bg-brown text-white"},{avatar:(0,o.w5)((()=>[(0,o.Wm)(g,{name:"lightbulb"})])),default:(0,o.w5)((()=>[n])),_:1})])),_:1})])),_:1})]),(0,o._)("div",c,"最近日志数量: "+(0,i.zw)(t.threatStatistics.all_log_num),1)])),_:1}),(0,o.Wm)(b,{class:"q-pt-none"},{default:(0,o.w5)((()=>[(0,o._)("div",h," 1 ",512)])),_:1})])),_:1})])}var m=a(3875),u=a(52),g=a.n(u),p=a(2471),f=a(2256);const w=(0,o.aZ)({name:"Dashboard",data(){return{Threatitems:[{title:"发现的威胁",icon:"remove_red_eye",value:"200",color1:"#EE9B00",color2:"#EE9B00"},{title:"确认的威胁",icon:"flash_on",value:"500",color1:"#CA6702",color2:"#CA6702"},{title:"忽略的威胁",icon:"add_moderator",value:"50",color1:"#BB3E03",color2:"#BB3E03"},{title:"进行中的威胁",icon:"stream",value:"1020",color1:"#AE2012",color2:"#AE2012"}],threatStatistics:{all:1,confirm:0,ingore:1,working:0,host_list:{},host_num:10,all_log_num:647}}},methods:{updateCookie(t){const e=new m.Z;p.Z.set("custom_threat_item",e.encode(JSON.stringify(this.Threatitems)))},get_threatStatistics(){g().get("/api/v1/get/threat_statistics",{"Content-Type":"application/json"}).then((t=>{const e=t.data;e.data&&(this.threatStatistics=e.data,this.threatStatistics.host_num=Object.keys(this.threatStatistics.host_list).length,this.Threatitems[0].value=this.threatStatistics.all,this.Threatitems[1].value=this.threatStatistics.confirm,this.Threatitems[2].value=this.threatStatistics.ingore,this.Threatitems[3].value=this.threatStatistics.working,console.log(this.threatStatistics),this.draw())}))},draw(){const t=[],e=[];for(const s in this.threatStatistics.host_list)t.push(s),e.push({itemStyle:{color:"#005F73"},name:s,type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:this.threatStatistics.host_list[s].log_num});const a=this.$refs.main_draw,o=f.S1(a),i={title:{text:"最近十分钟日志量"},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},legend:{data:t},toolbox:{feature:{saveAsImage:{}}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:["10min","9min","8min","7min","6min","5min","4min","3min","2min","1min"]}],yAxis:[{type:"value"}],series:e};o.setOption(i),setTimeout((()=>{o.resize()}),1e3)}},mounted(){this.get_threatStatistics(),setInterval((()=>{this.get_threatStatistics()}),1e4);const t=p.Z.get("custom_threat_item");if(t){const e=new m.Z;this.Threatitems=JSON.parse(e.decode(t))}}});var C=a(4260),_=a(151),S=a(5589),b=a(3414),y=a(2035),v=a(4554),x=a(2350),A=a(3944),k=a(5607),q=a(281),W=a(7518),Z=a.n(W);const T=(0,C.Z)(w,[["render",d]]),Q=T;Z()(w,"components",{QCard:_.Z,QCardSection:S.Z,QItem:b.Z,QItemSection:y.Z,QIcon:v.Z,QItemLabel:x.Z,QPopupProxy:A.Z,QBanner:k.Z,QColor:q.Z})}}]); |