增加自定义仪表盘

增加自定义仪表盘
This commit is contained in:
huoji
2022-10-11 20:12:06 +08:00
parent 7752d9465d
commit 1885161d67
21 changed files with 226 additions and 64 deletions

View File

@@ -1 +1 @@
<!DOCTYPE html><html><head><title>Duck Sys Eye</title><meta charset=utf-8><meta name=description content=syseye><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png sizes=128x128 href=icons/favicon-128x128.png><link rel=icon type=image/png sizes=96x96 href=icons/favicon-96x96.png><link rel=icon type=image/png sizes=32x32 href=icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=icons/favicon-16x16.png><link rel=icon type=image/ico href=favicon.ico><script defer src=js/vendor.68a7f1bc.js></script><script defer src=js/app.7c8d084f.js></script><link href=css/vendor.5b8581f0.css rel=stylesheet><link href=css/app.31d6cfe0.css rel=stylesheet></head><body><div id=q-app></div></body></html>
<!DOCTYPE html><html><head><title>Duck Sys Eye</title><meta charset=utf-8><meta name=description content=syseye><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png sizes=128x128 href=icons/favicon-128x128.png><link rel=icon type=image/png sizes=96x96 href=icons/favicon-96x96.png><link rel=icon type=image/png sizes=32x32 href=icons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=icons/favicon-16x16.png><link rel=icon type=image/ico href=favicon.ico><script defer src=js/vendor.ee689f15.js></script><script defer src=js/app.563fee9e.js></script><link href=css/vendor.5b8581f0.css rel=stylesheet><link href=css/app.31d6cfe0.css rel=stylesheet></head><body><div id=q-app></div></body></html>

View File

@@ -1 +1 @@
"use strict";(globalThis["webpackChunksyseye"]=globalThis["webpackChunksyseye"]||[]).push([[219],{4219:(a,e,t)=>{t.r(e),t.d(e,{default:()=>_});var n=t(3673),s=t(2323);function o(a,e,t,o,i,l){const r=(0,n.up)("q-td"),p=(0,n.up)("q-btn"),d=(0,n.up)("q-tr"),h=(0,n.up)("q-table");return(0,n.wg)(),(0,n.j4)(h,{class:"q-pa-lg",dense:a.$q.screen.lt.md,title:"白名单列表",columns:a.data_columns,rows:a.data_columns_data,loading:a.loading,pagination:a.pagination,"onUpdate:pagination":e[0]||(e[0]=e=>a.pagination=e),onRequest:a.onRequest},{body:(0,n.w5)((e=>[(0,n.Wm)(d,{props:e},{default:(0,n.w5)((()=>[(0,n.Wm)(r,{key:"path",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.path),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"hash",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.hash),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"reason",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.reason),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"timestamp",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(a.time_parase(e.row.timestamp)),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"action",props:e},{default:(0,n.w5)((()=>[(0,n.Wm)(p,{color:"red",label:"移除白名单",onClick:t=>a.delete_white_hash(e.row.hash)},null,8,["onClick"])])),_:2},1032,["props"])])),_:2},1032,["props"])])),_:1},8,["dense","columns","rows","loading","pagination","onRequest"])}var i=t(52),l=t.n(i);const r=(0,n.aZ)({name:"WhiteList",data:function(){return{data_columns:[{name:"path",align:"center",label:"路径",field:"path"},{name:"hash",align:"center",label:"hash",field:"hash"},{name:"reason",align:"center",label:"原因",field:"reason"},{name:"timestamp",align:"center",label:"时间",field:"timestamp"},{name:"action",align:"center",label:"操作",field:"steamid"}],data_columns_data:[],loading:!1,pagination:{sortBy:"desc",descending:!1,page:1,rowsPerPage:10,rowsNumber:10}}},mounted(){this.onRequest({pagination:this.pagination,filter:void 0})},methods:{delete_white_hash(a){l().get("/api/v1/del/white_list?hash="+a).then((a=>{this.onRequest({pagination:this.pagination,filter:void 0})}))},time_parase(a){const e=a=>a<10?"0"+a:a,t=new Date(Number(a));console.log("time",a);const n=t.getFullYear(),s=t.getMonth()+1,o=t.getDate(),i=t.getHours(),l=t.getMinutes(),r=t.getSeconds();return n+"-"+e(s)+"-"+e(o)+" "+e(i)+":"+e(l)+":"+e(r)},onRequest(a){this.data_columns_data=[],this.loading=!0;const{page:e}=a.pagination;l().get("/api/v1/query/white_list_all").then((a=>{const t=a.data.result;console.log(t);for(let e=0;e<t.length;e++){const a=t[e];this.data_columns_data.push(a)}this.pagination.page=e,this.pagination.rowsNumber=this.data_columns_data.length,this.pagination.rowsPerPage=this.data_columns_data.length,this.loading=!1}))}}});var p=t(4260),d=t(4147),h=t(8186),g=t(3884),u=t(8240),m=t(7518),c=t.n(m);const w=(0,p.Z)(r,[["render",o]]),_=w;c()(r,"components",{QTable:d.Z,QTr:h.Z,QTd:g.Z,QBtn:u.Z})}}]);
"use strict";(globalThis["webpackChunksyseye"]=globalThis["webpackChunksyseye"]||[]).push([[219],{4219:(a,e,t)=>{t.r(e),t.d(e,{default:()=>_});var n=t(3673),s=t(2323);function o(a,e,t,o,i,l){const r=(0,n.up)("q-td"),p=(0,n.up)("q-btn"),d=(0,n.up)("q-tr"),h=(0,n.up)("q-table");return(0,n.wg)(),(0,n.j4)(h,{class:"q-pa-lg",dense:a.$q.screen.lt.md,title:"白名单列表",columns:a.data_columns,rows:a.data_columns_data,loading:a.loading,pagination:a.pagination,"onUpdate:pagination":e[0]||(e[0]=e=>a.pagination=e),onRequest:a.onRequest},{body:(0,n.w5)((e=>[(0,n.Wm)(d,{props:e},{default:(0,n.w5)((()=>[(0,n.Wm)(r,{key:"path",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.path),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"hash",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.hash),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"reason",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(e.row.reason),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"timestamp",props:e},{default:(0,n.w5)((()=>[(0,n.Uk)((0,s.zw)(a.time_parase(e.row.timestamp)),1)])),_:2},1032,["props"]),(0,n.Wm)(r,{key:"action",props:e},{default:(0,n.w5)((()=>[(0,n.Wm)(p,{color:"red",label:"移除白名单",onClick:t=>a.delete_white_hash(e.row.hash)},null,8,["onClick"])])),_:2},1032,["props"])])),_:2},1032,["props"])])),_:1},8,["dense","columns","rows","loading","pagination","onRequest"])}var i=t(52),l=t.n(i);const r=(0,n.aZ)({name:"WhiteList",data:function(){return{data_columns:[{name:"path",align:"center",label:"路径",field:"path"},{name:"hash",align:"center",label:"hash",field:"hash"},{name:"reason",align:"center",label:"原因",field:"reason"},{name:"timestamp",align:"center",label:"时间",field:"timestamp"},{name:"action",align:"center",label:"操作",field:"steamid"}],data_columns_data:[],loading:!1,pagination:{sortBy:"desc",descending:!1,page:1,rowsPerPage:10,rowsNumber:10}}},mounted(){this.onRequest({pagination:this.pagination,filter:void 0})},methods:{delete_white_hash(a){l().get("/api/v1/del/white_list?hash="+a).then((a=>{this.onRequest({pagination:this.pagination,filter:void 0})}))},time_parase(a){const e=a=>a<10?"0"+a:a,t=new Date(Number(a));console.log("time",a);const n=t.getFullYear(),s=t.getMonth()+1,o=t.getDate(),i=t.getHours(),l=t.getMinutes(),r=t.getSeconds();return n+"-"+e(s)+"-"+e(o)+" "+e(i)+":"+e(l)+":"+e(r)},onRequest(a){this.data_columns_data=[],this.loading=!0;const{page:e}=a.pagination;l().get("/api/v1/query/white_list_all").then((a=>{const t=a.data.result;console.log(t);for(let e=0;e<t.length;e++){const a=t[e];this.data_columns_data.push(a)}this.pagination.page=e,this.pagination.rowsNumber=this.data_columns_data.length,this.pagination.rowsPerPage=this.data_columns_data.length,this.loading=!1}))}}});var p=t(4260),d=t(7898),h=t(8186),g=t(3884),u=t(8240),m=t(7518),c=t.n(m);const w=(0,p.Z)(r,[["render",o]]),_=w;c()(r,"components",{QTable:d.Z,QTr:h.Z,QTd:g.Z,QBtn:u.Z})}}]);

View File

@@ -1 +0,0 @@
"use strict";(globalThis["webpackChunksyseye"]=globalThis["webpackChunksyseye"]||[]).push([[385],{6385:(t,e,n)=>{n.r(e),n.d(e,{default:()=>Z});var l=n(3673);const r=(0,l.Uk)(" RmEye测试版v1.0.1.3 "),i={key:1,class:"q-gutter-md q-mb-sm q-pa-lg"};function o(t,e,n,o,a,u){const s=(0,l.up)("q-toolbar-title"),h=(0,l.up)("q-btn"),d=(0,l.up)("q-toolbar"),c=(0,l.up)("q-breadcrumbs-el"),g=(0,l.up)("q-breadcrumbs"),m=(0,l.up)("q-header"),p=(0,l.up)("router-view"),b=(0,l.up)("q-page-container"),w=(0,l.up)("HtmlPanel"),T=(0,l.up)("q-layout");return(0,l.wg)(),(0,l.j4)(T,{view:"lHh Lpr lFf",style:{"background-color":"rgb(239, 243, 246)"}},{default:(0,l.w5)((()=>[(0,l.Wm)(m,{elevated:"","height-hint":"98"},{default:(0,l.w5)((()=>[(0,l.Wm)(d,{class:"text-white",style:{"background-color":"rgb(210,61,42)"}},{default:(0,l.w5)((()=>[(0,l.Wm)(s,null,{default:(0,l.w5)((()=>[r])),_:1}),(0,l.Wm)(h,{flat:"",round:"",dense:"",icon:"lightbulb"})])),_:1}),(0,l.Wm)(d,{style:{"font-size":"16px","background-color":"rgb(47,43,48)"}},{default:(0,l.w5)((()=>[(0,l.Wm)(g,{"active-color":"white"},{default:(0,l.w5)((()=>[(0,l.Wm)(c,{label:"仪表盘",icon:"dashboard",to:"/page/dashboard"}),(0,l.Wm)(c,{label:"未处理威胁列表",icon:"report",to:"#",onClick:e[0]||(e[0]=e=>{t.routerToThreatList(0)})}),(0,l.Wm)(c,{label:"已处理威胁列表",icon:"done",to:"#",onClick:e[1]||(e[1]=e=>{t.routerToThreatList(1)})}),(0,l.Wm)(c,{label:"已忽略威胁列表",icon:"texture",to:"#",onClick:e[2]||(e[2]=e=>{t.routerToThreatList(2)})}),(0,l.Wm)(c,{label:"白名单列表",icon:"list",to:"#",onClick:e[3]||(e[3]=e=>{t.routerToWhiteList()})})])),_:1})])),_:1})])),_:1}),0==t.isInPlugin?((0,l.wg)(),(0,l.j4)(b,{key:0},{default:(0,l.w5)((()=>[(0,l.Wm)(p)])),_:1})):(0,l.kq)("",!0),t.isInPlugin?((0,l.wg)(),(0,l.iD)("div",i,[(0,l.Wm)(w,{url:t.PluginUrl,"onUpdate:url":e[4]||(e[4]=e=>t.PluginUrl=e)},null,8,["url"])])):(0,l.kq)("",!0)])),_:1})}const a=["innerHTML"];function u(t,e,n,r,i,o){return(0,l.wg)(),(0,l.iD)("div",{innerHTML:t.html},null,8,a)}var s=n(52),h=n.n(s);const d=(0,l.aZ)({props:{url:{required:!0}},data(){return{html:""}},watch:{url(t){this.load(t)}},mounted(){this.load(this.url)},methods:{load(t){if(t&&t.length>0){const e={accept:"text/html, text/plain"};h().get(t,e).then((t=>{this.html=t.data})).catch((()=>{this.html="加载失败"}))}}}});var c=n(4260);const g=(0,c.Z)(d,[["render",u]]),m=g,p=(0,l.aZ)({components:{HtmlPanel:m},name:"MainLayout",setup(){return{}},data:function(){return{selectLabel:"dashboard",drawer:!1,miniState:!0,plugin:[],isInPlugin:!1,PluginUrl:""}},methods:{routerToWhiteList(){this.isInPlugin=!1,this.$router.push({name:"whitelist"})},routerToThreatList(t){this.isInPlugin=!1,this.$router.push({name:"index",params:{queryIndex:t}})},routerToPlugin(t){this.isInPlugin=!0,this.PluginUrl="/plugin/"+t},getPluginsMenu(){h().get("/api/v1/get/plugin_menu",{"Content-Type":"application/json"}).then((t=>{this.plugin=t.data.data.menu,console.log(this.plugin)}))}},mounted(){this.getPluginsMenu()}});var b=n(3066),w=n(3812),T=n(9570),k=n(3747),P=n(8240),f=n(1481),q=n(5926),y=n(2652),W=n(7518),v=n.n(W);const L=(0,c.Z)(p,[["render",o]]),Z=L;v()(p,"components",{QLayout:b.Z,QHeader:w.Z,QToolbar:T.Z,QToolbarTitle:k.Z,QBtn:P.Z,QBreadcrumbs:f.Z,QBreadcrumbsEl:q.Z,QPageContainer:y.Z})}}]);

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
"use strict";(globalThis["webpackChunksyseye"]=globalThis["webpackChunksyseye"]||[]).push([[763],{1763:(t,e,s)=>{s.r(e),s.d(e,{default:()=>Z});var a=s(3673),i=s(2323);const o={class:"q-gutter-md q-mb-sm q-pa-lg"},l={class:"row q-col-gutter-sm"},n={class:"text-h6"},r=(0,a.Uk)(" 由于python+sqlite数据库作为后端,理论上最高支持的主机数量为50. "),c={class:"text-subtitle2"},h={ref:"main_draw",style:{width:"100%",height:"600px"}};function m(t,e,s,m,u,d){const p=(0,a.up)("q-icon"),w=(0,a.up)("q-item-section"),g=(0,a.up)("q-item-label"),_=(0,a.up)("q-item"),b=(0,a.up)("q-card-section"),f=(0,a.up)("q-card"),y=(0,a.up)("q-banner"),v=(0,a.up)("q-popup-proxy");return(0,a.wg)(),(0,a.iD)("div",o,[(0,a._)("div",null,[(0,a.Wm)(f,{class:"bg-transparent no-shadow no-border"},{default:(0,a.w5)((()=>[(0,a.Wm)(b,{class:"q-pa-none"},{default:(0,a.w5)((()=>[(0,a._)("div",l,[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(t.Threatitems,((t,e)=>((0,a.wg)(),(0,a.iD)("div",{key:e,class:"col-md-3 col-sm-12 col-xs-12"},[(0,a.Wm)(_,{style:(0,i.j5)(`background-color: ${t.color1}`),class:"q-pa-none"},{default:(0,a.w5)((()=>[(0,a.Wm)(w,{side:"",style:(0,i.j5)(`background-color: ${t.color2}`),class:"q-pa-lg q-mr-none text-white"},{default:(0,a.w5)((()=>[(0,a.Wm)(p,{name:t.icon,color:"white",size:"24px"},null,8,["name"])])),_:2},1032,["style"]),(0,a.Wm)(w,{class:"q-pa-md q-ml-none text-white"},{default:(0,a.w5)((()=>[(0,a.Wm)(g,{class:"text-white text-h6 text-weight-bolder"},{default:(0,a.w5)((()=>[(0,a.Uk)((0,i.zw)(t.value),1)])),_:2},1024),(0,a.Wm)(g,null,{default:(0,a.w5)((()=>[(0,a.Uk)((0,i.zw)(t.title),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["style"])])))),128))])])),_:1})])),_:1})]),(0,a.Wm)(f,{class:"no-shadow",style:{background:"rbg(255,255,255)"}},{default:(0,a.w5)((()=>[(0,a.Wm)(b,null,{default:(0,a.w5)((()=>[(0,a._)("div",n,[(0,a.Uk)(" 主机数量: "+(0,i.zw)(t.threatStatistics.host_num)+"/50 ",1),(0,a.Wm)(p,{name:"info",class:"text-brown cursor-pointer"},{default:(0,a.w5)((()=>[(0,a.Wm)(v,{"transition-show":"flip-up","transition-hide":"flip-down"},{default:(0,a.w5)((()=>[(0,a.Wm)(y,{class:"bg-brown text-white"},{avatar:(0,a.w5)((()=>[(0,a.Wm)(p,{name:"lightbulb"})])),default:(0,a.w5)((()=>[r])),_:1})])),_:1})])),_:1})]),(0,a._)("div",c,"最近日志数量: "+(0,i.zw)(t.threatStatistics.all_log_num),1)])),_:1}),(0,a.Wm)(b,{class:"q-pt-none"},{default:(0,a.w5)((()=>[(0,a._)("div",h," 1 ",512)])),_:1})])),_:1})])}var u=s(52),d=s.n(u),p=s(2256);const w=(0,a.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:{get_threatStatistics(){d().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 o in this.threatStatistics.host_list)t.push(o),e.push({itemStyle:{color:"#005F73"},name:o,type:"line",stack:"Total",areaStyle:{},emphasis:{focus:"series"},data:this.threatStatistics.host_list[o].log_num});const s=this.$refs.main_draw,a=p.S1(s),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};a.setOption(i),setTimeout((()=>{a.resize()}),1e3)}},mounted(){this.get_threatStatistics(),setInterval((()=>{this.get_threatStatistics()}),1e4)}});var g=s(4260),_=s(151),b=s(5589),f=s(3414),y=s(2035),v=s(4554),x=s(2350),S=s(3944),q=s(5607),k=s(7518),W=s.n(k);const T=(0,g.Z)(w,[["render",m]]),Z=T;W()(w,"components",{QCard:_.Z,QCardSection:b.Z,QItem:f.Z,QItemSection:y.Z,QIcon:v.Z,QItemLabel:x.Z,QPopupProxy:S.Z,QBanner:q.Z})}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -5349,6 +5349,11 @@
}
}
},
"js-base64": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.2.tgz",
"integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",

View File

@@ -14,6 +14,7 @@
"axios": "^0.27.2",
"core-js": "^3.6.5",
"echarts": "^5.3.3",
"js-base64": "^3.7.2",
"quasar": "^2.0.0",
"vue": "^3.0.0",
"vue-router": "^4.0.0"

View File

@@ -0,0 +1,117 @@
/* eslint-disable camelcase */
/* eslint-disable eqeqeq */
/* eslint-disable no-useless-escape */
// 1.加密解密方法使用:
// 1.加密
// var str = '124中文内容';
// var base = new Base64();
// var result = base.encode(str);
// //document.write(result);
// //2.解密
// var result2 = base.decode(result);
// document.write(result2);
// //2.加密、解密算法封装:
function Base64 () {
// private property
const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
// public method for encoding
this.encode = function (input) {
let output = ''
let chr1, chr2, chr3, enc1, enc2, enc3, enc4
let i = 0
input = _utf8_encode(input)
while (i < input.length) {
chr1 = input.charCodeAt(i++)
chr2 = input.charCodeAt(i++)
chr3 = input.charCodeAt(i++)
enc1 = chr1 >> 2
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)
enc4 = chr3 & 63
if (isNaN(chr2)) {
enc3 = enc4 = 64
} else if (isNaN(chr3)) {
enc4 = 64
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4)
}
return output
}
// public method for decoding
this.decode = function (input) {
let output = ''
let chr1, chr2, chr3
let enc1, enc2, enc3, enc4
let i = 0
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '')
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++))
enc2 = _keyStr.indexOf(input.charAt(i++))
enc3 = _keyStr.indexOf(input.charAt(i++))
enc4 = _keyStr.indexOf(input.charAt(i++))
chr1 = (enc1 << 2) | (enc2 >> 4)
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)
chr3 = ((enc3 & 3) << 6) | enc4
output = output + String.fromCharCode(chr1)
if (enc3 != 64) {
output = output + String.fromCharCode(chr2)
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3)
}
}
output = _utf8_decode(output)
return output
}
// private method for UTF-8 encoding
var _utf8_encode = function (string) {
string = string.replace(/\r\n/g, '\n')
let utftext = ''
for (let n = 0; n < string.length; n++) {
const c = string.charCodeAt(n)
if (c < 128) {
utftext += String.fromCharCode(c)
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192)
utftext += String.fromCharCode((c & 63) | 128)
} else {
utftext += String.fromCharCode((c >> 12) | 224)
utftext += String.fromCharCode(((c >> 6) & 63) | 128)
utftext += String.fromCharCode((c & 63) | 128)
}
}
return utftext
}
// private method for UTF-8 decoding
var _utf8_decode = function (utftext) {
let string = ''
let i = 0
let c = 0, c1 = 0, c2 = 0
while (i < utftext.length) {
c = utftext.charCodeAt(i)
if (c < 128) {
string += String.fromCharCode(c)
i++
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1)
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63))
i += 2
} else {
c2 = utftext.charCodeAt(i + 1)
c1 = utftext.charCodeAt(i + 2)
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c1 & 63))
i += 3
}
}
return string
}
}
export default Base64

View File

@@ -1,22 +1,17 @@
<template>
<q-layout view="lHh Lpr lFf" style="background-color: rgb(239, 243, 246)">
<q-layout view="lHh Lpr lFf" :style="`background-color: ${colors.background}`">
<q-header elevated height-hint="98">
<q-toolbar class="text-white" style="background-color: rgb(210,61,42)">
<q-toolbar class="text-white" :style="`background-color: ${colors.toolbar}`">
<q-toolbar-title> RmEye测试版v1.0.1.3 </q-toolbar-title>
<q-btn flat round dense icon="lightbulb">
<q-popup-proxy>
<q-banner>
<div class="q-pa-md row items-start q-gutter-md">
<q-color v-model="color1" @change="updateCookie" class="my-picker" />
<q-color v-model="color2" @change="updateCookie" class="my-picker" />
<q-color v-model="color3" @change="updateCookie" class="my-picker" />
<q-color v-model="color4" @change="updateCookie" class="my-picker" />
</div>
</q-banner>
</q-popup-proxy>
<q-btn flat dense icon="restore" label="重置颜色" @click="cleanUpCookie">
</q-btn>
<q-popup-proxy>
<q-banner>
<q-color v-model="colors.toolbar" @change="updateCookie(colors.toolbar)" class="my-picker" />
</q-banner>
</q-popup-proxy>
</q-toolbar>
<q-toolbar style="font-size: 16px;background-color:rgb(47,43,48);">
<q-toolbar :style="`font-size: 16px;background-color: ${colors.layout}`">
<q-breadcrumbs active-color="white">
<q-breadcrumbs-el label="仪表盘" icon="dashboard" to="/page/dashboard" />
<q-breadcrumbs-el label="未处理威胁列表" icon="report" to="#" @click="routerToThreatList(0);" />
@@ -24,6 +19,12 @@
<q-breadcrumbs-el label="已忽略威胁列表" icon="texture" to="#" @click="routerToThreatList(2);" />
<q-breadcrumbs-el label="白名单列表" icon="list" to="#" @click="routerToWhiteList();" />
</q-breadcrumbs>
<q-popup-proxy>
<q-banner>
<q-color v-model="colors.layout" @change="updateCookie(colors.layout)" class="my-picker" />
</q-banner>
</q-popup-proxy>
</q-toolbar>
</q-header>
<template v-if="isInPlugin == false">
@@ -40,12 +41,16 @@
</template>
<script>
import Base64 from '../assets/b64.js'
import {
defineComponent
} from 'vue'
import HtmlPanel from '../components/Html.vue' // 根据实际路径导入
import axios from 'axios'
import { Cookies } from 'quasar'
import {
Cookies
} from 'quasar'
export default defineComponent({
components: {
HtmlPanel
@@ -61,12 +66,25 @@ export default defineComponent({
miniState: true,
plugin: [],
isInPlugin: false,
PluginUrl: ''
PluginUrl: '',
colors: {
layout: 'rgb(47,43,48)',
toolbar: 'rgb(210,61,42)',
background: 'rgb(239, 243, 246)'
}
}
},
methods: {
updateCookie (value) {
Cookies.set('color', { color: [this.color1, this.color2, this.color3, this.color4] })
updateCookie (selectItem) {
const b64Obj = new Base64()
Cookies.set('custom_banner', b64Obj.encode(JSON.stringify(this.colors)))
},
cleanUpCookie () {
Cookies.remove('custom_threat_item')
Cookies.remove('custom_banner')
// refesh
window.location.reload()
},
routerToWhiteList () {
this.isInPlugin = false
@@ -100,6 +118,11 @@ export default defineComponent({
},
mounted () {
this.getPluginsMenu()
const coockieCustomBanner = Cookies.get('custom_banner')
if (coockieCustomBanner) {
const b64Obj = new Base64()
this.colors = JSON.parse(b64Obj.decode(coockieCustomBanner))
}
}
})
</script>

View File

@@ -14,7 +14,17 @@
item.value
}}</q-item-label>
<q-item-label>{{ item.title }}</q-item-label>
<q-popup-proxy>
<q-banner>
<q-color v-model="item.color1" @change="updateCookie(Threatitems[index].color1)" class="my-picker" />
</q-banner>
</q-popup-proxy>
</q-item-section>
<q-popup-proxy>
<q-banner>
<q-color v-model="item.color2" @change="updateCookie(Threatitems[index].color2)" class="my-picker" />
</q-banner>
</q-popup-proxy>
</q-item>
</div>
</div>
@@ -50,11 +60,15 @@
</template>
<script>
import Base64 from '../assets/b64.js'
import {
defineComponent
} from 'vue'
import axios from 'axios'
import { Cookies } from 'quasar'
import {
Cookies
} from 'quasar'
import * as echarts from 'echarts'
export default defineComponent({
name: 'Dashboard',
@@ -101,6 +115,10 @@ export default defineComponent({
}
},
methods: {
updateCookie (selectItem) {
const b64Obj = new Base64()
Cookies.set('custom_threat_item', b64Obj.encode(JSON.stringify(this.Threatitems)))
},
get_threatStatistics () {
axios
.get('/api/v1/get/threat_statistics', {
@@ -191,13 +209,11 @@ export default defineComponent({
setInterval(() => {
this.get_threatStatistics()
}, 10000)
const colors = Cookies.get('color')
if (colors.color) {
this.Threatitems.map((item, index) => {
item.color1 = colors.color[index]
item.color2 = colors.color[index]
return item
})
const cookieCustomThreatItem = Cookies.get('custom_threat_item')
if (cookieCustomThreatItem) {
const b64Obj = new Base64()
this.Threatitems = JSON.parse(b64Obj.decode(cookieCustomThreatItem))
}
}
})