diff --git a/README.md b/README.md index 180a46f..dbe7392 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ This project draws on the code of the following outstanding projects: * [https://github.com/rmb122/rogue_mysql_server](https://github.com/rmb122/rogue_mysql_server) * [https://github.com/256dpi/newdns](https://github.com/256dpi/newdns) +* [https://github.com/EmYiQing/JNDIScan](https://github.com/EmYiQing/JNDIScan) ### Specifically diff --git a/README.zh-CN.md b/README.zh-CN.md index 30038e1..ffed29c 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -211,6 +211,7 @@ payload,最后被扫描器发出的请求是:`['https://www.testvuln.com?url * [https://github.com/rmb122/rogue_mysql_server](https://github.com/rmb122/rogue_mysql_server) * [https://github.com/256dpi/newdns](https://github.com/256dpi/newdns) +* [https://github.com/EmYiQing/JNDIScan](https://github.com/EmYiQing/JNDIScan) ### 特别感谢 diff --git a/frontend/dist/css/app.css b/frontend/dist/css/app.css index 05da30c..e9bd209 100644 --- a/frontend/dist/css/app.css +++ b/frontend/dist/css/app.css @@ -1 +1 @@ -.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-3b44ba10],html[data-v-3b44ba10]{height:100%;margin:0}.fade-transform-enter-active[data-v-3b44ba10],.fade-transform-leave-active[data-v-3b44ba10]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-3b44ba10],.fade-transform-leave[data-v-3b44ba10]{opacity:0}.fade-transform-enter-to[data-v-3b44ba10]{opacity:0}.ant-menu-item>span>a[data-v-3b44ba10]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-3b44ba10]{color:#fff}#app[data-v-3b44ba10]{min-height:100%}#app .trigger[data-v-3b44ba10]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#app .trigger[data-v-3b44ba10]:hover{color:#1890ff}#app .logo[data-v-3b44ba10]{height:32px;background:#0a1d2d;margin:16px;text-align:center;font-size:1.2rem;color:#fff;padding-bottom:5px;border-bottom:2px solid #b6befa}.copyright[data-v-3b44ba10]{color:#888;text-align:right;margin-right:1rem} \ No newline at end of file +.custom-icons-list[data-v-05a908c2] .anticon{margin-right:6px}body[data-v-bc5a7470],html[data-v-bc5a7470]{height:100%;margin:0}.fade-transform-enter-active[data-v-bc5a7470],.fade-transform-leave-active[data-v-bc5a7470]{transition:all .3s;opacity:0}.fade-transform-enter[data-v-bc5a7470],.fade-transform-leave[data-v-bc5a7470]{opacity:0}.fade-transform-enter-to[data-v-bc5a7470]{opacity:0}.ant-menu-item>span>a[data-v-bc5a7470]{color:hsla(0,0%,100%,.65)}.ant-menu-item-selected>span>a[data-v-bc5a7470]{color:#fff}#app[data-v-bc5a7470]{min-height:100%}#app .trigger[data-v-bc5a7470]{font-size:18px;line-height:64px;padding:0 24px;cursor:pointer;transition:color .3s}#app .trigger[data-v-bc5a7470]:hover{color:#1890ff}#app .logo[data-v-bc5a7470]{height:32px;background:#0a1d2d;margin:16px;text-align:center;font-size:1.2rem;color:#fff;padding-bottom:5px;border-bottom:2px solid #b6befa}.copyright[data-v-bc5a7470]{color:#888;text-align:right;margin-right:1rem} \ No newline at end of file diff --git a/frontend/dist/css/chunk-33aba89a.css b/frontend/dist/css/chunk-33aba89a.css new file mode 100644 index 0000000..de0f952 --- /dev/null +++ b/frontend/dist/css/chunk-33aba89a.css @@ -0,0 +1 @@ +.gray-table-row{background-color:#f5f5f5} \ No newline at end of file diff --git a/frontend/dist/css/chunk-6101772c.css b/frontend/dist/css/chunk-6101772c.css new file mode 100644 index 0000000..0d9147c --- /dev/null +++ b/frontend/dist/css/chunk-6101772c.css @@ -0,0 +1 @@ +#add-rule[data-v-0fa98c43]{margin-bottom:10px} \ No newline at end of file diff --git a/frontend/dist/index.html b/frontend/dist/index.html index aace0a2..13ada09 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -1 +1 @@ -RevSuit Control Panel
\ No newline at end of file +RevSuit Control Panel
\ No newline at end of file diff --git a/frontend/dist/js/app.js b/frontend/dist/js/app.js index dca633d..79e67bc 100644 --- a/frontend/dist/js/app.js +++ b/frontend/dist/js/app.js @@ -1 +1 @@ -(function(e){function t(t){for(var s,a,i=t[0],c=t[1],l=t[2],u=0,f=[];u=200&&e<300}});t["a"]=o},4678:function(e,t,n){var s={"./af":"2bfb","./af.js":"2bfb","./ar":"8e73","./ar-dz":"a356","./ar-dz.js":"a356","./ar-kw":"423e","./ar-kw.js":"423e","./ar-ly":"1cfd","./ar-ly.js":"1cfd","./ar-ma":"0a84","./ar-ma.js":"0a84","./ar-sa":"8230","./ar-sa.js":"8230","./ar-tn":"6d83","./ar-tn.js":"6d83","./ar.js":"8e73","./az":"485c","./az.js":"485c","./be":"1fc1","./be.js":"1fc1","./bg":"84aa","./bg.js":"84aa","./bm":"a7fa","./bm.js":"a7fa","./bn":"9043","./bn-bd":"9686","./bn-bd.js":"9686","./bn.js":"9043","./bo":"d26a","./bo.js":"d26a","./br":"6887","./br.js":"6887","./bs":"2554","./bs.js":"2554","./ca":"d716","./ca.js":"d716","./cs":"3c0d","./cs.js":"3c0d","./cv":"03ec","./cv.js":"03ec","./cy":"9797","./cy.js":"9797","./da":"0f14","./da.js":"0f14","./de":"b469","./de-at":"b3eb","./de-at.js":"b3eb","./de-ch":"bb71","./de-ch.js":"bb71","./de.js":"b469","./dv":"598a","./dv.js":"598a","./el":"8d47","./el.js":"8d47","./en-au":"0e6b","./en-au.js":"0e6b","./en-ca":"3886","./en-ca.js":"3886","./en-gb":"39a6","./en-gb.js":"39a6","./en-ie":"e1d3","./en-ie.js":"e1d3","./en-il":"7333","./en-il.js":"7333","./en-in":"ec2e","./en-in.js":"ec2e","./en-nz":"6f50","./en-nz.js":"6f50","./en-sg":"b7e9","./en-sg.js":"b7e9","./eo":"65db","./eo.js":"65db","./es":"898b","./es-do":"0a3c","./es-do.js":"0a3c","./es-mx":"b5b7","./es-mx.js":"b5b7","./es-us":"55c9","./es-us.js":"55c9","./es.js":"898b","./et":"ec18","./et.js":"ec18","./eu":"0ff2","./eu.js":"0ff2","./fa":"8df4","./fa.js":"8df4","./fi":"81e9","./fi.js":"81e9","./fil":"d69a","./fil.js":"d69a","./fo":"0721","./fo.js":"0721","./fr":"9f26","./fr-ca":"d9f8","./fr-ca.js":"d9f8","./fr-ch":"0e49","./fr-ch.js":"0e49","./fr.js":"9f26","./fy":"7118","./fy.js":"7118","./ga":"5120","./ga.js":"5120","./gd":"f6b4","./gd.js":"f6b4","./gl":"8840","./gl.js":"8840","./gom-deva":"aaf2","./gom-deva.js":"aaf2","./gom-latn":"0caa","./gom-latn.js":"0caa","./gu":"e0c5","./gu.js":"e0c5","./he":"c7aa","./he.js":"c7aa","./hi":"dc4d","./hi.js":"dc4d","./hr":"4ba9","./hr.js":"4ba9","./hu":"5b14","./hu.js":"5b14","./hy-am":"d6b6","./hy-am.js":"d6b6","./id":"5038","./id.js":"5038","./is":"0558","./is.js":"0558","./it":"6e98","./it-ch":"6f12","./it-ch.js":"6f12","./it.js":"6e98","./ja":"079e","./ja.js":"079e","./jv":"b540","./jv.js":"b540","./ka":"201b","./ka.js":"201b","./kk":"6d79","./kk.js":"6d79","./km":"e81d","./km.js":"e81d","./kn":"3e92","./kn.js":"3e92","./ko":"22f8","./ko.js":"22f8","./ku":"2421","./ku.js":"2421","./ky":"9609","./ky.js":"9609","./lb":"440c","./lb.js":"440c","./lo":"b29d","./lo.js":"b29d","./lt":"26f9","./lt.js":"26f9","./lv":"b97c","./lv.js":"b97c","./me":"293c","./me.js":"293c","./mi":"688b","./mi.js":"688b","./mk":"6909","./mk.js":"6909","./ml":"02fb","./ml.js":"02fb","./mn":"958b","./mn.js":"958b","./mr":"39bd","./mr.js":"39bd","./ms":"ebe4","./ms-my":"6403","./ms-my.js":"6403","./ms.js":"ebe4","./mt":"1b45","./mt.js":"1b45","./my":"8689","./my.js":"8689","./nb":"6ce3","./nb.js":"6ce3","./ne":"3a39","./ne.js":"3a39","./nl":"facd","./nl-be":"db29","./nl-be.js":"db29","./nl.js":"facd","./nn":"b84c","./nn.js":"b84c","./oc-lnc":"167b","./oc-lnc.js":"167b","./pa-in":"f3ff","./pa-in.js":"f3ff","./pl":"8d57","./pl.js":"8d57","./pt":"f260","./pt-br":"d2d4","./pt-br.js":"d2d4","./pt.js":"f260","./ro":"972c","./ro.js":"972c","./ru":"957c","./ru.js":"957c","./sd":"6784","./sd.js":"6784","./se":"ffff","./se.js":"ffff","./si":"eda5","./si.js":"eda5","./sk":"7be6","./sk.js":"7be6","./sl":"8155","./sl.js":"8155","./sq":"c8f3","./sq.js":"c8f3","./sr":"cf1e","./sr-cyrl":"13e9","./sr-cyrl.js":"13e9","./sr.js":"cf1e","./ss":"52bd","./ss.js":"52bd","./sv":"5fbd","./sv.js":"5fbd","./sw":"74dc","./sw.js":"74dc","./ta":"3de5","./ta.js":"3de5","./te":"5cbb","./te.js":"5cbb","./tet":"576c","./tet.js":"576c","./tg":"3b1b","./tg.js":"3b1b","./th":"10e8","./th.js":"10e8","./tk":"5aff","./tk.js":"5aff","./tl-ph":"0f38","./tl-ph.js":"0f38","./tlh":"cf75","./tlh.js":"cf75","./tr":"0e81","./tr.js":"0e81","./tzl":"cf51","./tzl.js":"cf51","./tzm":"c109","./tzm-latn":"b53d","./tzm-latn.js":"b53d","./tzm.js":"c109","./ug-cn":"6117","./ug-cn.js":"6117","./uk":"ada2","./uk.js":"ada2","./ur":"5294","./ur.js":"5294","./uz":"2e8c","./uz-latn":"010e","./uz-latn.js":"010e","./uz.js":"2e8c","./vi":"2921","./vi.js":"2921","./x-pseudo":"fd7e","./x-pseudo.js":"fd7e","./yo":"7f33","./yo.js":"7f33","./zh-cn":"5c3a","./zh-cn.js":"5c3a","./zh-hk":"49ab","./zh-hk.js":"49ab","./zh-mo":"3a6c","./zh-mo.js":"3a6c","./zh-tw":"90ea","./zh-tw.js":"90ea"};function a(e){var t=r(e);return n(t)}function r(e){if(!n.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}a.keys=function(){return Object.keys(s)},a.resolve=r,e.exports=a,a.id="4678"},"56d7":function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return E}));n("e260"),n("e6cf"),n("cca6"),n("a79d");var s=n("a026"),a=n("f23d"),r=function(){var e=this,t=this,n=t.$createElement,s=t._self._c||n;return s("a-layout",{directives:[{name:"visibility-change",rawName:"v-visibility-change",value:function(){e.$refs.content.fetch&&e.$refs.content.fetch()},expression:"()=>{this.$refs.content.fetch?this.$refs.content.fetch():null}"}],attrs:{id:"app"}},[s("a-layout-sider",{attrs:{trigger:null,collapsible:""},model:{value:t.collapsed,callback:function(e){t.collapsed=e},expression:"collapsed"}},[s("div",{staticClass:"logo"},[s("b",[t._v("R")]),t.collapsed?t._e():s("span",[s("b",[t._v("ev")]),t._v("Suit")])]),s("a-menu",{attrs:{theme:"dark",mode:"inline",selectedKeys:[this.$route.path],openKeys:t.openKeys},on:{"update:openKeys":function(e){t.openKeys=e},"update:open-keys":function(e){t.openKeys=e}}},[s("a-sub-menu",{key:"logs"},[s("span",{attrs:{slot:"title"},slot:"title"},[s("a-icon",{attrs:{type:"bar-chart"}}),s("span",[t._v("Logs")])],1),s("a-menu-item",{key:"/logs/http"},[s("router-link",{attrs:{to:"/logs/http"}},[t._v("HTTP Logs")])],1),s("a-menu-item",{key:"/logs/dns"},[s("router-link",{attrs:{to:"/logs/dns"}},[t._v("DNS Logs")])],1),s("a-menu-item",{key:"/logs/rmi"},[s("router-link",{attrs:{to:"/logs/rmi"}},[t._v("RMI Logs")])],1),s("a-menu-item",{key:"/logs/mysql"},[s("router-link",{attrs:{to:"/logs/mysql"}},[t._v("MySQL Logs")])],1),s("a-menu-item",{key:"/logs/ftp"},[s("router-link",{attrs:{to:"/logs/ftp"}},[t._v("FTP Logs")])],1)],1),s("a-sub-menu",{key:"rules"},[s("span",{attrs:{slot:"title"},slot:"title"},[s("rule-icon"),s("span",[t._v("Rules")])],1),s("a-menu-item",{key:"/rules/http"},[s("router-link",{attrs:{to:"/rules/http"}},[t._v("HTTP Rules")])],1),s("a-menu-item",{key:"/rules/dns"},[s("router-link",{attrs:{to:"/rules/dns"}},[t._v("DNS Rules")])],1),s("a-menu-item",{key:"/rules/rmi"},[s("router-link",{attrs:{to:"/rules/rmi"}},[t._v("RMI Rules")])],1),s("a-menu-item",{key:"/rules/mysql"},[s("router-link",{attrs:{to:"/rules/mysql"}},[t._v("MySQL Rules")])],1),s("a-menu-item",{key:"/rules/ftp"},[s("router-link",{attrs:{to:"/rules/ftp"}},[t._v("FTP Rules")])],1)],1),s("a-menu-item",{key:"/settings"},[s("router-link",{attrs:{to:"/settings"}},[s("a-icon",{attrs:{type:"setting"}}),s("span",[t._v("Settings")])],1)],1)],1)],1),s("a-layout",[s("a-layout-header",{staticStyle:{background:"#fff",padding:"0"}},[s("a-icon",{staticClass:"trigger",attrs:{type:t.collapsed?"menu-unfold":"menu-fold"},on:{click:function(){return t.collapsed=!t.collapsed}}}),t.isLogMode?s("div",{staticStyle:{float:"right","min-width":"60%",padding:"12px 0","line-height":"24px"}},[s("a-row",{attrs:{gutter:24,type:"flex"}},[s("a-col",{attrs:{span:20}},[s("a-form-model",{directives:[{name:"show",rawName:"v-show",value:t.showSettings,expression:"showSettings"}],ref:"settings",attrs:{layout:"inline"}},[s("a-row",{attrs:{gutter:24,type:"flex"}},[s("a-col",{attrs:{span:9,offset:2}},[s("a-form-model-item",{attrs:{label:"Auto Refresh"}},[s("a-switch",{attrs:{id:"auto-refresh"},model:{value:t.autoRefresh,callback:function(e){t.autoRefresh=e},expression:"autoRefresh"}})],1)],1),s("a-col",{attrs:{span:13}},[s("a-form-model-item",{attrs:{label:"Refresh Interval"}},[s("a-input-number",{staticStyle:{"margin-right":"-3rem"},attrs:{id:"refresh-interval",disabled:!t.autoRefresh},model:{value:t.refreshInterval,callback:function(e){t.refreshInterval=e},expression:"refreshInterval"}})],1)],1)],1)],1)],1),s("a-col",{attrs:{span:4}},[s("a-popconfirm",{attrs:{title:t.showLogNum?"This will delete all logs in the current filtered state, a total of "+this.$refs.content.pagination.total+", are you sure?":"This will delete all logs in the current filtered state, a total of 0, are you sure?","ok-text":"Yes","cancel-text":"No"},on:{visibleChange:function(e){t.showLogNum?t.delayChangeShowLogNum():t.showLogNum=!t.showLogNum},confirm:t.deleteLogs}},[s("a-icon",{staticStyle:{color:"red"},attrs:{slot:"icon",type:"question-circle-o"},slot:"icon"}),s("a-icon",{style:"font-size: 18px;padding: 12px 0;",attrs:{type:"delete"},on:{click:function(){}}})],1),s("a-icon",{style:"font-size: 18px;padding:12px 15px;"+(t.showSettings?"color: #1b90ff;":""),attrs:{type:"setting"},on:{click:function(e){t.showSettings=!t.showSettings}}})],1)],1)],1):t._e()],1),s("a-layout-content",{style:{margin:"24px 16px",padding:"24px",borderRadius:"20px",background:"#fff",minHeight:"initial"}},[s("transition",{attrs:{name:"fade-transform"}},[s("router-view",{ref:"content"})],1)],1),s("div",{staticClass:"copyright"},[s("p",{},[t._v(" RevSuit Current Version: "+t._s(this.version)+" ©2021 "),s("a",{attrs:{href:"https://github.com/Li4n0"}},[t._v("Li4n0")]),t._v(". "),s("a",{attrs:{href:"https://github.com/Li4n0/revsuit"}},[t._v("GitHub")])])])],1),s("Auth")],1)},o=[],i=(n("caad"),n("2532"),n("1276"),n("ac1f"),n("d3b7"),n("25f0"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("a-modal",{attrs:{title:"Auth with token",visible:e.visible,"confirm-loading":e.confirmLoading},on:{cancel:e.cancel,ok:e.auth}},[n("a-input",{attrs:{placeholder:"Your token"},on:{pressEnter:e.auth},model:{value:e.token,callback:function(t){e.token=t},expression:"token"}})],1)],1)}),c=[],l=n("365c");function u(e){return Object(l["a"])({url:"/auth",method:"get",headers:{Token:e}})}function f(){return Object(l["a"])({url:"/version",method:"get"})}var h={data:function(){return{confirmLoading:!1,token:""}},computed:{visible:function(){return!E.authed}},methods:{auth:function(){var e=this;this.confirmLoading=!0,u(this.token).then((function(){E.authed=!0,e.confirmLoading=!1,e.token=""})).catch((function(t){403===t.response.status&&e.$notification.error({message:"Wrong token",description:"Your token is wrong, please check your server config file.",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5}),e.confirmLoading=!1}))},cancel:function(){E.authed=!0}}},d=h,m=n("2877"),p=Object(m["a"])(d,i,c,!1,null,null,null),g=p.exports,b=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("a-icon",{attrs:{component:e.RuleSvg}})},j=[],v={template:'\n \n'},y={name:"RuleIcon",data:function(){return{RuleSvg:v}}},k=y,w=(n("912e"),Object(m["a"])(k,b,j,!1,null,"05a908c2",null)),S=w.exports,z={data:function(){return{store:E,autoRefresh:"true"===localStorage.getItem("autoRefresh"),refreshInterval:localStorage.getItem("refreshInterval")?localStorage.getItem("refreshInterval"):5,pageSize:E.pageSize,collapsed:!1,showSettings:!1,showLogNum:!1,openKeys:[],version:""}},computed:{isLogMode:function(){return this.$route.path.includes("logs")}},methods:{timing:function(){var e=this;null!==this.timer&&clearInterval(this.timer),this.timer=setInterval((function(){e.$refs.content.fetch()}),1e3*this.refreshInterval)},GetVersion:function(){var e=this;f().then((function(t){e.version=t.data.result}))},deleteLogs:function(){this.$refs.content.delete()},delayChangeShowLogNum:function(){var e=this;setTimeout((function(){e.showLogNum=!e.showLogNum}),1e3)}},mounted:function(){null===localStorage.getItem("autoRefresh")&&(this.autoRefresh=!0),this.GetVersion()},created:function(){var e=this.$watch("$route",(function(t,n){"/"===n.path&&0===this.openKeys.length&&(this.openKeys.push(t.path.split("/")[1]),e())}))},destroyed:function(){clearInterval(this.timer)},watch:{autoRefresh:function(e){e?this.timing():clearInterval(this.timer),localStorage.setItem("autoRefresh",e)},isLogMode:function(e){!e&&this.timer?clearInterval(this.timer):this.autoRefresh&&this.timing()},refreshInterval:function(e){clearInterval(this.timer),this.timing(),localStorage.setItem("refreshInterval",e)},pageSize:function(e){(e<=0||e>100)&&(e=10),E.pageSize=e,localStorage.setItem("pageSize",e)},"store.authed":function(e){e&&(this.$refs.content.fetch(),this.GetVersion())},"store.pageSize":function(){this.$refs.content.pagination.pageSize=E.pageSize,localStorage.setItem("pageSize",E.pageSize.toString()),this.$refs.content.fetch()}},components:{RuleIcon:S,Auth:g}},x=z,L=(n("95d1"),Object(m["a"])(x,r,o,!1,null,"3b44ba10",null)),R=L.exports,_=(n("3ca3"),n("ddb0"),n("8c4f"));s["a"].use(_["a"]);var I=[{path:"/",name:"Home",redirect:"/logs/http"},{path:"/logs/http",name:"HttpLogs",component:function(){return n.e("chunk-193ec343").then(n.bind(null,"f889"))}},{path:"/logs/dns",name:"DnsLogs",component:function(){return n.e("chunk-5fb70d83").then(n.bind(null,"5ea0"))}},{path:"/logs/mysql",name:"MysqlLogs",component:function(){return n.e("chunk-46a53d26").then(n.bind(null,"2e9f"))}},{path:"/logs/rmi",name:"RmiLogs",component:function(){return n.e("chunk-740736c7").then(n.bind(null,"975e"))}},{path:"/logs/ftp",name:"FtpLogs",component:function(){return n.e("chunk-72839f90").then(n.bind(null,"c5bf"))}},{path:"/rules/http",name:"HttpRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-f1802c3c")]).then(n.bind(null,"9520c"))}},{path:"/rules/dns",name:"DnsRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-4ffb84ba")]).then(n.bind(null,"2e08"))}},{path:"/rules/mysql",name:"MysqlRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-0cb5e9e6")]).then(n.bind(null,"05cd"))}},{path:"/rules/rmi",name:"RmiRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-016c45cf")]).then(n.bind(null,"ac60"))}},{path:"/rules/ftp",name:"FtpRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-ae691e78")]).then(n.bind(null,"f832"))}},{path:"/settings",name:"Settings",component:function(){return n.e("chunk-b241c712").then(n.bind(null,"ee09"))}}],M=new _["a"]({routes:I}),$=M,N=(n("202f"),n("ed08"),n("9af4")),O=n.n(N);s["a"].config.productionTip=!1,s["a"].use(a["a"]),s["a"].use(O.a);var E=s["a"].observable({authed:!0,pageSize:localStorage.getItem("pageSize")?parseInt(localStorage.getItem("pageSize")):10});new s["a"]({router:$,render:function(e){return e(R)}}).$mount("#app")},"6cb6":function(e,t,n){},"912e":function(e,t,n){"use strict";n("e805")},"95d1":function(e,t,n){"use strict";n("6cb6")},e805:function(e,t,n){},ed08:function(e,t,n){n("5319"),n("ac1f"),n("4d63"),n("25f0"),Date.prototype.format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}}}); \ No newline at end of file +(function(e){function t(t){for(var s,a,i=t[0],c=t[1],l=t[2],u=0,f=[];u=200&&e<300}});t["a"]=o},4678:function(e,t,n){var s={"./af":"2bfb","./af.js":"2bfb","./ar":"8e73","./ar-dz":"a356","./ar-dz.js":"a356","./ar-kw":"423e","./ar-kw.js":"423e","./ar-ly":"1cfd","./ar-ly.js":"1cfd","./ar-ma":"0a84","./ar-ma.js":"0a84","./ar-sa":"8230","./ar-sa.js":"8230","./ar-tn":"6d83","./ar-tn.js":"6d83","./ar.js":"8e73","./az":"485c","./az.js":"485c","./be":"1fc1","./be.js":"1fc1","./bg":"84aa","./bg.js":"84aa","./bm":"a7fa","./bm.js":"a7fa","./bn":"9043","./bn-bd":"9686","./bn-bd.js":"9686","./bn.js":"9043","./bo":"d26a","./bo.js":"d26a","./br":"6887","./br.js":"6887","./bs":"2554","./bs.js":"2554","./ca":"d716","./ca.js":"d716","./cs":"3c0d","./cs.js":"3c0d","./cv":"03ec","./cv.js":"03ec","./cy":"9797","./cy.js":"9797","./da":"0f14","./da.js":"0f14","./de":"b469","./de-at":"b3eb","./de-at.js":"b3eb","./de-ch":"bb71","./de-ch.js":"bb71","./de.js":"b469","./dv":"598a","./dv.js":"598a","./el":"8d47","./el.js":"8d47","./en-au":"0e6b","./en-au.js":"0e6b","./en-ca":"3886","./en-ca.js":"3886","./en-gb":"39a6","./en-gb.js":"39a6","./en-ie":"e1d3","./en-ie.js":"e1d3","./en-il":"7333","./en-il.js":"7333","./en-in":"ec2e","./en-in.js":"ec2e","./en-nz":"6f50","./en-nz.js":"6f50","./en-sg":"b7e9","./en-sg.js":"b7e9","./eo":"65db","./eo.js":"65db","./es":"898b","./es-do":"0a3c","./es-do.js":"0a3c","./es-mx":"b5b7","./es-mx.js":"b5b7","./es-us":"55c9","./es-us.js":"55c9","./es.js":"898b","./et":"ec18","./et.js":"ec18","./eu":"0ff2","./eu.js":"0ff2","./fa":"8df4","./fa.js":"8df4","./fi":"81e9","./fi.js":"81e9","./fil":"d69a","./fil.js":"d69a","./fo":"0721","./fo.js":"0721","./fr":"9f26","./fr-ca":"d9f8","./fr-ca.js":"d9f8","./fr-ch":"0e49","./fr-ch.js":"0e49","./fr.js":"9f26","./fy":"7118","./fy.js":"7118","./ga":"5120","./ga.js":"5120","./gd":"f6b4","./gd.js":"f6b4","./gl":"8840","./gl.js":"8840","./gom-deva":"aaf2","./gom-deva.js":"aaf2","./gom-latn":"0caa","./gom-latn.js":"0caa","./gu":"e0c5","./gu.js":"e0c5","./he":"c7aa","./he.js":"c7aa","./hi":"dc4d","./hi.js":"dc4d","./hr":"4ba9","./hr.js":"4ba9","./hu":"5b14","./hu.js":"5b14","./hy-am":"d6b6","./hy-am.js":"d6b6","./id":"5038","./id.js":"5038","./is":"0558","./is.js":"0558","./it":"6e98","./it-ch":"6f12","./it-ch.js":"6f12","./it.js":"6e98","./ja":"079e","./ja.js":"079e","./jv":"b540","./jv.js":"b540","./ka":"201b","./ka.js":"201b","./kk":"6d79","./kk.js":"6d79","./km":"e81d","./km.js":"e81d","./kn":"3e92","./kn.js":"3e92","./ko":"22f8","./ko.js":"22f8","./ku":"2421","./ku.js":"2421","./ky":"9609","./ky.js":"9609","./lb":"440c","./lb.js":"440c","./lo":"b29d","./lo.js":"b29d","./lt":"26f9","./lt.js":"26f9","./lv":"b97c","./lv.js":"b97c","./me":"293c","./me.js":"293c","./mi":"688b","./mi.js":"688b","./mk":"6909","./mk.js":"6909","./ml":"02fb","./ml.js":"02fb","./mn":"958b","./mn.js":"958b","./mr":"39bd","./mr.js":"39bd","./ms":"ebe4","./ms-my":"6403","./ms-my.js":"6403","./ms.js":"ebe4","./mt":"1b45","./mt.js":"1b45","./my":"8689","./my.js":"8689","./nb":"6ce3","./nb.js":"6ce3","./ne":"3a39","./ne.js":"3a39","./nl":"facd","./nl-be":"db29","./nl-be.js":"db29","./nl.js":"facd","./nn":"b84c","./nn.js":"b84c","./oc-lnc":"167b","./oc-lnc.js":"167b","./pa-in":"f3ff","./pa-in.js":"f3ff","./pl":"8d57","./pl.js":"8d57","./pt":"f260","./pt-br":"d2d4","./pt-br.js":"d2d4","./pt.js":"f260","./ro":"972c","./ro.js":"972c","./ru":"957c","./ru.js":"957c","./sd":"6784","./sd.js":"6784","./se":"ffff","./se.js":"ffff","./si":"eda5","./si.js":"eda5","./sk":"7be6","./sk.js":"7be6","./sl":"8155","./sl.js":"8155","./sq":"c8f3","./sq.js":"c8f3","./sr":"cf1e","./sr-cyrl":"13e9","./sr-cyrl.js":"13e9","./sr.js":"cf1e","./ss":"52bd","./ss.js":"52bd","./sv":"5fbd","./sv.js":"5fbd","./sw":"74dc","./sw.js":"74dc","./ta":"3de5","./ta.js":"3de5","./te":"5cbb","./te.js":"5cbb","./tet":"576c","./tet.js":"576c","./tg":"3b1b","./tg.js":"3b1b","./th":"10e8","./th.js":"10e8","./tk":"5aff","./tk.js":"5aff","./tl-ph":"0f38","./tl-ph.js":"0f38","./tlh":"cf75","./tlh.js":"cf75","./tr":"0e81","./tr.js":"0e81","./tzl":"cf51","./tzl.js":"cf51","./tzm":"c109","./tzm-latn":"b53d","./tzm-latn.js":"b53d","./tzm.js":"c109","./ug-cn":"6117","./ug-cn.js":"6117","./uk":"ada2","./uk.js":"ada2","./ur":"5294","./ur.js":"5294","./uz":"2e8c","./uz-latn":"010e","./uz-latn.js":"010e","./uz.js":"2e8c","./vi":"2921","./vi.js":"2921","./x-pseudo":"fd7e","./x-pseudo.js":"fd7e","./yo":"7f33","./yo.js":"7f33","./zh-cn":"5c3a","./zh-cn.js":"5c3a","./zh-hk":"49ab","./zh-hk.js":"49ab","./zh-mo":"3a6c","./zh-mo.js":"3a6c","./zh-tw":"90ea","./zh-tw.js":"90ea"};function a(e){var t=r(e);return n(t)}function r(e){if(!n.o(s,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return s[e]}a.keys=function(){return Object.keys(s)},a.resolve=r,e.exports=a,a.id="4678"},"56d7":function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return E}));n("e260"),n("e6cf"),n("cca6"),n("a79d");var s=n("a026"),a=n("f23d"),r=function(){var e=this,t=this,n=t.$createElement,s=t._self._c||n;return s("a-layout",{directives:[{name:"visibility-change",rawName:"v-visibility-change",value:function(){e.$refs.content.fetch&&e.$refs.content.fetch()},expression:"()=>{this.$refs.content.fetch?this.$refs.content.fetch():null}"}],attrs:{id:"app"}},[s("a-layout-sider",{attrs:{trigger:null,collapsible:""},model:{value:t.collapsed,callback:function(e){t.collapsed=e},expression:"collapsed"}},[s("div",{staticClass:"logo"},[s("b",[t._v("R")]),t.collapsed?t._e():s("span",[s("b",[t._v("ev")]),t._v("Suit")])]),s("a-menu",{attrs:{theme:"dark",mode:"inline",selectedKeys:[this.$route.path],openKeys:t.openKeys},on:{"update:openKeys":function(e){t.openKeys=e},"update:open-keys":function(e){t.openKeys=e}}},[s("a-sub-menu",{key:"logs"},[s("span",{attrs:{slot:"title"},slot:"title"},[s("a-icon",{attrs:{type:"bar-chart"}}),s("span",[t._v("Logs")])],1),s("a-menu-item",{key:"/logs/http"},[s("router-link",{attrs:{to:"/logs/http"}},[t._v("HTTP Logs")])],1),s("a-menu-item",{key:"/logs/dns"},[s("router-link",{attrs:{to:"/logs/dns"}},[t._v("DNS Logs")])],1),s("a-menu-item",{key:"/logs/rmi"},[s("router-link",{attrs:{to:"/logs/rmi"}},[t._v("RMI Logs")])],1),s("a-menu-item",{key:"/logs/ldap"},[s("router-link",{attrs:{to:"/logs/ldap"}},[t._v("Ldap Logs")])],1),s("a-menu-item",{key:"/logs/mysql"},[s("router-link",{attrs:{to:"/logs/mysql"}},[t._v("MySQL Logs")])],1),s("a-menu-item",{key:"/logs/ftp"},[s("router-link",{attrs:{to:"/logs/ftp"}},[t._v("FTP Logs")])],1)],1),s("a-sub-menu",{key:"rules"},[s("span",{attrs:{slot:"title"},slot:"title"},[s("rule-icon"),s("span",[t._v("Rules")])],1),s("a-menu-item",{key:"/rules/http"},[s("router-link",{attrs:{to:"/rules/http"}},[t._v("HTTP Rules")])],1),s("a-menu-item",{key:"/rules/dns"},[s("router-link",{attrs:{to:"/rules/dns"}},[t._v("DNS Rules")])],1),s("a-menu-item",{key:"/rules/rmi"},[s("router-link",{attrs:{to:"/rules/rmi"}},[t._v("RMI Rules")])],1),s("a-menu-item",{key:"/rules/ldap"},[s("router-link",{attrs:{to:"/rules/ldap"}},[t._v("Ldap Rules")])],1),s("a-menu-item",{key:"/rules/mysql"},[s("router-link",{attrs:{to:"/rules/mysql"}},[t._v("MySQL Rules")])],1),s("a-menu-item",{key:"/rules/ftp"},[s("router-link",{attrs:{to:"/rules/ftp"}},[t._v("FTP Rules")])],1)],1),s("a-menu-item",{key:"/settings"},[s("router-link",{attrs:{to:"/settings"}},[s("a-icon",{attrs:{type:"setting"}}),s("span",[t._v("Settings")])],1)],1)],1)],1),s("a-layout",[s("a-layout-header",{staticStyle:{background:"#fff",padding:"0"}},[s("a-icon",{staticClass:"trigger",attrs:{type:t.collapsed?"menu-unfold":"menu-fold"},on:{click:function(){return t.collapsed=!t.collapsed}}}),t.isLogMode?s("div",{staticStyle:{float:"right","min-width":"60%",padding:"12px 0","line-height":"24px"}},[s("a-row",{attrs:{gutter:24,type:"flex"}},[s("a-col",{attrs:{span:20}},[s("a-form-model",{directives:[{name:"show",rawName:"v-show",value:t.showSettings,expression:"showSettings"}],ref:"settings",attrs:{layout:"inline"}},[s("a-row",{attrs:{gutter:24,type:"flex"}},[s("a-col",{attrs:{span:9,offset:2}},[s("a-form-model-item",{attrs:{label:"Auto Refresh"}},[s("a-switch",{attrs:{id:"auto-refresh"},model:{value:t.autoRefresh,callback:function(e){t.autoRefresh=e},expression:"autoRefresh"}})],1)],1),s("a-col",{attrs:{span:13}},[s("a-form-model-item",{attrs:{label:"Refresh Interval"}},[s("a-input-number",{staticStyle:{"margin-right":"-3rem"},attrs:{id:"refresh-interval",disabled:!t.autoRefresh},model:{value:t.refreshInterval,callback:function(e){t.refreshInterval=e},expression:"refreshInterval"}})],1)],1)],1)],1)],1),s("a-col",{attrs:{span:4}},[s("a-popconfirm",{attrs:{title:t.showLogNum?"This will delete all logs in the current filtered state, a total of "+this.$refs.content.pagination.total+", are you sure?":"This will delete all logs in the current filtered state, a total of 0, are you sure?","ok-text":"Yes","cancel-text":"No"},on:{visibleChange:function(e){t.showLogNum?t.delayChangeShowLogNum():t.showLogNum=!t.showLogNum},confirm:t.deleteLogs}},[s("a-icon",{staticStyle:{color:"red"},attrs:{slot:"icon",type:"question-circle-o"},slot:"icon"}),s("a-icon",{style:"font-size: 18px;padding: 12px 0;",attrs:{type:"delete"},on:{click:function(){}}})],1),s("a-icon",{style:"font-size: 18px;padding:12px 15px;"+(t.showSettings?"color: #1b90ff;":""),attrs:{type:"setting"},on:{click:function(e){t.showSettings=!t.showSettings}}})],1)],1)],1):t._e()],1),s("a-layout-content",{style:{margin:"24px 16px",padding:"24px",borderRadius:"20px",background:"#fff",minHeight:"initial"}},[s("transition",{attrs:{name:"fade-transform"}},[s("router-view",{ref:"content"})],1)],1),s("div",{staticClass:"copyright"},[s("p",{},[t._v(" RevSuit Current Version: "+t._s(this.version)+" ©2021 "),s("a",{attrs:{href:"https://github.com/Li4n0"}},[t._v("Li4n0")]),t._v(". "),s("a",{attrs:{href:"https://github.com/Li4n0/revsuit"}},[t._v("GitHub")])])])],1),s("Auth")],1)},o=[],i=(n("caad"),n("2532"),n("1276"),n("ac1f"),n("d3b7"),n("25f0"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("a-modal",{attrs:{title:"Auth with token",visible:e.visible,"confirm-loading":e.confirmLoading},on:{cancel:e.cancel,ok:e.auth}},[n("a-input",{attrs:{placeholder:"Your token"},on:{pressEnter:e.auth},model:{value:e.token,callback:function(t){e.token=t},expression:"token"}})],1)],1)}),c=[],l=n("365c");function u(e){return Object(l["a"])({url:"/auth",method:"get",headers:{Token:e}})}function f(){return Object(l["a"])({url:"/version",method:"get"})}var h={data:function(){return{confirmLoading:!1,token:""}},computed:{visible:function(){return!E.authed}},methods:{auth:function(){var e=this;this.confirmLoading=!0,u(this.token).then((function(){E.authed=!0,e.confirmLoading=!1,e.token=""})).catch((function(t){403===t.response.status&&e.$notification.error({message:"Wrong token",description:"Your token is wrong, please check your server config file.",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5}),e.confirmLoading=!1}))},cancel:function(){E.authed=!0}}},d=h,p=n("2877"),m=Object(p["a"])(d,i,c,!1,null,null,null),g=m.exports,b=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("a-icon",{attrs:{component:e.RuleSvg}})},j=[],v={template:'\n \n'},k={name:"RuleIcon",data:function(){return{RuleSvg:v}}},y=k,w=(n("912e"),Object(p["a"])(y,b,j,!1,null,"05a908c2",null)),S=w.exports,L={data:function(){return{store:E,autoRefresh:"true"===localStorage.getItem("autoRefresh"),refreshInterval:localStorage.getItem("refreshInterval")?localStorage.getItem("refreshInterval"):5,pageSize:E.pageSize,collapsed:!1,showSettings:!1,showLogNum:!1,openKeys:[],version:""}},computed:{isLogMode:function(){return this.$route.path.includes("logs")}},methods:{timing:function(){var e=this;null!==this.timer&&clearInterval(this.timer),this.timer=setInterval((function(){e.$refs.content.fetch()}),1e3*this.refreshInterval)},GetVersion:function(){var e=this;f().then((function(t){e.version=t.data.result}))},deleteLogs:function(){this.$refs.content.delete()},delayChangeShowLogNum:function(){var e=this;setTimeout((function(){e.showLogNum=!e.showLogNum}),1e3)}},mounted:function(){null===localStorage.getItem("autoRefresh")&&(this.autoRefresh=!0),this.GetVersion()},created:function(){var e=this.$watch("$route",(function(t,n){"/"===n.path&&0===this.openKeys.length&&(this.openKeys.push(t.path.split("/")[1]),e())}))},destroyed:function(){clearInterval(this.timer)},watch:{autoRefresh:function(e){e?this.timing():clearInterval(this.timer),localStorage.setItem("autoRefresh",e)},isLogMode:function(e){!e&&this.timer?clearInterval(this.timer):this.autoRefresh&&this.timing()},refreshInterval:function(e){clearInterval(this.timer),this.timing(),localStorage.setItem("refreshInterval",e)},pageSize:function(e){(e<=0||e>100)&&(e=10),E.pageSize=e,localStorage.setItem("pageSize",e)},"store.authed":function(e){e&&(this.$refs.content.fetch(),this.GetVersion())},"store.pageSize":function(){this.$refs.content.pagination.pageSize=E.pageSize,localStorage.setItem("pageSize",E.pageSize.toString()),this.$refs.content.fetch()}},components:{RuleIcon:S,Auth:g}},z=L,x=(n("5874"),Object(p["a"])(z,r,o,!1,null,"bc5a7470",null)),R=x.exports,_=(n("3ca3"),n("ddb0"),n("8c4f"));s["a"].use(_["a"]);var I=[{path:"/",name:"Home",redirect:"/logs/http"},{path:"/logs/http",name:"HttpLogs",component:function(){return n.e("chunk-193ec343").then(n.bind(null,"f889"))}},{path:"/logs/dns",name:"DnsLogs",component:function(){return n.e("chunk-5fb70d83").then(n.bind(null,"5ea0"))}},{path:"/logs/mysql",name:"MysqlLogs",component:function(){return n.e("chunk-46a53d26").then(n.bind(null,"2e9f"))}},{path:"/logs/rmi",name:"RmiLogs",component:function(){return n.e("chunk-740736c7").then(n.bind(null,"975e"))}},{path:"/logs/ldap",name:"LdapLogs",component:function(){return n.e("chunk-33aba89a").then(n.bind(null,"6dc1"))}},{path:"/logs/ftp",name:"FtpLogs",component:function(){return n.e("chunk-72839f90").then(n.bind(null,"c5bf"))}},{path:"/rules/http",name:"HttpRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-f1802c3c")]).then(n.bind(null,"9520c"))}},{path:"/rules/dns",name:"DnsRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-4ffb84ba")]).then(n.bind(null,"2e08"))}},{path:"/rules/mysql",name:"MysqlRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-0cb5e9e6")]).then(n.bind(null,"05cd"))}},{path:"/rules/rmi",name:"RmiRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-016c45cf")]).then(n.bind(null,"ac60"))}},{path:"/rules/ldap",name:"LdapRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-6101772c")]).then(n.bind(null,"6ce6"))}},{path:"/rules/ftp",name:"FtpRules",component:function(){return Promise.all([n.e("chunk-27186dd0"),n.e("chunk-ae691e78")]).then(n.bind(null,"f832"))}},{path:"/settings",name:"Settings",component:function(){return n.e("chunk-b241c712").then(n.bind(null,"ee09"))}}],M=new _["a"]({routes:I}),$=M,N=(n("202f"),n("ed08"),n("9af4")),O=n.n(N);s["a"].config.productionTip=!1,s["a"].use(a["a"]),s["a"].use(O.a);var E=s["a"].observable({authed:!0,pageSize:localStorage.getItem("pageSize")?parseInt(localStorage.getItem("pageSize")):10});new s["a"]({router:$,render:function(e){return e(R)}}).$mount("#app")},5874:function(e,t,n){"use strict";n("df1e")},"912e":function(e,t,n){"use strict";n("e805")},df1e:function(e,t,n){},e805:function(e,t,n){},ed08:function(e,t,n){n("5319"),n("ac1f"),n("4d63"),n("25f0"),Date.prototype.format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var n in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[n]:("00"+t[n]).substr((""+t[n]).length)));return e}}}); \ No newline at end of file diff --git a/frontend/dist/js/chunk-016c45cf.js b/frontend/dist/js/chunk-016c45cf.js index a69e82d..d9d7bcc 100644 --- a/frontend/dist/js/chunk-016c45cf.js +++ b/frontend/dist/js/chunk-016c45cf.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-016c45cf"],{"28be":function(t,e,n){"use strict";n("d142")},ac60:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[n("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),n("a-drawer",{attrs:{title:t.formAction+" RMI rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[n("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"path"}})],1),n("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[n("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),n("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),n("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var o=e.setSelectedKeys,a=e.selectedKeys,i=(e.clearFilters,e.column);return n("div",{staticStyle:{padding:"8px"}},[n("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+i.dataIndex,value:a[0]},on:{change:function(t){return o(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[i.dataIndex]=a[0],t.fetch()}}}),n("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[i.dataIndex]=a[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return n("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return n("span",{},[n("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,o,a,i){return n("span",{},[n("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(o,i.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return n("span",{},t._l(e.split(","),(function(e){return n("span",{key:e},[t._v(t._s(e)),n("br")])})),0)}},{key:"action",fn:function(e,o,a){return n("span",{},[n("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(o)}}},[t._v("View")]),n("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(o,a)}}},[t._v("Edit")]),n("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(o,a)}}},[n("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},a=[],i=n("5530"),r=(n("a434"),n("34c6")),c=n("56d7"),s=n("2084"),l="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={name:"RmiRules",data:function(){return{store:c["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:c["store"].pageSize,onShowSizeChange:function(t,e){c["store"].pageSize=e}},filters:{},loading:!1,columns:f,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,n){var o=Object(i["a"])({},this.pagination);o.current=t.current,this.pagination=o,this.order="ascend"===n.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(i["a"])(Object(i["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["j"])(e).then((function(e){var n=e.data.result;t.data=n.data;var o=Object(i["a"])({},t.pagination);o.total=n.count,t.pagination=o,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var n=this;t[e]=!t[e],Object(r["o"])(t).then().catch((function(t){n.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var n=this;Object(r["e"])(t).then((function(){n.data.splice(e,1)})).catch((function(t){n.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(r["o"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:s["a"]}},h=p,m=(n("28be"),n("2877")),g=Object(m["a"])(h,o,a,!1,null,"50ca3b7c",null);e["default"]=g.exports},d142:function(t,e,n){}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-016c45cf"],{"28be":function(t,e,n){"use strict";n("d142")},ac60:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[n("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),n("a-drawer",{attrs:{title:t.formAction+" RMI rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[n("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"path"}})],1),n("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[n("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),n("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),n("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var o=e.setSelectedKeys,a=e.selectedKeys,i=(e.clearFilters,e.column);return n("div",{staticStyle:{padding:"8px"}},[n("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+i.dataIndex,value:a[0]},on:{change:function(t){return o(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[i.dataIndex]=a[0],t.fetch()}}}),n("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[i.dataIndex]=a[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return n("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return n("span",{},[n("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,o,a,i){return n("span",{},[n("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(o,i.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return n("span",{},t._l(e.split(","),(function(e){return n("span",{key:e},[t._v(t._s(e)),n("br")])})),0)}},{key:"action",fn:function(e,o,a){return n("span",{},[n("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(o)}}},[t._v("View")]),n("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(o,a)}}},[t._v("Edit")]),n("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(o,a)}}},[n("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},a=[],i=n("5530"),r=(n("a434"),n("34c6")),c=n("56d7"),s=n("2084"),l="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={name:"RmiRules",data:function(){return{store:c["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:c["store"].pageSize,onShowSizeChange:function(t,e){c["store"].pageSize=e}},filters:{},loading:!1,columns:f,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,n){var o=Object(i["a"])({},this.pagination);o.current=t.current,this.pagination=o,this.order="ascend"===n.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(i["a"])(Object(i["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["l"])(e).then((function(e){var n=e.data.result;t.data=n.data;var o=Object(i["a"])({},t.pagination);o.total=n.count,t.pagination=o,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var n=this;t[e]=!t[e],Object(r["r"])(t).then().catch((function(t){n.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var n=this;Object(r["f"])(t).then((function(){n.data.splice(e,1)})).catch((function(t){n.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(r["r"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:s["a"]}},h=p,m=(n("28be"),n("2877")),g=Object(m["a"])(h,o,a,!1,null,"50ca3b7c",null);e["default"]=g.exports},d142:function(t,e,n){}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-0cb5e9e6.js b/frontend/dist/js/chunk-0cb5e9e6.js index c238bd2..7965a0c 100644 --- a/frontend/dist/js/chunk-0cb5e9e6.js +++ b/frontend/dist/js/chunk-0cb5e9e6.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0cb5e9e6"],{"05cd":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[a("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),a("a-drawer",{attrs:{title:t.formAction+" MySQL rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[a("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagField:"user or schema"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{label:"Files",rules:t.rules.files}},[a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"please enter file name,use ';' to split multiple file names",readOnly:t.formReadOnly,disabled:t.form.exploit_jdbc_client},model:{value:t.form.files,callback:function(e){t.$set(t.form,"files",e)},expression:"form.files"}})],1)],1)],1),a("a-row",[a("a-form-model-item",[a("div",{staticClass:"ant-form-item-label"},[a("label",{attrs:{for:"exploit-jdbc-client"}},[t._v("Exploit Jdbc Client "),a("a-tooltip",{attrs:{placement:"topLeft",title:"Whether test to exploit jdbc client."}},[a("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),a("a-switch",{attrs:{id:"exploit-jdbc-client",disabled:t.formReadOnly},model:{value:t.form.exploit_jdbc_client,callback:function(e){t.$set(t.form,"exploit_jdbc_client",e)},expression:"form.exploit_jdbc_client"}})],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("label",{attrs:{for:"payload"}},[t._v("Payload "),a("a-tooltip",{attrs:{placement:"topLeft",title:"Need to set ${payload} variable by flag format first. Payload which key is same as ${payload} will be used."}},[a("a-icon",{attrs:{type:"question-circle"}})],1)],1),t._l(t.payloadKeys,(function(e){return a("a-input-group",{key:e,attrs:{id:"payload",compact:""}},[a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Key-"+e],expression:"['Key-'+payloadKey,]"}],staticStyle:{width:"47%","margin-bottom":"5px"},attrs:{defaultOpen:!1,placeholder:"Key",disabled:!t.form.exploit_jdbc_client,readOnly:t.formReadOnly},model:{value:t.form["Key-"+e],callback:function(a){t.$set(t.form,"Key-"+e,a)},expression:"form['Key-'+payloadKey]"}}),a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Value-"+e],expression:"['Value-'+payloadKey,]"}],staticStyle:{width:"53%"},attrs:{placeholder:"Base64 encoded payload Value",disabled:!t.form.exploit_jdbc_client,readOnly:t.formReadOnly},on:{focus:function(){!t.formReadOnly&&e===t.payloadKeys[t.payloadKeys.length-1]&&t.form["Key-"+e]&&t.addPayload()}},model:{value:t.form["Value-"+e],callback:function(a){t.$set(t.form,"Value-"+e,a)},expression:"form['Value-'+payloadKey]"}},[a("a-icon",{staticClass:"dynamic-delete-button",attrs:{slot:"addonAfter",type:"minus-circle-o"},on:{click:function(){return t.form.exploit_jdbc_client?t.removePayload(e):null}},slot:"addonAfter"})],1)],1)}))],2)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var o=e.setSelectedKeys,i=e.selectedKeys,n=(e.clearFilters,e.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:i[0]},on:{change:function(t){return o(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[n.dataIndex]=i[0],t.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[n.dataIndex]=i[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return a("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,o,i,n){return a("span",{},[a("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"action",fn:function(e,o,i){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(o)}}},[t._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(o,i)}}},[t._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(o,i)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},i=[],n=a("5530"),r=(a("a434"),a("34c6")),l=a("56d7"),s=a("2084"),c="View",d="Edit",f="Create",u=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"FILES",dataIndex:"files",key:"files",ellipsis:!0},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={files:[{required:!1,message:"please enter file name"}]},m={name:"MysqlRules",data:function(){return{store:l["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:l["store"].pageSize,onShowSizeChange:function(t,e){l["store"].pageSize=e}},filters:{},loading:!1,columns:u,form:{},rules:p,payloadKeys:[1],formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,a){var o=Object(n["a"])({},this.pagination);o.current=t.current,this.pagination=o,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(n["a"])(Object(n["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["i"])(e).then((function(e){var a=e.data.result;t.data=a.data;var o=Object(n["a"])({},t.pagination);o.total=a.count,t.pagination=o,t.loading=!1})).catch((function(e){t.$notification.error({message:"Unknown error: "+e.response.status,style:{width:"400px",marginLeft:"".concat(-265,"px")},duration:4})}))},clickSwitch:function(t,e){var a=this;t[e]=!t[e],Object(r["n"])(t).then().catch((function(t){a.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(f)},viewRule:function(t){this.form=t,this.showForm(c)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var a=this;Object(r["d"])(t).then((function(){a.data.splice(e,1)})).catch((function(t){a.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){for(var e in this.formAction=t,this.formReadOnly=t===c,this.formVisible=!0,this.form.payloads)this.form["Key-"+this.payloadKeys.length]=e,this.form["Value-"+this.payloadKeys.length]=this.form.payloads[e],this.addPayload();this.formReadOnly&&this.removePayload(this.payloadKeys.length)},closeDrawer:function(){this.formVisible=!1,this.payloadKeys=[1]},addPayload:function(){this.payloadKeys.push(this.payloadKeys[this.payloadKeys.length-1]+1)},removePayload:function(t){this.payloadKeys.length>1&&this.payloadKeys.splice(this.payloadKeys.indexOf(t),1)},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){if(e){var a={},o={};for(var i in t.form)if(0===i.indexOf("Key-")){var n=i.substr("Key-".length);t.form["Value-"+n]&&(a[t.form[i]]=t.form["Value-"+n])}else-1===i.indexOf("Value-")&&(o[i]=t.form[i]);o.payloads=a,Object(r["n"])(o).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:s["a"]}},h=m,y=(a("6a0a"),a("2877")),g=Object(y["a"])(h,o,i,!1,null,"4fed8448",null);e["default"]=g.exports},"10bb":function(t,e,a){},"6a0a":function(t,e,a){"use strict";a("10bb")}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0cb5e9e6"],{"05cd":function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:e.addRule}},[a("a-icon",{attrs:{type:"plus"}}),e._v(" New Rule ")],1),a("a-drawer",{attrs:{title:e.formAction+" MySQL rule",width:490,visible:e.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:e.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:e.form,layout:"vertical"},on:{submit:e.handleSubmit}},[a("BasicRule",{attrs:{form:e.form,readOnly:e.formReadOnly,flagField:"user or schema"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{label:"Files",rules:e.rules.files}},[a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"please enter file name,use ';' to split multiple file names",readOnly:e.formReadOnly,disabled:e.form.exploit_jdbc_client},model:{value:e.form.files,callback:function(t){e.$set(e.form,"files",t)},expression:"form.files"}})],1)],1)],1),a("a-row",[a("a-form-model-item",[a("div",{staticClass:"ant-form-item-label"},[a("label",{attrs:{for:"exploit-jdbc-client"}},[e._v("Exploit Jdbc Client "),a("a-tooltip",{attrs:{placement:"topLeft",title:"Whether test to exploit jdbc client."}},[a("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),a("a-switch",{attrs:{id:"exploit-jdbc-client",disabled:e.formReadOnly},model:{value:e.form.exploit_jdbc_client,callback:function(t){e.$set(e.form,"exploit_jdbc_client",t)},expression:"form.exploit_jdbc_client"}})],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("label",{attrs:{for:"payload"}},[e._v("Payload "),a("a-tooltip",{attrs:{placement:"topLeft",title:"Need to set ${payload} variable by flag format first. Payload which key is same as ${payload} will be used."}},[a("a-icon",{attrs:{type:"question-circle"}})],1)],1),e._l(e.payloadKeys,(function(t){return a("a-input-group",{key:t,attrs:{id:"payload",compact:""}},[a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Key-"+t],expression:"['Key-'+payloadKey,]"}],staticStyle:{width:"47%","margin-bottom":"5px"},attrs:{defaultOpen:!1,placeholder:"Key",disabled:!e.form.exploit_jdbc_client,readOnly:e.formReadOnly},model:{value:e.form["Key-"+t],callback:function(a){e.$set(e.form,"Key-"+t,a)},expression:"form['Key-'+payloadKey]"}}),a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Value-"+t],expression:"['Value-'+payloadKey,]"}],staticStyle:{width:"53%"},attrs:{placeholder:"Base64 encoded payload Value",disabled:!e.form.exploit_jdbc_client,readOnly:e.formReadOnly},on:{focus:function(){!e.formReadOnly&&t===e.payloadKeys[e.payloadKeys.length-1]&&e.form["Key-"+t]&&e.addPayload()}},model:{value:e.form["Value-"+t],callback:function(a){e.$set(e.form,"Value-"+t,a)},expression:"form['Value-'+payloadKey]"}},[a("a-icon",{staticClass:"dynamic-delete-button",attrs:{slot:"addonAfter",type:"minus-circle-o"},on:{click:function(){return e.form.exploit_jdbc_client?e.removePayload(t):null}},slot:"addonAfter"})],1)],1)}))],2)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:e.handleCancel}},[e._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:e.formReadOnly},on:{click:e.handleSubmit}},[e._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:e.columns,"data-source":e.data,loading:e.loading,pagination:e.pagination},on:{change:e.handleTableChange},scopedSlots:e._u([{key:"filterDropdown",fn:function(t){var o=t.setSelectedKeys,i=t.selectedKeys,n=(t.clearFilters,t.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:i[0]},on:{change:function(e){return o(e.target.value?[e.target.value]:[])},pressEnter:function(){e.filters[n.dataIndex]=i[0],e.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){e.filters[n.dataIndex]=i[0],e.fetch()}}},[e._v(" Search ")])],1)}},{key:"filterIcon",fn:function(e){return a("a-icon",{style:{color:e?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(t){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*t).toString(16)}},[e._v(" "+e._s(t)+" ")])],1)}},{key:"switchRender",fn:function(t,o,i,n){return a("span",{},[a("a-switch",{attrs:{checked:t},on:{click:function(t){return e.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"action",fn:function(t,o,i){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.viewRule(o)}}},[e._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.editRule(o,i)}}},[e._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(t){return e.deleteRule(o,i)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[e._v("Delete")])],1)],1)}}])})],1)},i=[],n=a("5530"),r=(a("a434"),a("34c6")),l=a("56d7"),s=a("2084"),c="View",d="Edit",f="Create",u=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"FILES",dataIndex:"files",key:"files",ellipsis:!0},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={files:[{required:!1,message:"please enter file name"}]},m={name:"MysqlRules",data:function(){return{store:l["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:l["store"].pageSize,onShowSizeChange:function(e,t){l["store"].pageSize=t}},filters:{},loading:!1,columns:u,form:{},rules:p,payloadKeys:[1],formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(e,t,a){var o=Object(n["a"])({},this.pagination);o.current=e.current,this.pagination=o,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var e=this,t=Object(n["a"])(Object(n["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["k"])(t).then((function(t){var a=t.data.result;e.data=a.data;var o=Object(n["a"])({},e.pagination);o.total=a.count,e.pagination=o,e.loading=!1})).catch((function(t){e.$notification.error({message:"Unknown error: "+t.response.status,style:{width:"400px",marginLeft:"".concat(-265,"px")},duration:4})}))},clickSwitch:function(e,t){var a=this;e[t]=!e[t],Object(r["q"])(e).then().catch((function(e){a.$notification.error({message:"Edit failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(f)},viewRule:function(e){this.form=e,this.showForm(c)},editRule:function(e){this.form=JSON.parse(JSON.stringify(e)),this.showForm(d)},deleteRule:function(e,t){var a=this;Object(r["e"])(e).then((function(){a.data.splice(t,1)})).catch((function(e){a.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(e){for(var t in this.formAction=e,this.formReadOnly=e===c,this.formVisible=!0,this.form.payloads)this.form["Key-"+this.payloadKeys.length]=t,this.form["Value-"+this.payloadKeys.length]=this.form.payloads[t],this.addPayload();this.formReadOnly&&this.removePayload(this.payloadKeys.length)},closeDrawer:function(){this.formVisible=!1,this.payloadKeys=[1]},addPayload:function(){this.payloadKeys.push(this.payloadKeys[this.payloadKeys.length-1]+1)},removePayload:function(e){this.payloadKeys.length>1&&this.payloadKeys.splice(this.payloadKeys.indexOf(e),1)},handleSubmit:function(){var e=this;this.$refs.form.validate((function(t){if(t){var a={},o={};for(var i in e.form)if(0===i.indexOf("Key-")){var n=i.substr("Key-".length);e.form["Value-"+n]&&(a[e.form[i]]=e.form["Value-"+n])}else-1===i.indexOf("Value-")&&(o[i]=e.form[i]);o.payloads=a,Object(r["q"])(o).then((function(){e.closeDrawer(),e.fetch({page:e.pagination.current}),e.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(t){e.$notification.error({message:e.formAction+" failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:s["a"]}},h=m,y=(a("6a0a"),a("2877")),g=Object(y["a"])(h,o,i,!1,null,"4fed8448",null);t["default"]=g.exports},"10bb":function(e,t,a){},"6a0a":function(e,t,a){"use strict";a("10bb")}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-193ec343.js b/frontend/dist/js/chunk-193ec343.js index 236f991..ee35afa 100644 --- a/frontend/dist/js/chunk-193ec343.js +++ b/frontend/dist/js/chunk-193ec343.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-193ec343"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],f=s&&s.prototype;if(f&&f.forEach!==i)try{c(f,"forEach",i)}catch(u){f.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"30d9":function(t,e,r){},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,G.apply(null,o)}})}Q[M][$]||D(Q[M],$,Q[M].valueOf),K(Q,q),T[U]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,u=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,y,m){for(var g,v,w=i(h),O=o(w),S=n(b,y,3),j=c(O.length),E=0,I=m||a,x=e?I(h,j):r||d?I(h,0):void 0;j>E;E++)if((p||E in O)&&(g=O[E],v=S(g,E,w),t))if(e)x[E]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return E;case 2:s.call(x,g)}else switch(t){case 4:return!1;case 7:s.call(x,g)}return l?-1:f||u?u:x}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,f=i(n),u={},l=0;while(f.length>l)r=o(n,e=f[l++]),void 0!==r&&s(u,e,r);return u}})},dbbc:function(t,e,r){"use strict";r("30d9")},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),f=!a||s;n({target:"Object",stat:!0,forced:f,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"f",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"i",(function(){return s})),r.d(e,"d",(function(){return f})),r.d(e,"j",(function(){return u})),r.d(e,"e",(function(){return l})),r.d(e,"g",(function(){return d})),r.d(e,"b",(function(){return p}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}},f889:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,i=e.clearFilters,c=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":i,column:c,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"method",fn:function(e){return r("span",{},[r("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(e.toUpperCase())+" ")])],1)}},{key:"expandedRowRender",fn:function(e){return r("code",{staticStyle:{margin:"0"}},[r("b",{staticStyle:{color:"gray"}},[t._v("RAW REQUEST:")]),r("br"),r("hr"),r("span",{staticStyle:{"white-space":"pre-line"}},[t._v(t._s(e.raw_request))])])}}])})},o=[],i=r("5530"),c=r("e5bf"),a=r("56d7"),s=r("db40"),f={GET:"#52c41a",POST:"#f5222d",PUT:"#eb2f96",HEAD:"#02a7ff",OPTIONS:"#13c2c2",DELETE:"#722ed1"},u=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"METHOD",dataIndex:"method",key:"method",scopedSlots:{customRender:"method",filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"URI",dataIndex:"uri",key:"uri",ellipsis:!0,scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],l={name:"HttpLogs",data:function(){return{store:a["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:a["store"].pageSize,onShowSizeChange:function(t,e){a["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:u,colors:f}},methods:{handleTableChange:function(t,e,r){var n=Object(i["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(i["a"])(Object(i["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(c["h"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(i["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(i["a"])({},this.filters);this.loading=!0,Object(c["c"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=l,p=(r("dbbc"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-193ec343"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,c={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return i.slice()}};t.exports.f=function(t){return i&&"[object Window]"==c.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),c=r("17c2"),i=r("9112");for(var a in o){var s=n[a],u=s&&s.prototype;if(u&&u.forEach!==c)try{i(u,"forEach",c)}catch(f){u.forEach=c}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),c=o("forEach");t.exports=c?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"30d9":function(t,e,r){},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,c=r("1dde"),i=c("filter");n({target:"Array",proto:!0,forced:!i},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;ec)o.push(arguments[c++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,G.apply(null,o)}})}Q[M][$]||D(Q[M],$,Q[M].valueOf),K(Q,q),T[U]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),c=r("df75"),i=r("d039"),a=i((function(){c(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return c(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),c=r("7b0b"),i=r("50c4"),a=r("65f0"),s=[].push,u=function(t){var e=1==t,r=2==t,u=3==t,f=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,m,y){for(var g,v,w=c(h),O=o(w),S=n(b,m,3),j=i(O.length),E=0,I=y||a,x=e?I(h,j):r||d?I(h,0):void 0;j>E;E++)if((p||E in O)&&(g=O[E],v=S(g,E,w),t))if(e)x[E]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return E;case 2:s.call(x,g)}else switch(t){case 4:return!1;case 7:s.call(x,g)}return l?-1:u||f?f:x}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],c={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},i=c,a=r("2877"),s=Object(a["a"])(i,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),c=r("56ef"),i=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=i(t),o=a.f,u=c(n),f={},l=0;while(u.length>l)r=o(n,e=u[l++]),void 0!==r&&s(f,e,r);return f}})},dbbc:function(t,e,r){"use strict";r("30d9")},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),c=r("fc6a"),i=r("06cf").f,a=r("83ab"),s=o((function(){i(1)})),u=!a||s;n({target:"Object",stat:!0,forced:u,sham:!a},{getOwnPropertyDescriptor:function(t,e){return i(c(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return c})),r.d(e,"g",(function(){return i})),r.d(e,"a",(function(){return a})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return u})),r.d(e,"l",(function(){return f})),r.d(e,"f",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return h})),r.d(e,"b",(function(){return b}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function c(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function i(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function f(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}},f889:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,c=e.clearFilters,i=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":c,column:i,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"method",fn:function(e){return r("span",{},[r("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(e.toUpperCase())+" ")])],1)}},{key:"expandedRowRender",fn:function(e){return r("code",{staticStyle:{margin:"0"}},[r("b",{staticStyle:{color:"gray"}},[t._v("RAW REQUEST:")]),r("br"),r("hr"),r("span",{staticStyle:{"white-space":"pre-line"}},[t._v(t._s(e.raw_request))])])}}])})},o=[],c=r("5530"),i=r("e5bf"),a=r("56d7"),s=r("db40"),u={GET:"#52c41a",POST:"#f5222d",PUT:"#eb2f96",HEAD:"#02a7ff",OPTIONS:"#13c2c2",DELETE:"#722ed1"},f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"METHOD",dataIndex:"method",key:"method",scopedSlots:{customRender:"method",filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"URI",dataIndex:"uri",key:"uri",ellipsis:!0,scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],l={name:"HttpLogs",data:function(){return{store:a["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:a["store"].pageSize,onShowSizeChange:function(t,e){a["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:f,colors:u}},methods:{handleTableChange:function(t,e,r){var n=Object(c["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(c["a"])(Object(c["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["i"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(c["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(c["a"])({},this.filters);this.loading=!0,Object(i["c"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=l,p=(r("dbbc"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-27186dd0.js b/frontend/dist/js/chunk-27186dd0.js index 2c71f5d..41fb846 100644 --- a/frontend/dist/js/chunk-27186dd0.js +++ b/frontend/dist/js/chunk-27186dd0.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-27186dd0"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,a={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],u=function(t){try{return o(t)}catch(e){return i.slice()}};t.exports.f=function(t){return i&&"[object Window]"==a.call(t)?u(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),a=r("17c2"),i=r("9112");for(var u in o){var c=n[u],f=c&&c.prototype;if(f&&f.forEach!==a)try{i(f,"forEach",a)}catch(l){f.forEach=a}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),a=o("forEach");t.exports=a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},2084:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{label:"Name",rules:t.rules.name,prop:"name"}},[r("a-input",{attrs:{placeholder:"Please enter rule name",readOnly:t.readOnly},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1)],1),r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{rules:t.rules.flagFormat,prop:"flag_format"}},[r("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Flag Format "),r("a-tooltip",{attrs:{title:"Basic usage:\n 1. Only when the request's "+t.flagField+" contains content that satisfies the flag format, the request will be captured.\n 2. Use regular expression syntax.\n 3. The character '*' means to capture all requests.\n Advanced usage:\n 1. When the regex uses grouping without group name, the platform will only notify the user or push to the client when the first group appears for the first time.\n 2. When the regex uses grouping with group name, you can get these submatches through template variables and use them in other fields of the rule."}},[r("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),r("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"Please enter flag format",readOnly:t.readOnly},model:{value:t.form.flag_format,callback:function(e){t.$set(t.form,"flag_format",e)},expression:"form.flag_format"}})],1)],1)],1),r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{prop:"rank"}},[r("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Rank "),r("a-tooltip",{attrs:{title:"When request match multiple rules, high-rank rules will be matched first"}},[r("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),r("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["rank"],expression:"['rank']"}],staticStyle:{width:"100%"},attrs:{disabled:t.readOnly,placeholder:"0"},model:{value:t.form.rank,callback:function(e){t.$set(t.form,"rank",e)},expression:"form.rank"}})],1)],1)],1),r("a-row",{attrs:{gutter:16}},[r("a-col",{attrs:{span:12}},[r("a-form-model-item",[r("div",{staticClass:"ant-form-item-label"},[r("label",{attrs:{for:"push-to-client"}},[t._v("Push to Client "),r("a-tooltip",{attrs:{placement:"topLeft",title:"Whether push to client when capture flag with this rule."}},[r("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),r("a-switch",{attrs:{id:"push-to-client",disabled:t.readOnly},model:{value:t.form.push_to_client,callback:function(e){t.$set(t.form,"push_to_client",e)},expression:"form.push_to_client"}})],1)],1),r("a-col",{attrs:{span:12}},[r("a-form-model-item",[r("div",{staticClass:"ant-form-item-label"},[r("label",{attrs:{for:"notice"}},[t._v("Notice "),r("a-tooltip",{attrs:{placement:"topLeft",title:"Whether notice with bot when capture flag with this rule."}},[r("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),r("a-switch",{attrs:{id:"notice",disabled:t.readOnly},model:{value:t.form.notice,callback:function(e){t.$set(t.form,"notice",e)},expression:"form.notice"}})],1)],1)],1)],1)},o=[],a={name:"BasicRule",data:function(){return{rules:{name:[{required:!0,message:"Please input rule name",trigger:"blur"}],flagFormat:[{required:!0,message:"Please input flag format",trigger:"blur"}]}}},props:["form","readOnly","flagField"]},i=a,u=r("2877"),c=Object(u["a"])(i,n,o,!1,null,"a62f3176",null);e["a"]=c.exports},"34c6":function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"m",(function(){return a})),r.d(e,"c",(function(){return i})),r.d(e,"f",(function(){return u})),r.d(e,"k",(function(){return c})),r.d(e,"a",(function(){return f})),r.d(e,"i",(function(){return l})),r.d(e,"n",(function(){return s})),r.d(e,"d",(function(){return d})),r.d(e,"j",(function(){return p})),r.d(e,"o",(function(){return h})),r.d(e,"e",(function(){return m})),r.d(e,"g",(function(){return b})),r.d(e,"l",(function(){return g})),r.d(e,"b",(function(){return y}));var n=r("365c");function o(t){return Object(n["a"])({url:"/rule/http",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/rule/http",data:t,method:"post"})}function i(t){return Object(n["a"])({url:"/rule/http",data:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/rule/dns",params:t,method:"get"})}function c(t){return Object(n["a"])({url:"/rule/dns",data:t,method:"post"})}function f(t){return Object(n["a"])({url:"/rule/dns",data:t,method:"delete"})}function l(t){return Object(n["a"])({url:"/rule/mysql",params:t,method:"get"})}function s(t){return Object(n["a"])({url:"/rule/mysql",data:t,method:"post"})}function d(t){return Object(n["a"])({url:"/rule/mysql",data:t,method:"delete"})}function p(t){return Object(n["a"])({url:"/rule/rmi",params:t,method:"get"})}function h(t){return Object(n["a"])({url:"/rule/rmi",data:t,method:"post"})}function m(t){return Object(n["a"])({url:"/rule/rmi",data:t,method:"delete"})}function b(t){return Object(n["a"])({url:"/rule/ftp",params:t,method:"get"})}function g(t){return Object(n["a"])({url:"/rule/ftp",data:t,method:"post"})}function y(t){return Object(n["a"])({url:"/rule/ftp",data:t,method:"delete"})}},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,a=r("1dde"),i=a("filter");n({target:"Array",proto:!0,forced:!i},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;eh)throw TypeError(m);for(l=c(y,n),s=0;sv-n+r;s--)delete y[s-1]}else if(r>n)for(s=v-n;s>O;s--)b=s+n-1,g=s+r-1,b in y?y[g]=y[b]:delete y[g];for(s=0;sa)o.push(arguments[a++]);if(n=e,(p(e)||void 0!==t)&&!ut(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!ut(e))return e}),o[1]=e,G.apply(null,o)}})}z[I][L]||_(z[I],L,z[I].valueOf),C(z,B),N[M]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),a=r("df75"),i=r("d039"),u=i((function(){a(1)}));n({target:"Object",stat:!0,forced:u},{keys:function(t){return a(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),a=r("7b0b"),i=r("50c4"),u=r("65f0"),c=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,l=4==t,s=6==t,d=7==t,p=5==t||s;return function(h,m,b,g){for(var y,v,O=a(h),w=o(O),j=n(m,b,3),P=i(w.length),k=0,x=g||u,S=e?x(h,P):r||d?x(h,0):void 0;P>k;k++)if((p||k in w)&&(y=w[k],v=j(y,k,O),t))if(e)S[k]=v;else if(v)switch(t){case 3:return!0;case 5:return y;case 6:return k;case 2:c.call(S,y)}else switch(t){case 4:return!1;case 7:c.call(S,y)}return s?-1:f||l?l:S}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),a=r("56ef"),i=r("fc6a"),u=r("06cf"),c=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=i(t),o=u.f,f=a(n),l={},s=0;while(f.length>s)r=o(n,e=f[s++]),void 0!==r&&c(l,e,r);return l}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),a=r("fc6a"),i=r("06cf").f,u=r("83ab"),c=o((function(){i(1)})),f=!u||c;n({target:"Object",stat:!0,forced:f,sham:!u},{getOwnPropertyDescriptor:function(t,e){return i(a(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-27186dd0"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,a={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],u=function(t){try{return o(t)}catch(e){return i.slice()}};t.exports.f=function(t){return i&&"[object Window]"==a.call(t)?u(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),a=r("17c2"),i=r("9112");for(var u in o){var c=n[u],f=c&&c.prototype;if(f&&f.forEach!==a)try{i(f,"forEach",a)}catch(l){f.forEach=a}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),a=o("forEach");t.exports=a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},2084:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",[r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{label:"Name",rules:t.rules.name,prop:"name"}},[r("a-input",{attrs:{placeholder:"Please enter rule name",readOnly:t.readOnly},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1)],1),r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{rules:t.rules.flagFormat,prop:"flag_format"}},[r("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Flag Format "),r("a-tooltip",{attrs:{title:"Basic usage:\n 1. Only when the request's "+t.flagField+" contains content that satisfies the flag format, the request will be captured.\n 2. Use regular expression syntax.\n 3. The character '*' means to capture all requests.\n Advanced usage:\n 1. When the regex uses grouping without group name, the platform will only notify the user or push to the client when the first group appears for the first time.\n 2. When the regex uses grouping with group name, you can get these submatches through template variables and use them in other fields of the rule."}},[r("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),r("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"Please enter flag format",readOnly:t.readOnly},model:{value:t.form.flag_format,callback:function(e){t.$set(t.form,"flag_format",e)},expression:"form.flag_format"}})],1)],1)],1),r("a-row",{attrs:{gutter:24}},[r("a-col",{attrs:{span:24}},[r("a-form-model-item",{attrs:{prop:"rank"}},[r("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Rank "),r("a-tooltip",{attrs:{title:"When request match multiple rules, high-rank rules will be matched first"}},[r("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),r("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["rank"],expression:"['rank']"}],staticStyle:{width:"100%"},attrs:{disabled:t.readOnly,placeholder:"0"},model:{value:t.form.rank,callback:function(e){t.$set(t.form,"rank",e)},expression:"form.rank"}})],1)],1)],1),r("a-row",{attrs:{gutter:16}},[r("a-col",{attrs:{span:12}},[r("a-form-model-item",[r("div",{staticClass:"ant-form-item-label"},[r("label",{attrs:{for:"push-to-client"}},[t._v("Push to Client "),r("a-tooltip",{attrs:{placement:"topLeft",title:"Whether push to client when capture flag with this rule."}},[r("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),r("a-switch",{attrs:{id:"push-to-client",disabled:t.readOnly},model:{value:t.form.push_to_client,callback:function(e){t.$set(t.form,"push_to_client",e)},expression:"form.push_to_client"}})],1)],1),r("a-col",{attrs:{span:12}},[r("a-form-model-item",[r("div",{staticClass:"ant-form-item-label"},[r("label",{attrs:{for:"notice"}},[t._v("Notice "),r("a-tooltip",{attrs:{placement:"topLeft",title:"Whether notice with bot when capture flag with this rule."}},[r("a-icon",{attrs:{type:"question-circle"}})],1)],1)]),r("a-switch",{attrs:{id:"notice",disabled:t.readOnly},model:{value:t.form.notice,callback:function(e){t.$set(t.form,"notice",e)},expression:"form.notice"}})],1)],1)],1)],1)},o=[],a={name:"BasicRule",data:function(){return{rules:{name:[{required:!0,message:"Please input rule name",trigger:"blur"}],flagFormat:[{required:!0,message:"Please input flag format",trigger:"blur"}]}}},props:["form","readOnly","flagField"]},i=a,u=r("2877"),c=Object(u["a"])(i,n,o,!1,null,"a62f3176",null);e["a"]=c.exports},"34c6":function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"o",(function(){return a})),r.d(e,"c",(function(){return i})),r.d(e,"g",(function(){return u})),r.d(e,"m",(function(){return c})),r.d(e,"a",(function(){return f})),r.d(e,"k",(function(){return l})),r.d(e,"q",(function(){return s})),r.d(e,"e",(function(){return d})),r.d(e,"l",(function(){return p})),r.d(e,"r",(function(){return m})),r.d(e,"f",(function(){return h})),r.d(e,"j",(function(){return b})),r.d(e,"p",(function(){return g})),r.d(e,"d",(function(){return y})),r.d(e,"h",(function(){return v})),r.d(e,"n",(function(){return O})),r.d(e,"b",(function(){return w}));var n=r("365c");function o(t){return Object(n["a"])({url:"/rule/http",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/rule/http",data:t,method:"post"})}function i(t){return Object(n["a"])({url:"/rule/http",data:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/rule/dns",params:t,method:"get"})}function c(t){return Object(n["a"])({url:"/rule/dns",data:t,method:"post"})}function f(t){return Object(n["a"])({url:"/rule/dns",data:t,method:"delete"})}function l(t){return Object(n["a"])({url:"/rule/mysql",params:t,method:"get"})}function s(t){return Object(n["a"])({url:"/rule/mysql",data:t,method:"post"})}function d(t){return Object(n["a"])({url:"/rule/mysql",data:t,method:"delete"})}function p(t){return Object(n["a"])({url:"/rule/rmi",params:t,method:"get"})}function m(t){return Object(n["a"])({url:"/rule/rmi",data:t,method:"post"})}function h(t){return Object(n["a"])({url:"/rule/rmi",data:t,method:"delete"})}function b(t){return Object(n["a"])({url:"/rule/ldap",params:t,method:"get"})}function g(t){return Object(n["a"])({url:"/rule/ldap",data:t,method:"post"})}function y(t){return Object(n["a"])({url:"/rule/ldap",data:t,method:"delete"})}function v(t){return Object(n["a"])({url:"/rule/ftp",params:t,method:"get"})}function O(t){return Object(n["a"])({url:"/rule/ftp",data:t,method:"post"})}function w(t){return Object(n["a"])({url:"/rule/ftp",data:t,method:"delete"})}},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,a=r("1dde"),i=a("filter");n({target:"Array",proto:!0,forced:!i},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;em)throw TypeError(h);for(l=c(y,n),s=0;sv-n+r;s--)delete y[s-1]}else if(r>n)for(s=v-n;s>O;s--)b=s+n-1,g=s+r-1,b in y?y[g]=y[b]:delete y[g];for(s=0;sa)o.push(arguments[a++]);if(n=e,(p(e)||void 0!==t)&&!ut(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!ut(e))return e}),o[1]=e,G.apply(null,o)}})}z[I][L]||_(z[I],L,z[I].valueOf),C(z,B),N[M]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),a=r("df75"),i=r("d039"),u=i((function(){a(1)}));n({target:"Object",stat:!0,forced:u},{keys:function(t){return a(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),a=r("7b0b"),i=r("50c4"),u=r("65f0"),c=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,l=4==t,s=6==t,d=7==t,p=5==t||s;return function(m,h,b,g){for(var y,v,O=a(m),w=o(O),j=n(h,b,3),P=i(w.length),k=0,x=g||u,S=e?x(m,P):r||d?x(m,0):void 0;P>k;k++)if((p||k in w)&&(y=w[k],v=j(y,k,O),t))if(e)S[k]=v;else if(v)switch(t){case 3:return!0;case 5:return y;case 6:return k;case 2:c.call(S,y)}else switch(t){case 4:return!1;case 7:c.call(S,y)}return s?-1:f||l?l:S}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),a=r("56ef"),i=r("fc6a"),u=r("06cf"),c=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=i(t),o=u.f,f=a(n),l={},s=0;while(f.length>s)r=o(n,e=f[s++]),void 0!==r&&c(l,e,r);return l}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),a=r("fc6a"),i=r("06cf").f,u=r("83ab"),c=o((function(){i(1)})),f=!u||c;n({target:"Object",stat:!0,forced:f,sham:!u},{getOwnPropertyDescriptor:function(t,e){return i(a(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-33aba89a.js b/frontend/dist/js/chunk-33aba89a.js new file mode 100644 index 0000000..8975788 --- /dev/null +++ b/frontend/dist/js/chunk-33aba89a.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-33aba89a"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],u=s&&s.prototype;if(u&&u.forEach!==i)try{c(u,"forEach",i)}catch(f){u.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,H.apply(null,o)}})}G[J][L]||D(G[J],L,G[J].valueOf),C(G,q),z[$]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,u=function(t){var e=1==t,r=2==t,u=3==t,f=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,m,y){for(var g,v,w=i(h),O=o(w),j=n(b,m,3),S=c(O.length),x=0,I=y||a,k=e?I(h,S):r||d?I(h,0):void 0;S>x;x++)if((p||x in O)&&(g=O[x],v=j(g,x,w),t))if(e)k[x]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return x;case 2:s.call(k,g)}else switch(t){case 4:return!1;case 7:s.call(k,g)}return l?-1:u||f?f:k}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,u=i(n),f={},l=0;while(u.length>l)r=o(n,e=u[l++]),void 0!==r&&s(f,e,r);return f}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),u=!a||s;n({target:"Object",stat:!0,forced:u,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"g",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return u})),r.d(e,"l",(function(){return f})),r.d(e,"f",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return h})),r.d(e,"b",(function(){return b}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function f(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}},f2de:function(t,e,r){"use strict";r("8e6b")}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-46a53d26.js b/frontend/dist/js/chunk-46a53d26.js index a12703a..1fa8c5e 100644 --- a/frontend/dist/js/chunk-46a53d26.js +++ b/frontend/dist/js/chunk-46a53d26.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-46a53d26"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,a={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],i=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==a.call(t)?i(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),a=r("17c2"),c=r("9112");for(var i in o){var s=n[i],f=s&&s.prototype;if(f&&f.forEach!==a)try{c(f,"forEach",a)}catch(l){f.forEach=a}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),a=o("forEach");t.exports=a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"2e9f":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"expandedRowRender",fn:function(e){return e.files.length?r("div",{staticStyle:{margin:"0"}},[e.files.length?r("b",{staticStyle:{color:"gray"}},[t._v("FILES:")]):t._e(),r("br"),t._l(e.files,(function(n){return r("a",{key:n.name+e.id,attrs:{href:"/revsuit/api/file/mysql/"+n.id,target:"_blank"}},[t._v(t._s(n.name)+" ")])}))],2):t._e()}},{key:"selectDropdown",fn:function(e){e.setSelectedKeys,e.selectedKeys,e.clearFilters;var n=e.column;return r("div",{staticStyle:{padding:"8px"}},[r("a-checkbox",{attrs:{checked:"true"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="true":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" True ")]),r("br"),r("a-checkbox",{attrs:{checked:"false"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="false":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" False ")])],1)}},{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,a=e.clearFilters,c=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":a,column:c,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"loadData",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"#eb2f96"}},[t._v("TRUE")]):r("a-tag",{attrs:{color:"#f5222d"}},[t._v("FALSE")])],1)}},{key:"fileNum",fn:function(e){return r("span",{},[e.length>=3?r("a-tag",{attrs:{color:"#722ed1"}},[t._v(t._s(e.length))]):r("a-tag",{attrs:{color:t.colors[e.length]}},[t._v(" "+t._s(e.length)+" ")])],1)}}],null,!0)})},o=[],a=r("5530"),c=r("e5bf"),i=r("56d7"),s=r("db40"),f=["#13c2c2","#52c41a","#02a7ff"],l=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"USER",dataIndex:"username",key:"username",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"SCHEMA",dataIndex:"schema",key:"schema",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"LOAD DATA",dataIndex:"load_local_data",key:"load_local_data",scopedSlots:{filterDropdown:"selectDropdown",filterIcon:"filterIcon",customRender:"loadData"}},{title:"FILE NUM",dataIndex:"files",key:"files",scopedSlots:{customRender:"fileNum"}},{title:"CLIENT NAME",dataIndex:"client_name",key:"client_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"CLIENT OS",dataIndex:"client_os",key:"client_os",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],u={name:"MysqlLogs",data:function(){return{store:i["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:i["store"].pageSize,onShowSizeChange:function(t,e){i["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:l,colors:f}},methods:{handleTableChange:function(t,e,r){var n=Object(a["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(a["a"])(Object(a["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(c["i"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(a["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(a["a"])({},this.filters);this.loading=!0,Object(c["d"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=u,p=(r("6aae"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,a=r("1dde"),c=a("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},"50ec":function(t,e,r){},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;ea)o.push(arguments[a++]);if(n=e,(p(e)||void 0!==t)&&!it(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!it(e))return e}),o[1]=e,H.apply(null,o)}})}G[q][U]||_(G[q],U,G[q].valueOf),K(G,M),F[L]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),a=r("df75"),c=r("d039"),i=c((function(){a(1)}));n({target:"Object",stat:!0,forced:i},{keys:function(t){return a(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),a=r("7b0b"),c=r("50c4"),i=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,l=4==t,u=6==t,d=7==t,p=5==t||u;return function(h,b,y,g){for(var m,v,w=a(h),O=o(w),S=n(b,y,3),I=c(O.length),j=0,x=g||i,k=e?x(h,I):r||d?x(h,0):void 0;I>j;j++)if((p||j in O)&&(m=O[j],v=S(m,j,w),t))if(e)k[j]=v;else if(v)switch(t){case 3:return!0;case 5:return m;case 6:return j;case 2:s.call(k,m)}else switch(t){case 4:return!1;case 7:s.call(k,m)}return u?-1:f||l?l:k}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],a={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=a,i=r("2877"),s=Object(i["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),a=r("56ef"),c=r("fc6a"),i=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=i.f,f=a(n),l={},u=0;while(f.length>u)r=o(n,e=f[u++]),void 0!==r&&s(l,e,r);return l}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),a=r("fc6a"),c=r("06cf").f,i=r("83ab"),s=o((function(){c(1)})),f=!i||s;n({target:"Object",stat:!0,forced:f,sham:!i},{getOwnPropertyDescriptor:function(t,e){return c(a(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"f",(function(){return c})),r.d(e,"a",(function(){return i})),r.d(e,"i",(function(){return s})),r.d(e,"d",(function(){return f})),r.d(e,"j",(function(){return l})),r.d(e,"e",(function(){return u})),r.d(e,"g",(function(){return d})),r.d(e,"b",(function(){return p}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-46a53d26"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,a={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],i=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==a.call(t)?i(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),a=r("17c2"),c=r("9112");for(var i in o){var s=n[i],f=s&&s.prototype;if(f&&f.forEach!==a)try{c(f,"forEach",a)}catch(l){f.forEach=a}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),a=o("forEach");t.exports=a?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"2e9f":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"expandedRowRender",fn:function(e){return e.files.length?r("div",{staticStyle:{margin:"0"}},[e.files.length?r("b",{staticStyle:{color:"gray"}},[t._v("FILES:")]):t._e(),r("br"),t._l(e.files,(function(n){return r("a",{key:n.name+e.id,attrs:{href:"/revsuit/api/file/mysql/"+n.id,target:"_blank"}},[t._v(t._s(n.name)+" ")])}))],2):t._e()}},{key:"selectDropdown",fn:function(e){e.setSelectedKeys,e.selectedKeys,e.clearFilters;var n=e.column;return r("div",{staticStyle:{padding:"8px"}},[r("a-checkbox",{attrs:{checked:"true"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="true":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" True ")]),r("br"),r("a-checkbox",{attrs:{checked:"false"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="false":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" False ")])],1)}},{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,a=e.clearFilters,c=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":a,column:c,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"loadData",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"#eb2f96"}},[t._v("TRUE")]):r("a-tag",{attrs:{color:"#f5222d"}},[t._v("FALSE")])],1)}},{key:"fileNum",fn:function(e){return r("span",{},[e.length>=3?r("a-tag",{attrs:{color:"#722ed1"}},[t._v(t._s(e.length))]):r("a-tag",{attrs:{color:t.colors[e.length]}},[t._v(" "+t._s(e.length)+" ")])],1)}}],null,!0)})},o=[],a=r("5530"),c=r("e5bf"),i=r("56d7"),s=r("db40"),f=["#13c2c2","#52c41a","#02a7ff"],l=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"USER",dataIndex:"username",key:"username",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"SCHEMA",dataIndex:"schema",key:"schema",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"LOAD DATA",dataIndex:"load_local_data",key:"load_local_data",scopedSlots:{filterDropdown:"selectDropdown",filterIcon:"filterIcon",customRender:"loadData"}},{title:"FILE NUM",dataIndex:"files",key:"files",scopedSlots:{customRender:"fileNum"}},{title:"CLIENT NAME",dataIndex:"client_name",key:"client_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"CLIENT OS",dataIndex:"client_os",key:"client_os",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],u={name:"MysqlLogs",data:function(){return{store:i["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:i["store"].pageSize,onShowSizeChange:function(t,e){i["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:l,colors:f}},methods:{handleTableChange:function(t,e,r){var n=Object(a["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(a["a"])(Object(a["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(c["k"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(a["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(a["a"])({},this.filters);this.loading=!0,Object(c["e"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=u,p=(r("6aae"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,a=r("1dde"),c=a("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},"50ec":function(t,e,r){},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;ea)o.push(arguments[a++]);if(n=e,(p(e)||void 0!==t)&&!it(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!it(e))return e}),o[1]=e,H.apply(null,o)}})}G[q][U]||_(G[q],U,G[q].valueOf),K(G,M),F[L]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),a=r("df75"),c=r("d039"),i=c((function(){a(1)}));n({target:"Object",stat:!0,forced:i},{keys:function(t){return a(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),a=r("7b0b"),c=r("50c4"),i=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,l=4==t,u=6==t,d=7==t,p=5==t||u;return function(h,b,m,y){for(var g,v,w=a(h),O=o(w),S=n(b,m,3),I=c(O.length),j=0,k=y||i,x=e?k(h,I):r||d?k(h,0):void 0;I>j;j++)if((p||j in O)&&(g=O[j],v=S(g,j,w),t))if(e)x[j]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return j;case 2:s.call(x,g)}else switch(t){case 4:return!1;case 7:s.call(x,g)}return u?-1:f||l?l:x}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],a={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=a,i=r("2877"),s=Object(i["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),a=r("56ef"),c=r("fc6a"),i=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=i.f,f=a(n),l={},u=0;while(f.length>u)r=o(n,e=f[u++]),void 0!==r&&s(l,e,r);return l}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),a=r("fc6a"),c=r("06cf").f,i=r("83ab"),s=o((function(){c(1)})),f=!i||s;n({target:"Object",stat:!0,forced:f,sham:!i},{getOwnPropertyDescriptor:function(t,e){return c(a(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"g",(function(){return c})),r.d(e,"a",(function(){return i})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return f})),r.d(e,"l",(function(){return l})),r.d(e,"f",(function(){return u})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return h})),r.d(e,"b",(function(){return b}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-4ffb84ba.js b/frontend/dist/js/chunk-4ffb84ba.js index fb3d080..5488627 100644 --- a/frontend/dist/js/chunk-4ffb84ba.js +++ b/frontend/dist/js/chunk-4ffb84ba.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4ffb84ba"],{"266a":function(t,e,a){"use strict";a("6eb7")},"2e08":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[a("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),a("a-drawer",{attrs:{title:t.formAction+" DNS rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[a("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"domain"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:12}},[a("a-form-model-item",{attrs:{label:"Type",rules:t.rules.type}},[a("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["type"],expression:"['type']"}],staticStyle:{width:"100%"},attrs:{disabled:t.formReadOnly,placeholder:"A"},model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},[a("a-select-option",{attrs:{value:1}},[t._v("A")]),a("a-select-option",{attrs:{value:28}},[t._v("AAAA")]),a("a-select-option",{attrs:{value:5}},[t._v("CNAME")]),a("a-select-option",{attrs:{value:16}},[t._v("TXT")]),a("a-select-option",{attrs:{value:2}},[t._v("NS")]),a("a-select-option",{attrs:{value:99}},[t._v("REBINDING")])],1)],1)],1),a("a-col",{attrs:{span:12}},[a("a-form-model-item",{attrs:{label:"TTL",rules:t.rules.ttl}},[a("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["ttl"],expression:"['ttl']"}],staticStyle:{width:"100%"},attrs:{disabled:t.formReadOnly,placeholder:"10",value:99===t.form.type?t.form.ttl=0:null},model:{value:t.form.ttl,callback:function(e){t.$set(t.form,"ttl",e)},expression:"form.ttl"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{rules:t.rules.value}},[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Value "),a("a-tooltip",{attrs:{title:"Support template such as ${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:99===t.form.type?"8.8.8.8,127.0.0.1":"please enter resolve value",readOnly:t.formReadOnly},model:{value:t.form.value,callback:function(e){t.$set(t.form,"value",e)},expression:"form.value"}})],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var o=e.setSelectedKeys,r=e.selectedKeys,n=(e.clearFilters,e.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:r[0]},on:{change:function(t){return o(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[n.dataIndex]=r[0],t.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[n.dataIndex]=r[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return a("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"type",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(t.resolveTypes[e])+" ")])],1)}},{key:"switchRender",fn:function(e,o,r,n){return a("span",{},[a("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return a("span",{},t._l(e.split(","),(function(e){return a("span",{key:e},[t._v(t._s(e)),a("br")])})),0)}},{key:"action",fn:function(e,o,r){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(o)}}},[t._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(o,r)}}},[t._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(o,r)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},r=[],n=a("5530"),i=(a("a434"),a("34c6")),s=a("56d7"),l=a("2084"),c="View",d="Edit",u="Create",p={1:"geekblue",28:"green",5:"red",16:"pink",2:"purple",99:"orange"},f={1:"A",28:"AAAA",5:"CNAME",16:"TXT",2:"NS",99:"RB"},m=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"TYPE",dataIndex:"type",key:"type",scopedSlots:{customRender:"type"}},{title:"TTL",dataIndex:"ttl",key:"ttl"},{title:"VALUE",dataIndex:"value",key:"value",scopedSlots:{customRender:"valueRender"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],h={value:[{required:!1,message:"please enter resolve value"}],type:[{required:!1,message:"please enter resolve type"}],ttl:[{required:!1,message:"please enter resolve ttl"}]},y={name:"DnsRules",data:function(){return{store:s["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:s["store"].pageSize,onShowSizeChange:function(t,e){s["store"].pageSize=e}},filters:{},loading:!1,columns:m,colors:p,resolveTypes:f,form:{},rules:h,formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,a){var o=Object(n["a"])({},this.pagination);o.current=t.current,this.pagination=o,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(n["a"])(Object(n["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["f"])(e).then((function(e){var a=e.data.result;t.data=a.data;var o=Object(n["a"])({},t.pagination);o.total=a.count,t.pagination=o,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var a=this;t[e]=!t[e],Object(i["k"])(t).then().catch((function(t){a.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(c)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var a=this;Object(i["a"])(t).then((function(){a.data.splice(e,1)})).catch((function(t){a.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===c,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(i["k"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:l["a"]}},g=y,v=(a("266a"),a("2877")),b=Object(v["a"])(g,o,r,!1,null,"3819ffac",null);e["default"]=b.exports},"6eb7":function(t,e,a){}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4ffb84ba"],{"266a":function(t,e,a){"use strict";a("6eb7")},"2e08":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[a("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),a("a-drawer",{attrs:{title:t.formAction+" DNS rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[a("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"domain"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:12}},[a("a-form-model-item",{attrs:{label:"Type",rules:t.rules.type}},[a("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["type"],expression:"['type']"}],staticStyle:{width:"100%"},attrs:{disabled:t.formReadOnly,placeholder:"A"},model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},[a("a-select-option",{attrs:{value:1}},[t._v("A")]),a("a-select-option",{attrs:{value:28}},[t._v("AAAA")]),a("a-select-option",{attrs:{value:5}},[t._v("CNAME")]),a("a-select-option",{attrs:{value:16}},[t._v("TXT")]),a("a-select-option",{attrs:{value:2}},[t._v("NS")]),a("a-select-option",{attrs:{value:99}},[t._v("REBINDING")])],1)],1)],1),a("a-col",{attrs:{span:12}},[a("a-form-model-item",{attrs:{label:"TTL",rules:t.rules.ttl}},[a("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["ttl"],expression:"['ttl']"}],staticStyle:{width:"100%"},attrs:{disabled:t.formReadOnly,placeholder:"10",value:99===t.form.type?t.form.ttl=0:null},model:{value:t.form.ttl,callback:function(e){t.$set(t.form,"ttl",e)},expression:"form.ttl"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{rules:t.rules.value}},[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Value "),a("a-tooltip",{attrs:{title:"Support template such as ${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:99===t.form.type?"8.8.8.8,127.0.0.1":"please enter resolve value",readOnly:t.formReadOnly},model:{value:t.form.value,callback:function(e){t.$set(t.form,"value",e)},expression:"form.value"}})],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var o=e.setSelectedKeys,r=e.selectedKeys,n=(e.clearFilters,e.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:r[0]},on:{change:function(t){return o(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[n.dataIndex]=r[0],t.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[n.dataIndex]=r[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return a("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"type",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(t.resolveTypes[e])+" ")])],1)}},{key:"switchRender",fn:function(e,o,r,n){return a("span",{},[a("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return a("span",{},t._l(e.split(","),(function(e){return a("span",{key:e},[t._v(t._s(e)),a("br")])})),0)}},{key:"action",fn:function(e,o,r){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(o)}}},[t._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(o,r)}}},[t._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(o,r)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},r=[],n=a("5530"),i=(a("a434"),a("34c6")),s=a("56d7"),l=a("2084"),c="View",d="Edit",u="Create",p={1:"geekblue",28:"green",5:"red",16:"pink",2:"purple",99:"orange"},f={1:"A",28:"AAAA",5:"CNAME",16:"TXT",2:"NS",99:"RB"},m=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"TYPE",dataIndex:"type",key:"type",scopedSlots:{customRender:"type"}},{title:"TTL",dataIndex:"ttl",key:"ttl"},{title:"VALUE",dataIndex:"value",key:"value",scopedSlots:{customRender:"valueRender"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],h={value:[{required:!1,message:"please enter resolve value"}],type:[{required:!1,message:"please enter resolve type"}],ttl:[{required:!1,message:"please enter resolve ttl"}]},y={name:"DnsRules",data:function(){return{store:s["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:s["store"].pageSize,onShowSizeChange:function(t,e){s["store"].pageSize=e}},filters:{},loading:!1,columns:m,colors:p,resolveTypes:f,form:{},rules:h,formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,a){var o=Object(n["a"])({},this.pagination);o.current=t.current,this.pagination=o,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(n["a"])(Object(n["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["g"])(e).then((function(e){var a=e.data.result;t.data=a.data;var o=Object(n["a"])({},t.pagination);o.total=a.count,t.pagination=o,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var a=this;t[e]=!t[e],Object(i["m"])(t).then().catch((function(t){a.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(c)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var a=this;Object(i["a"])(t).then((function(){a.data.splice(e,1)})).catch((function(t){a.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===c,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(i["m"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:l["a"]}},g=y,v=(a("266a"),a("2877")),b=Object(v["a"])(g,o,r,!1,null,"3819ffac",null);e["default"]=b.exports},"6eb7":function(t,e,a){}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-5fb70d83.js b/frontend/dist/js/chunk-5fb70d83.js index f727da5..88ee80d 100644 --- a/frontend/dist/js/chunk-5fb70d83.js +++ b/frontend/dist/js/chunk-5fb70d83.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5fb70d83"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],f=s&&s.prototype;if(f&&f.forEach!==i)try{c(f,"forEach",i)}catch(u){f.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"333e":function(t,e,r){"use strict";r("db2e")},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,W.apply(null,o)}})}G[q][J]||k(G[q],J,G[q].valueOf),T(G,$),z[M]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,u=4==t,l=6==t,d=7==t,p=5==t||l;return function(b,h,m,y){for(var g,v,w=i(b),O=o(w),j=n(h,m,3),S=c(O.length),x=0,I=y||a,D=e?I(b,S):r||d?I(b,0):void 0;S>x;x++)if((p||x in O)&&(g=O[x],v=j(g,x,w),t))if(e)D[x]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return x;case 2:s.call(D,g)}else switch(t){case 4:return!1;case 7:s.call(D,g)}return l?-1:f||u?u:D}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},db2e:function(t,e,r){},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,f=i(n),u={},l=0;while(f.length>l)r=o(n,e=f[l++]),void 0!==r&&s(u,e,r);return u}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),f=!a||s;n({target:"Object",stat:!0,forced:f,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"f",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"i",(function(){return s})),r.d(e,"d",(function(){return f})),r.d(e,"j",(function(){return u})),r.d(e,"e",(function(){return l})),r.d(e,"g",(function(){return d})),r.d(e,"b",(function(){return p}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-5fb70d83"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],u=s&&s.prototype;if(u&&u.forEach!==i)try{c(u,"forEach",i)}catch(f){u.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"333e":function(t,e,r){"use strict";r("db2e")},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,W.apply(null,o)}})}G[q][J]||k(G[q],J,G[q].valueOf),T(G,$),z[M]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,u=function(t){var e=1==t,r=2==t,u=3==t,f=4==t,l=6==t,d=7==t,p=5==t||l;return function(b,h,m,g){for(var y,v,O=i(b),w=o(O),j=n(h,m,3),S=c(w.length),x=0,I=g||a,D=e?I(b,S):r||d?I(b,0):void 0;S>x;x++)if((p||x in w)&&(y=w[x],v=j(y,x,O),t))if(e)D[x]=v;else if(v)switch(t){case 3:return!0;case 5:return y;case 6:return x;case 2:s.call(D,y)}else switch(t){case 4:return!1;case 7:s.call(D,y)}return l?-1:u||f?f:D}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},db2e:function(t,e,r){},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,u=i(n),f={},l=0;while(u.length>l)r=o(n,e=u[l++]),void 0!==r&&s(f,e,r);return f}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),u=!a||s;n({target:"Object",stat:!0,forced:u,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"g",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return u})),r.d(e,"l",(function(){return f})),r.d(e,"f",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return b})),r.d(e,"b",(function(){return h}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function f(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-6101772c.js b/frontend/dist/js/chunk-6101772c.js new file mode 100644 index 0000000..ff8ce0a --- /dev/null +++ b/frontend/dist/js/chunk-6101772c.js @@ -0,0 +1 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6101772c"],{"0ee9":function(t,e,n){"use strict";n("801a")},"6ce6":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[n("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),n("a-drawer",{attrs:{title:t.formAction+" RMI rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[n("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"path"}})],1),n("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[n("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),n("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),n("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var a=e.setSelectedKeys,o=e.selectedKeys,i=(e.clearFilters,e.column);return n("div",{staticStyle:{padding:"8px"}},[n("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+i.dataIndex,value:o[0]},on:{change:function(t){return a(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[i.dataIndex]=o[0],t.fetch()}}}),n("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[i.dataIndex]=o[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return n("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return n("span",{},[n("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,a,o,i){return n("span",{},[n("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(a,i.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return n("span",{},t._l(e.split(","),(function(e){return n("span",{key:e},[t._v(t._s(e)),n("br")])})),0)}},{key:"action",fn:function(e,a,o){return n("span",{},[n("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(a)}}},[t._v("View")]),n("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(a,o)}}},[t._v("Edit")]),n("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(a,o)}}},[n("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},o=[],i=n("5530"),r=(n("a434"),n("34c6")),s=n("56d7"),c=n("2084"),l="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={name:"LdapRules",data:function(){return{store:s["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:s["store"].pageSize,onShowSizeChange:function(t,e){s["store"].pageSize=e}},filters:{},loading:!1,columns:f,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,n){var a=Object(i["a"])({},this.pagination);a.current=t.current,this.pagination=a,this.order="ascend"===n.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(i["a"])(Object(i["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(r["j"])(e).then((function(e){var n=e.data.result;t.data=n.data;var a=Object(i["a"])({},t.pagination);a.total=n.count,t.pagination=a,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var n=this;t[e]=!t[e],Object(r["p"])(t).then().catch((function(t){n.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var n=this;Object(r["d"])(t).then((function(){n.data.splice(e,1)})).catch((function(t){n.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(r["p"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:c["a"]}},h=p,m=(n("0ee9"),n("2877")),g=Object(m["a"])(h,a,o,!1,null,"0fa98c43",null);e["default"]=g.exports},"801a":function(t,e,n){}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-72839f90.js b/frontend/dist/js/chunk-72839f90.js index c878a0a..038aa36 100644 --- a/frontend/dist/js/chunk-72839f90.js +++ b/frontend/dist/js/chunk-72839f90.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-72839f90"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,c={}.toString,i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return i.slice()}};t.exports.f=function(t){return i&&"[object Window]"==c.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),c=r("17c2"),i=r("9112");for(var a in o){var s=n[a],f=s&&s.prototype;if(f&&f.forEach!==c)try{i(f,"forEach",c)}catch(u){f.forEach=c}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),c=o("forEach");t.exports=c?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"382b":function(t,e,r){},"430c":function(t,e,r){"use strict";r("382b")},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,c=r("1dde"),i=c("filter");n({target:"Array",proto:!0,forced:!i},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;ec)o.push(arguments[c++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,W.apply(null,o)}})}Q[L][M]||k(Q[L],M,Q[L].valueOf),H(Q,U),F[z]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),c=r("df75"),i=r("d039"),a=i((function(){c(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return c(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),c=r("7b0b"),i=r("50c4"),a=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,u=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,y,g){for(var m,v,w=c(h),O=o(w),S=n(b,y,3),I=i(O.length),j=0,D=g||a,x=e?D(h,I):r||d?D(h,0):void 0;I>j;j++)if((p||j in O)&&(m=O[j],v=S(m,j,w),t))if(e)x[j]=v;else if(v)switch(t){case 3:return!0;case 5:return m;case 6:return j;case 2:s.call(x,m)}else switch(t){case 4:return!1;case 7:s.call(x,m)}return l?-1:f||u?u:x}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},c5bf:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"selectDropdown",fn:function(e){e.setSelectedKeys,e.selectedKeys,e.clearFilters;var n=e.column;return r("div",{staticStyle:{padding:"8px"}},[r("a-checkbox",{attrs:{checked:"CRASHED"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="CRASHED":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" CRASHED ")]),r("br"),r("a-checkbox",{attrs:{checked:"FINISHED"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="FINISHED":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" FINISHED ")])],1)}},{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,c=e.clearFilters,i=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":c,column:i,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"method",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"UPLOAD"===e?"#eb2f96":"#02a7ff"}},[t._v(t._s(e))]):t._e()],1)}},{key:"file",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"#f5222d"}},[r("a",{attrs:{target:"_blank",href:"/revsuit/api/file/ftp/"+e.id}},[t._v("TRUE")])]):r("a-tag",{attrs:{color:"#722ed1"}},[t._v(" FALSE ")])],1)}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"status",fn:function(e){return r("span",{},[r("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(e)+" ")])],1)}}])})},o=[],c=r("5530"),i=r("e5bf"),a=r("56d7"),s=r("db40"),f={CRASHED:"#f50",FINISHED:"#52c41a"},u=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"USER",dataIndex:"user",key:"user",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"PASSWORD",dataIndex:"password",key:"password",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"PATH",dataIndex:"path",key:"path",ellipsis:!0,scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"METHOD",dataIndex:"method",key:"method",scopedSlots:{customRender:"method",filterDropdown:"selectDropdown",filterIcon:"filterIcon"}},{title:"FILE",dataIndex:"file",key:"file",scopedSlots:{customRender:"file"}},{title:"STATUS",dataIndex:"status",key:"status",scopedSlots:{customRender:"status",filterDropdown:"selectDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],l={name:"FtpLogs",data:function(){return{store:a["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:a["store"].pageSize,onShowSizeChange:function(t,e){a["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:u,colors:f}},methods:{handleTableChange:function(t,e,r){var n=Object(c["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(c["a"])(Object(c["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["g"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(c["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(c["a"])({},this.filters);this.loading=!0,Object(i["b"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=l,p=(r("430c"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],c={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},i=c,a=r("2877"),s=Object(a["a"])(i,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),c=r("56ef"),i=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=i(t),o=a.f,f=c(n),u={},l=0;while(f.length>l)r=o(n,e=f[l++]),void 0!==r&&s(u,e,r);return u}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),c=r("fc6a"),i=r("06cf").f,a=r("83ab"),s=o((function(){i(1)})),f=!a||s;n({target:"Object",stat:!0,forced:f,sham:!a},{getOwnPropertyDescriptor:function(t,e){return i(c(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"c",(function(){return c})),r.d(e,"f",(function(){return i})),r.d(e,"a",(function(){return a})),r.d(e,"i",(function(){return s})),r.d(e,"d",(function(){return f})),r.d(e,"j",(function(){return u})),r.d(e,"e",(function(){return l})),r.d(e,"g",(function(){return d})),r.d(e,"b",(function(){return p}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function c(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function i(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-72839f90"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,c={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],i=function(t){try{return o(t)}catch(e){return a.slice()}};t.exports.f=function(t){return a&&"[object Window]"==c.call(t)?i(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),c=r("17c2"),a=r("9112");for(var i in o){var s=n[i],f=s&&s.prototype;if(f&&f.forEach!==c)try{a(f,"forEach",c)}catch(u){f.forEach=c}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),c=o("forEach");t.exports=c?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"382b":function(t,e,r){},"430c":function(t,e,r){"use strict";r("382b")},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,c=r("1dde"),a=c("filter");n({target:"Array",proto:!0,forced:!a},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;ec)o.push(arguments[c++]);if(n=e,(p(e)||void 0!==t)&&!it(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!it(e))return e}),o[1]=e,W.apply(null,o)}})}Q[L][M]||k(Q[L],M,Q[L].valueOf),H(Q,U),F[z]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),c=r("df75"),a=r("d039"),i=a((function(){c(1)}));n({target:"Object",stat:!0,forced:i},{keys:function(t){return c(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),c=r("7b0b"),a=r("50c4"),i=r("65f0"),s=[].push,f=function(t){var e=1==t,r=2==t,f=3==t,u=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,y,m){for(var g,v,w=c(h),O=o(w),S=n(b,y,3),I=a(O.length),j=0,D=m||i,x=e?D(h,I):r||d?D(h,0):void 0;I>j;j++)if((p||j in O)&&(g=O[j],v=S(g,j,w),t))if(e)x[j]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return j;case 2:s.call(x,g)}else switch(t){case 4:return!1;case 7:s.call(x,g)}return l?-1:f||u?u:x}};t.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterOut:f(7)}},c5bf:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination,rowClassName:function(t,e){return e%2===0?"":"gray-table-row"}},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"selectDropdown",fn:function(e){e.setSelectedKeys,e.selectedKeys,e.clearFilters;var n=e.column;return r("div",{staticStyle:{padding:"8px"}},[r("a-checkbox",{attrs:{checked:"CRASHED"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="CRASHED":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" CRASHED ")]),r("br"),r("a-checkbox",{attrs:{checked:"FINISHED"===t.filters[n.dataIndex]},on:{change:function(e){e.target.checked?t.filters[n.dataIndex]="FINISHED":t.filters[n.dataIndex]="",t.fetch()}}},[t._v(" FINISHED ")])],1)}},{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,c=e.clearFilters,a=e.column;return r("filter-dropdown",{attrs:{"set-selected-keys":n,"selected-keys":o,"clear-filters":c,column:a,filters:t.filters,fetch:t.fetch}})}},{key:"filterIcon",fn:function(t){return r("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"method",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"UPLOAD"===e?"#eb2f96":"#02a7ff"}},[t._v(t._s(e))]):t._e()],1)}},{key:"file",fn:function(e){return r("span",{},[e?r("a-tag",{attrs:{color:"#f5222d"}},[r("a",{attrs:{target:"_blank",href:"/revsuit/api/file/ftp/"+e.id}},[t._v("TRUE")])]):r("a-tag",{attrs:{color:"#722ed1"}},[t._v(" FALSE ")])],1)}},{key:"time",fn:function(e){return r("span",{},[t._v(" "+t._s(new Date(e).format("yyyy-MM-dd hh:mm:ss"))+" ")])}},{key:"status",fn:function(e){return r("span",{},[r("a-tag",{attrs:{color:t.colors[e]}},[t._v(" "+t._s(e)+" ")])],1)}}])})},o=[],c=r("5530"),a=r("e5bf"),i=r("56d7"),s=r("db40"),f={CRASHED:"#f50",FINISHED:"#52c41a"},u=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"REQUEST TIME",dataIndex:"request_time",key:"request_time",scopedSlots:{customRender:"time"}},{title:"RULE",dataIndex:"rule_name",key:"rule_name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG",dataIndex:"flag",key:"flag",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"USER",dataIndex:"user",key:"user",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"PASSWORD",dataIndex:"password",key:"password",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"PATH",dataIndex:"path",key:"path",ellipsis:!0,scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"METHOD",dataIndex:"method",key:"method",scopedSlots:{customRender:"method",filterDropdown:"selectDropdown",filterIcon:"filterIcon"}},{title:"FILE",dataIndex:"file",key:"file",scopedSlots:{customRender:"file"}},{title:"STATUS",dataIndex:"status",key:"status",scopedSlots:{customRender:"status",filterDropdown:"selectDropdown",filterIcon:"filterIcon"}},{title:"REMOTE IP",key:"remote_ip",dataIndex:"remote_ip",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"IP AREA",key:"ip_area",dataIndex:"ip_area"}],l={name:"FtpLogs",data:function(){return{store:i["store"],data:[],pagination:{current:1,showSizeChanger:!0,pageSize:i["store"].pageSize,onShowSizeChange:function(t,e){i["store"].pageSize=e}},filters:{},order:"desc",loading:!1,columns:u,colors:f}},methods:{handleTableChange:function(t,e,r){var n=Object(c["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===r.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(c["a"])(Object(c["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(a["h"])(e).then((function(e){var r=e.data.result;t.data=r.data;var n=Object(c["a"])({},t.pagination);n.total=r.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},delete:function(){var t=this,e=Object(c["a"])({},this.filters);this.loading=!0,Object(a["b"])(e).then((function(){t.$message.success("Deleted successfully"),t.filters={},t.fetch()})).catch((function(e){403!==e.response.status&&t.$message.error("Failed to delete: "+e.response.data.error)}))}},mounted:function(){this.fetch()},components:{FilterDropdown:s["a"]}},d=l,p=(r("430c"),r("2877")),h=Object(p["a"])(d,n,o,!1,null,null,null);e["default"]=h.exports},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],c={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},a=c,i=r("2877"),s=Object(i["a"])(a,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),c=r("56ef"),a=r("fc6a"),i=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=a(t),o=i.f,f=c(n),u={},l=0;while(f.length>l)r=o(n,e=f[l++]),void 0!==r&&s(u,e,r);return u}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),c=r("fc6a"),a=r("06cf").f,i=r("83ab"),s=o((function(){a(1)})),f=!i||s;n({target:"Object",stat:!0,forced:f,sham:!i},{getOwnPropertyDescriptor:function(t,e){return a(c(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return c})),r.d(e,"g",(function(){return a})),r.d(e,"a",(function(){return i})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return f})),r.d(e,"l",(function(){return u})),r.d(e,"f",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return h})),r.d(e,"b",(function(){return b}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function c(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function f(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function u(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-740736c7.js b/frontend/dist/js/chunk-740736c7.js index 29abd41..148a61a 100644 --- a/frontend/dist/js/chunk-740736c7.js +++ b/frontend/dist/js/chunk-740736c7.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-740736c7"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],u=s&&s.prototype;if(u&&u.forEach!==i)try{c(u,"forEach",i)}catch(f){u.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,H.apply(null,o)}})}G[J][M]||k(G[J],M,G[J].valueOf),R(G,q),z[$]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,u=function(t){var e=1==t,r=2==t,u=3==t,f=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,m,y){for(var g,v,w=i(h),O=o(w),j=n(b,m,3),S=c(O.length),x=0,I=y||a,D=e?I(h,S):r||d?I(h,0):void 0;S>x;x++)if((p||x in O)&&(g=O[x],v=j(g,x,w),t))if(e)D[x]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return x;case 2:s.call(D,g)}else switch(t){case 4:return!1;case 7:s.call(D,g)}return l?-1:u||f?f:D}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,u=i(n),f={},l=0;while(u.length>l)r=o(n,e=u[l++]),void 0!==r&&s(f,e,r);return f}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),u=!a||s;n({target:"Object",stat:!0,forced:u,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"h",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"f",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"i",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"j",(function(){return f})),r.d(e,"e",(function(){return l})),r.d(e,"g",(function(){return d})),r.d(e,"b",(function(){return p}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function f(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-740736c7"],{"057f":function(t,e,r){var n=r("fc6a"),o=r("241c").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(t){try{return o(t)}catch(e){return c.slice()}};t.exports.f=function(t){return c&&"[object Window]"==i.call(t)?a(t):o(n(t))}},"159b":function(t,e,r){var n=r("da84"),o=r("fdbc"),i=r("17c2"),c=r("9112");for(var a in o){var s=n[a],u=s&&s.prototype;if(u&&u.forEach!==i)try{c(u,"forEach",i)}catch(f){u.forEach=i}}},"17c2":function(t,e,r){"use strict";var n=r("b727").forEach,o=r("a640"),i=o("forEach");t.exports=i?[].forEach:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}},"4de4":function(t,e,r){"use strict";var n=r("23e7"),o=r("b727").filter,i=r("1dde"),c=i("filter");n({target:"Array",proto:!0,forced:!c},{filter:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}})},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return i}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;ei)o.push(arguments[i++]);if(n=e,(p(e)||void 0!==t)&&!at(t))return d(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!at(e))return e}),o[1]=e,H.apply(null,o)}})}G[J][M]||D(G[J],M,G[J].valueOf),R(G,q),z[$]=!0},a640:function(t,e,r){"use strict";var n=r("d039");t.exports=function(t,e){var r=[][t];return!!r&&n((function(){r.call(null,e||function(){throw 1},1)}))}},b64b:function(t,e,r){var n=r("23e7"),o=r("7b0b"),i=r("df75"),c=r("d039"),a=c((function(){i(1)}));n({target:"Object",stat:!0,forced:a},{keys:function(t){return i(o(t))}})},b727:function(t,e,r){var n=r("0366"),o=r("44ad"),i=r("7b0b"),c=r("50c4"),a=r("65f0"),s=[].push,u=function(t){var e=1==t,r=2==t,u=3==t,f=4==t,l=6==t,d=7==t,p=5==t||l;return function(h,b,m,y){for(var g,v,w=i(h),O=o(w),j=n(b,m,3),S=c(O.length),x=0,I=y||a,k=e?I(h,S):r||d?I(h,0):void 0;S>x;x++)if((p||x in O)&&(g=O[x],v=j(g,x,w),t))if(e)k[x]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return x;case 2:s.call(k,g)}else switch(t){case 4:return!1;case 7:s.call(k,g)}return l?-1:u||f?f:k}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},db40:function(t,e,r){"use strict";var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticStyle:{padding:"8px"},attrs:{slot:"filterDropdown"},slot:"filterDropdown"},[r("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+t.column.dataIndex,value:t.selectedKeys[0]},on:{change:function(e){return t.setSelectedKeys(e.target.value?[e.target.value]:[])},pressEnter:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}}),r("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[t.column.dataIndex]=t.selectedKeys[0],t.fetch()}}},[t._v(" Search ")]),r("a-button",{staticStyle:{width:"90px"},attrs:{size:"small"},on:{click:function(){t.clearFilters(),delete t.filters[t.column.dataIndex],t.fetch()}}},[t._v(" Reset ")])],1)},o=[],i={name:"FilterDropdown",props:["setSelectedKeys","selectedKeys","clearFilters","column","filters","fetch"]},c=i,a=r("2877"),s=Object(a["a"])(c,n,o,!1,null,"5e6f101e",null);e["a"]=s.exports},dbb4:function(t,e,r){var n=r("23e7"),o=r("83ab"),i=r("56ef"),c=r("fc6a"),a=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!o},{getOwnPropertyDescriptors:function(t){var e,r,n=c(t),o=a.f,u=i(n),f={},l=0;while(u.length>l)r=o(n,e=u[l++]),void 0!==r&&s(f,e,r);return f}})},e439:function(t,e,r){var n=r("23e7"),o=r("d039"),i=r("fc6a"),c=r("06cf").f,a=r("83ab"),s=o((function(){c(1)})),u=!a||s;n({target:"Object",stat:!0,forced:u,sham:!a},{getOwnPropertyDescriptor:function(t,e){return c(i(t),e)}})},e5383:function(t,e,r){var n=r("b622");e.f=n},e5bf:function(t,e,r){"use strict";r.d(e,"i",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"g",(function(){return c})),r.d(e,"a",(function(){return a})),r.d(e,"k",(function(){return s})),r.d(e,"e",(function(){return u})),r.d(e,"l",(function(){return f})),r.d(e,"f",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"d",(function(){return p})),r.d(e,"h",(function(){return h})),r.d(e,"b",(function(){return b}));var n=r("365c");function o(t){return Object(n["a"])({url:"/record/http",params:t,method:"get"})}function i(t){return Object(n["a"])({url:"/record/http",params:t,method:"delete"})}function c(t){return Object(n["a"])({url:"/record/dns",params:t,method:"get"})}function a(t){return Object(n["a"])({url:"/record/dns",params:t,method:"delete"})}function s(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"get"})}function u(t){return Object(n["a"])({url:"/record/mysql",params:t,method:"delete"})}function f(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"get"})}function l(t){return Object(n["a"])({url:"/record/rmi",params:t,method:"delete"})}function d(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"get"})}function p(t){return Object(n["a"])({url:"/record/ldap",params:t,method:"delete"})}function h(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"get"})}function b(t){return Object(n["a"])({url:"/record/ftp",params:t,method:"delete"})}}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-ae691e78.js b/frontend/dist/js/chunk-ae691e78.js index 883af83..50bbcb9 100644 --- a/frontend/dist/js/chunk-ae691e78.js +++ b/frontend/dist/js/chunk-ae691e78.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ae691e78"],{"28db":function(t,e,a){"use strict";a("c674")},c674:function(t,e,a){},f832:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[a("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),a("a-drawer",{attrs:{title:t.formAction+" FTP rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[a("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"user or password"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Pasv Address "),a("a-tooltip",{attrs:{title:"1. Support template such as ${user}/${password}/${varname}.\n2.For setting the rebind mode, please use ',' to separate addresses."}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"Use `external_ip:pasv_port` by default",readOnly:t.formReadOnly},model:{value:t.form.pasv_address,callback:function(e){t.$set(t.form,"pasv_address",e)},expression:"form.pasv_address"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Data "),a("a-tooltip",{attrs:{title:"1. The data to be returned when the client executes the download request.\n 2. Please use base64 encoding.\n 3. Support template such as ${user}/${password}/${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-textarea",{attrs:{placeholder:"The data to be returned when the client executes the download request. Please use base64 encoding.",readOnly:t.formReadOnly,"auto-size":{minRows:10,maxRows:30}},model:{value:t.form.data,callback:function(e){t.$set(t.form,"data",e)},expression:"form.data"}})],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,r=(e.clearFilters,e.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+r.dataIndex,value:o[0]},on:{change:function(t){return n(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[r.dataIndex]=o[0],t.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[r.dataIndex]=o[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return a("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,n,o,r){return a("span",{},[a("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(n,r.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return a("span",{},t._l(e.split(","),(function(e){return a("span",{key:e},[t._v(t._s(e)),a("br")])})),0)}},{key:"action",fn:function(e,n,o){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(n)}}},[t._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(n,o)}}},[t._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(n,o)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},o=[],r=a("5530"),i=(a("a434"),a("34c6")),s=a("56d7"),c=a("2084"),l="View",d="Edit",u="Create",p=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PASV ADDRESS",dataIndex:"pasv_address",key:"pasv_address",ellipsis:!0},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],f={name:"FtpRules",data:function(){return{store:s["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:s["store"].pageSize,onShowSizeChange:function(t,e){s["store"].pageSize=e}},filters:{},loading:!1,columns:p,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,a){var n=Object(r["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(r["a"])(Object(r["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["g"])(e).then((function(e){var a=e.data.result;t.data=a.data;var n=Object(r["a"])({},t.pagination);n.total=a.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var a=this;t[e]=!t[e],Object(i["l"])(t).then().catch((function(t){a.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var a=this;Object(i["b"])(t).then((function(){a.data.splice(e,1)})).catch((function(t){a.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(i["l"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:c["a"]}},h=f,m=(a("28db"),a("2877")),g=Object(m["a"])(h,n,o,!1,null,"3db1b286",null);e["default"]=g.exports}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-ae691e78"],{"28db":function(t,e,a){"use strict";a("c674")},c674:function(t,e,a){},f832:function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:t.addRule}},[a("a-icon",{attrs:{type:"plus"}}),t._v(" New Rule ")],1),a("a-drawer",{attrs:{title:t.formAction+" FTP rule",width:490,visible:t.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:t.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"},on:{submit:t.handleSubmit}},[a("BasicRule",{attrs:{form:t.form,readOnly:t.formReadOnly,flagFormat:"user or password"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Pasv Address "),a("a-tooltip",{attrs:{title:"1. Support template such as ${user}/${password}/${varname}.\n2.For setting the rebind mode, please use ',' to separate addresses."}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"Use `external_ip:pasv_port` by default",readOnly:t.formReadOnly},model:{value:t.form.pasv_address,callback:function(e){t.$set(t.form,"pasv_address",e)},expression:"form.pasv_address"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[t._v(" Data "),a("a-tooltip",{attrs:{title:"1. The data to be returned when the client executes the download request.\n 2. Please use base64 encoding.\n 3. Support template such as ${user}/${password}/${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-textarea",{attrs:{placeholder:"The data to be returned when the client executes the download request. Please use base64 encoding.",readOnly:t.formReadOnly,"auto-size":{minRows:10,maxRows:30}},model:{value:t.form.data,callback:function(e){t.$set(t.form,"data",e)},expression:"form.data"}})],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:t.handleCancel}},[t._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:t.formReadOnly},on:{click:t.handleSubmit}},[t._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:t.columns,"data-source":t.data,loading:t.loading,pagination:t.pagination},on:{change:t.handleTableChange},scopedSlots:t._u([{key:"filterDropdown",fn:function(e){var n=e.setSelectedKeys,o=e.selectedKeys,r=(e.clearFilters,e.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+r.dataIndex,value:o[0]},on:{change:function(t){return n(t.target.value?[t.target.value]:[])},pressEnter:function(){t.filters[r.dataIndex]=o[0],t.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){t.filters[r.dataIndex]=o[0],t.fetch()}}},[t._v(" Search ")])],1)}},{key:"filterIcon",fn:function(t){return a("a-icon",{style:{color:t?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(e){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*e).toString(16)}},[t._v(" "+t._s(e)+" ")])],1)}},{key:"switchRender",fn:function(e,n,o,r){return a("span",{},[a("a-switch",{attrs:{checked:e},on:{click:function(e){return t.clickSwitch(n,r.dataIndex)}}})],1)}},{key:"valueRender",fn:function(e){return a("span",{},t._l(e.split(","),(function(e){return a("span",{key:e},[t._v(t._s(e)),a("br")])})),0)}},{key:"action",fn:function(e,n,o){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.viewRule(n)}}},[t._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(e){return t.editRule(n,o)}}},[t._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(e){return t.deleteRule(n,o)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[t._v("Delete")])],1)],1)}}])})],1)},o=[],r=a("5530"),i=(a("a434"),a("34c6")),s=a("56d7"),c=a("2084"),l="View",d="Edit",u="Create",p=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PASV ADDRESS",dataIndex:"pasv_address",key:"pasv_address",ellipsis:!0},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],f={name:"FtpRules",data:function(){return{store:s["store"],data:[],formVisible:!1,pagination:{current:1,showSizeChanger:!0,pageSize:s["store"].pageSize,onShowSizeChange:function(t,e){s["store"].pageSize=e}},filters:{},loading:!1,columns:p,form:{},formReadOnly:!1,formAction:""}},methods:{handleTableChange:function(t,e,a){var n=Object(r["a"])({},this.pagination);n.current=t.current,this.pagination=n,this.order="ascend"===a.order?"asc":"desc",this.fetch()},fetch:function(){var t=this,e=Object(r["a"])(Object(r["a"])({},this.filters),{},{page:this.pagination.current,pageSize:this.pagination.pageSize,order:this.order});this.loading=!0,Object(i["h"])(e).then((function(e){var a=e.data.result;t.data=a.data;var n=Object(r["a"])({},t.pagination);n.total=a.count,t.pagination=n,t.loading=!1})).catch((function(e){403!==e.response.status&&t.$message.error("Unknown error with status code: "+e.response.status)}))},clickSwitch:function(t,e){var a=this;t[e]=!t[e],Object(i["n"])(t).then().catch((function(t){a.$notification.error({message:"Edit failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},addRule:function(){this.form={},this.showForm(u)},viewRule:function(t){this.form=t,this.showForm(l)},editRule:function(t){this.form=JSON.parse(JSON.stringify(t)),this.showForm(d)},deleteRule:function(t,e){var a=this;Object(i["b"])(t).then((function(){a.data.splice(e,1)})).catch((function(t){a.$notification.error({message:"Error",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},showForm:function(t){this.formAction=t,this.formReadOnly=t===l,this.formVisible=!0},closeDrawer:function(){this.formVisible=!1},handleSubmit:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(i["n"])(t.form).then((function(){t.closeDrawer(),t.fetch({page:t.pagination.current}),t.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(e){t.$notification.error({message:t.formAction+" failed",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:c["a"]}},h=f,m=(a("28db"),a("2877")),g=Object(m["a"])(h,n,o,!1,null,"3db1b286",null);e["default"]=g.exports}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-b241c712.js b/frontend/dist/js/chunk-b241c712.js index 2bd3253..83eb365 100644 --- a/frontend/dist/js/chunk-b241c712.js +++ b/frontend/dist/js/chunk-b241c712.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-b241c712"],{b0c0:function(t,e,n){var i=n("83ab"),r=n("9bf2").f,s=Function.prototype,o=s.toString,a=/^\s*function ([^ (]*)/,u="name";i&&!(u in s)&&r(s,u,{configurable:!0,get:function(){try{return o.call(this).match(a)[1]}catch(t){return""}}})},ee09:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=this,n=e.$createElement,i=e._self._c||n;return i("div",[i("a-card",{staticStyle:{width:"100%"},attrs:{"tab-list":e.tabList,"active-tab-key":e.tabKey},on:{tabChange:function(e){return t.tabKey=e}}},["HTTP"===e.tabKey?i("http",{ref:"settings"}):"DNS"===e.tabKey?i("dns",{ref:"settings"}):"RMI"===e.tabKey?i("rmi",{ref:"settings"}):"MYSQL"===e.tabKey?i("mysql",{ref:"settings"}):"FTP"===e.tabKey?i("ftp",{ref:"settings"}):"NOTICE"===e.tabKey?i("notice",{ref:"settings"}):"RULES"===e.tabKey?i("rules",{ref:"settings"}):e._e()],1)],1)},r=[],s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},o=[],a=n("365c");function u(){return Object(a["a"])({url:"/setting/getPlatformConfig"})}function c(t){return Object(a["a"])({url:"/setting/updatePlatformConfig",method:"post",data:t})}function l(){return Object(a["a"])({url:"/setting/getDnsConfig"})}function f(t){return Object(a["a"])({url:"/setting/updateDnsConfig",method:"post",data:t})}function p(){return Object(a["a"])({url:"/setting/getRmiConfig"})}function g(t){return Object(a["a"])({url:"/setting/updateRmiConfig",method:"post",data:t})}function d(){return Object(a["a"])({url:"/setting/getMySQLConfig"})}function m(t){return Object(a["a"])({url:"/setting/updateMySQLConfig",method:"post",data:t})}function h(){return Object(a["a"])({url:"/setting/getFtpConfig"})}function y(t){return Object(a["a"])({url:"/setting/updateFtpConfig",method:"post",data:t})}function b(){return Object(a["a"])({url:"/setting/getNoticeConfig"})}function v(t){return Object(a["a"])({url:"/setting/updateNoticeConfig",method:"post",data:t})}var _=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a-spin",{attrs:{spinning:t.spinning}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"}},[t._l(t.form,(function(e,i){return n("a-row",{key:i,attrs:{gutter:24}},[n("a-col",{attrs:{span:24}},[n("a-form-model-item",{attrs:{label:i+":",prop:i}},["Enable"===i?n("a-switch",{attrs:{size:"large"},model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}},[n("a-icon",{attrs:{slot:"checkedChildren",type:"check"},slot:"checkedChildren"}),n("a-icon",{attrs:{slot:"unCheckedChildren",type:"close"},slot:"unCheckedChildren"})],1):"LogLevel"===i?n("a-select",{model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}},[n("a-select-option",{attrs:{value:"debug"}},[t._v("DEBUG")]),n("a-select-option",{attrs:{value:"info"}},[t._v("INFO")]),n("a-select-option",{attrs:{value:"warning"}},[t._v("WARNING")]),n("a-select-option",{attrs:{value:"error"}},[t._v("ERROR")]),n("a-select-option",{attrs:{value:"fatal"}},[t._v("FATAL")])],1):n("a-input",{attrs:{disabled:("Addr"===i||"AdminPathPrefix"===i)&&"Http"===t.parent},model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}})],1)],1)],1)})),Object.keys(t.form).length?n("a-space",{attrs:{size:"middle"}},[n("a-button",{on:{click:this.$parent.getConfig}},[t._v("Cancel")]),n("a-popconfirm",{attrs:{title:"Are you sure update the config?\n It will stop running for at least two seconds, and may fail to restart.","ok-text":"Yes","cancel-text":"No"},on:{confirm:this.$parent.updateConfig}},[n("a-button",{attrs:{type:"danger"}},[t._v("Update")])],1)],1):t._e()],2)],1)},x=[],S=(n("b0c0"),{name:"SettingForm",data:function(){return{parent:this.$parent.$options.name}},props:["form","spinning"]}),k=S,T=n("2877"),C=Object(T["a"])(k,_,x,!1,null,"43dd16a6",null),w=C.exports,O={name:"Http",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;u().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);c(this.form).then((function(){setTimeout((function(){u().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options."),t.form=n.data,t.status="",t.title="",t.subTitle=""})).catch((function(){t.status="error",t.title="Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually.",t.subTitle="Please check your config options carefully."}))}),3e3)})).catch((function(){t.status="error",t.title="Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually.",t.subTitle="Please check your config options carefully."}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},E=O,$=Object(T["a"])(E,s,o,!1,null,"1bcd3e43",null),L=$.exports,N=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},F=[],j={name:"Dns",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;l().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);f(this.form).then((function(){setTimeout((function(){l().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},P=j,R=Object(T["a"])(P,N,F,!1,null,"0be7c68c",null),J=R.exports,U=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},M=[],I={name:"Rmi",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;p().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);g(this.form).then((function(){setTimeout((function(){p().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},K=I,D=Object(T["a"])(K,U,M,!1,null,"e7491d82",null),A=D.exports,H=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},Q=[],Y={name:"Mysql",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;d().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);m(this.form).then((function(){setTimeout((function(){d().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},q=Y,z=Object(T["a"])(q,H,Q,!1,null,"8904d79a",null),G=z.exports,B=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},W=[],V={name:"Ftp",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;h().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);y(this.form).then((function(){setTimeout((function(){h().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.status="",t.title="",t.subTitle="",t.form=n.data}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},X=V,Z=Object(T["a"])(X,B,W,!1,null,"0a48f885",null),tt=Z.exports,et=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},nt=[],it={name:"Notice",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;b().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);v(this.form).then((function(){setTimeout((function(){b().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:w}},rt=it,st=Object(T["a"])(rt,et,nt,!1,null,"caed0476",null),ot=st.exports,at=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-space",{attrs:{size:"middle"}},[n("a-upload",{attrs:{name:"rules",action:"/revsuit/api/setting/importRules",showUploadList:!1},on:{change:t.handleChange}},[n("a-button",{attrs:{type:"primary",icon:"upload"}},[t._v("Import")])],1),n("a-button",{attrs:{type:"primary",icon:"download",onclick:"window.open('/revsuit/api/setting/exportRules')"}},[t._v("Export ")])],1),t.status?n("a-result",{attrs:{status:t.status,title:t.title},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},ut=[],ct={name:"Rules",data:function(){return{status:"",title:"",errors:[]}},methods:{handleChange:function(t){var e=t.file.response;"done"!==t.file.status&&"error"!==t.file.status||(e.error?this.status="warning":this.status="success",this.title=e.result,this.errors=e.error)}}},lt=ct,ft=Object(T["a"])(lt,at,ut,!1,null,"0b0f1012",null),pt=ft.exports,gt={name:"Settings",data:function(){return{tabList:[{key:"HTTP",tab:"PLATFORM|HTTP"},{key:"DNS",tab:"DNS"},{key:"RMI",tab:"RMI"},{key:"MYSQL",tab:"MYSQL"},{key:"FTP",tab:"FTP"},{key:"NOTICE",tab:"NOTICE"},{key:"RULES",tab:"RULES"}],tabKey:"HTTP"}},methods:{fetch:function(){this.$refs.settings.getConfig()}},components:{Http:L,Dns:J,Rmi:A,Mysql:G,Ftp:tt,Notice:ot,Rules:pt}},dt=gt,mt=Object(T["a"])(dt,i,r,!1,null,"7a3e107c",null);e["default"]=mt.exports}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-b241c712"],{b0c0:function(t,e,n){var i=n("83ab"),r=n("9bf2").f,s=Function.prototype,o=s.toString,a=/^\s*function ([^ (]*)/,u="name";i&&!(u in s)&&r(s,u,{configurable:!0,get:function(){try{return o.call(this).match(a)[1]}catch(t){return""}}})},ee09:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=this,n=e.$createElement,i=e._self._c||n;return i("div",[i("a-card",{staticStyle:{width:"100%"},attrs:{"tab-list":e.tabList,"active-tab-key":e.tabKey},on:{tabChange:function(e){return t.tabKey=e}}},["HTTP"===e.tabKey?i("http",{ref:"settings"}):"DNS"===e.tabKey?i("dns",{ref:"settings"}):"RMI"===e.tabKey?i("rmi",{ref:"settings"}):"LDAP"===e.tabKey?i("ldap",{ref:"settings"}):"MYSQL"===e.tabKey?i("mysql",{ref:"settings"}):"FTP"===e.tabKey?i("ftp",{ref:"settings"}):"NOTICE"===e.tabKey?i("notice",{ref:"settings"}):"RULES"===e.tabKey?i("rules",{ref:"settings"}):e._e()],1)],1)},r=[],s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},o=[],a=n("365c");function u(){return Object(a["a"])({url:"/setting/getPlatformConfig"})}function c(t){return Object(a["a"])({url:"/setting/updatePlatformConfig",method:"post",data:t})}function f(){return Object(a["a"])({url:"/setting/getDnsConfig"})}function l(t){return Object(a["a"])({url:"/setting/updateDnsConfig",method:"post",data:t})}function p(){return Object(a["a"])({url:"/setting/getRmiConfig"})}function g(t){return Object(a["a"])({url:"/setting/updateRmiConfig",method:"post",data:t})}function d(){return Object(a["a"])({url:"/setting/getLdapConfig"})}function m(t){return Object(a["a"])({url:"/setting/updateLdapConfig",method:"post",data:t})}function h(){return Object(a["a"])({url:"/setting/getMySQLConfig"})}function y(t){return Object(a["a"])({url:"/setting/updateMySQLConfig",method:"post",data:t})}function b(){return Object(a["a"])({url:"/setting/getFtpConfig"})}function v(t){return Object(a["a"])({url:"/setting/updateFtpConfig",method:"post",data:t})}function _(){return Object(a["a"])({url:"/setting/getNoticeConfig"})}function x(t){return Object(a["a"])({url:"/setting/updateNoticeConfig",method:"post",data:t})}var S=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("a-spin",{attrs:{spinning:t.spinning}},[n("a-form-model",{ref:"form",attrs:{model:t.form,layout:"vertical"}},[t._l(t.form,(function(e,i){return n("a-row",{key:i,attrs:{gutter:24}},[n("a-col",{attrs:{span:24}},[n("a-form-model-item",{attrs:{label:i+":",prop:i}},["Enable"===i?n("a-switch",{attrs:{size:"large"},model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}},[n("a-icon",{attrs:{slot:"checkedChildren",type:"check"},slot:"checkedChildren"}),n("a-icon",{attrs:{slot:"unCheckedChildren",type:"close"},slot:"unCheckedChildren"})],1):"LogLevel"===i?n("a-select",{model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}},[n("a-select-option",{attrs:{value:"debug"}},[t._v("DEBUG")]),n("a-select-option",{attrs:{value:"info"}},[t._v("INFO")]),n("a-select-option",{attrs:{value:"warning"}},[t._v("WARNING")]),n("a-select-option",{attrs:{value:"error"}},[t._v("ERROR")]),n("a-select-option",{attrs:{value:"fatal"}},[t._v("FATAL")])],1):n("a-input",{attrs:{disabled:("Addr"===i||"AdminPathPrefix"===i)&&"Http"===t.parent},model:{value:t.form[i],callback:function(e){t.$set(t.form,i,e)},expression:"form[key]"}})],1)],1)],1)})),Object.keys(t.form).length?n("a-space",{attrs:{size:"middle"}},[n("a-button",{on:{click:this.$parent.getConfig}},[t._v("Cancel")]),n("a-popconfirm",{attrs:{title:"Are you sure update the config?\n It will stop running for at least two seconds, and may fail to restart.","ok-text":"Yes","cancel-text":"No"},on:{confirm:this.$parent.updateConfig}},[n("a-button",{attrs:{type:"danger"}},[t._v("Update")])],1)],1):t._e()],2)],1)},k=[],T=(n("b0c0"),{name:"SettingForm",data:function(){return{parent:this.$parent.$options.name}},props:["form","spinning"]}),C=T,w=n("2877"),O=Object(w["a"])(C,S,k,!1,null,"43dd16a6",null),L=O.exports,E={name:"Http",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;u().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);c(this.form).then((function(){setTimeout((function(){u().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options."),t.form=n.data,t.status="",t.title="",t.subTitle=""})).catch((function(){t.status="error",t.title="Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually.",t.subTitle="Please check your config options carefully."}))}),3e3)})).catch((function(){t.status="error",t.title="Updating the configuration seems to have failed, and may cause the platform to exit abnormally, please restart manually.",t.subTitle="Please check your config options carefully."}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},$=E,N=Object(w["a"])($,s,o,!1,null,"1bcd3e43",null),F=N.exports,j=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},P=[],R={name:"Dns",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;f().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);l(this.form).then((function(){setTimeout((function(){f().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},J=R,U=Object(w["a"])(J,j,P,!1,null,"0be7c68c",null),D=U.exports,K=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},M=[],A={name:"Rmi",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;p().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);g(this.form).then((function(){setTimeout((function(){p().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},I=A,H=Object(w["a"])(I,K,M,!1,null,"e7491d82",null),Q=H.exports,Y=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},q=[],z={name:"Ldap",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;d().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);m(this.form).then((function(){setTimeout((function(){d().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},G=z,B=Object(w["a"])(G,Y,q,!1,null,"f4e5141c",null),W=B.exports,V=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},X=[],Z={name:"Mysql",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;h().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);y(this.form).then((function(){setTimeout((function(){h().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},tt=Z,et=Object(w["a"])(tt,V,X,!1,null,"8904d79a",null),nt=et.exports,it=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},rt=[],st={name:"Ftp",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;b().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);v(this.form).then((function(){setTimeout((function(){b().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.status="",t.title="",t.subTitle="",t.form=n.data}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},ot=st,at=Object(w["a"])(ot,it,rt,!1,null,"0a48f885",null),ut=at.exports,ct=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("SettingForm",{attrs:{form:t.form,spinning:t.spinning}}),t.status?n("a-result",{attrs:{status:t.status,title:t.title,"sub-title":t.subTitle},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},ft=[],lt={name:"Notice",data:function(){return{form:{},spinning:!1,status:"",title:"",subTitle:"",errors:[]}},methods:{getConfig:function(){var t=this;_().then((function(e){t.form=e.data})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))},updateConfig:function(){var t=this;this.spinning=!0;var e=JSON.stringify(this.form);x(this.form).then((function(){setTimeout((function(){_().then((function(n){t.spinning=!1;var i=JSON.stringify(n.data);i!==e&&(t.status="warning",t.title="Updating the configuration seems to have failed",t.subTitle="Please check your config options carefully."),t.form=n.data,t.status="",t.title="",t.subTitle=""}))}),3e3)})).catch((function(e){t.$notification.error({message:"Error",description:e.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}},mounted:function(){this.getConfig()},components:{SettingForm:L}},pt=lt,gt=Object(w["a"])(pt,ct,ft,!1,null,"caed0476",null),dt=gt.exports,mt=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-space",{attrs:{size:"middle"}},[n("a-upload",{attrs:{name:"rules",action:"/revsuit/api/setting/importRules",showUploadList:!1},on:{change:t.handleChange}},[n("a-button",{attrs:{type:"primary",icon:"upload"}},[t._v("Import")])],1),n("a-button",{attrs:{type:"primary",icon:"download",onclick:"window.open('/revsuit/api/setting/exportRules')"}},[t._v("Export ")])],1),t.status?n("a-result",{attrs:{status:t.status,title:t.title},scopedSlots:t._u([{key:"extra",fn:function(){return[n("a-row",[n("a-col",{attrs:{span:12,offset:7}},[n("div",{staticStyle:{"text-align":"left"}},t._l(t.errors,(function(e){return n("li",{key:e},[t._v(t._s(e))])})),0)])],1)]},proxy:!0}],null,!1,2767177514)}):t._e()],1)},ht=[],yt={name:"Rules",data:function(){return{status:"",title:"",errors:[]}},methods:{handleChange:function(t){var e=t.file.response;"done"!==t.file.status&&"error"!==t.file.status||(e.error?this.status="warning":this.status="success",this.title=e.result,this.errors=e.error)}}},bt=yt,vt=Object(w["a"])(bt,mt,ht,!1,null,"0b0f1012",null),_t=vt.exports,xt={name:"Settings",data:function(){return{tabList:[{key:"HTTP",tab:"PLATFORM|HTTP"},{key:"DNS",tab:"DNS"},{key:"RMI",tab:"RMI"},{key:"LDAP",tab:"LDAP"},{key:"MYSQL",tab:"MYSQL"},{key:"FTP",tab:"FTP"},{key:"NOTICE",tab:"NOTICE"},{key:"RULES",tab:"RULES"}],tabKey:"HTTP"}},methods:{fetch:function(){this.$refs.settings.getConfig()}},components:{Http:F,Dns:D,Rmi:Q,Ldap:W,Mysql:nt,Ftp:ut,Notice:dt,Rules:_t}},St=xt,kt=Object(w["a"])(St,i,r,!1,null,"3edefbc8",null);e["default"]=kt.exports}}]); \ No newline at end of file diff --git a/frontend/dist/js/chunk-f1802c3c.js b/frontend/dist/js/chunk-f1802c3c.js index bfa3a03..88b7236 100644 --- a/frontend/dist/js/chunk-f1802c3c.js +++ b/frontend/dist/js/chunk-f1802c3c.js @@ -1 +1 @@ -(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f1802c3c"],{"5fa3":function(e,t,a){},"9520c":function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:e.addRule}},[a("a-icon",{attrs:{type:"plus"}}),e._v(" New Rule ")],1),a("a-drawer",{attrs:{title:e.formAction+" HTTP rule",width:490,visible:e.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:e.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:e.form,layout:"vertical"},on:{submit:e.handleSubmit}},[a("BasicRule",{attrs:{form:e.form,readOnly:e.formReadOnly,flagFormat:"raw message"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{rules:e.rules.response_status_code,prop:"response_status_code"}},[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Status Code "),a("a-tooltip",{attrs:{title:"Number between 100-600, or template such as ${query.varname}/${body.varname}/${header.varname}/${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"200",disabled:e.formReadOnly},model:{value:e.form.response_status_code,callback:function(t){e.$set(e.form,"response_status_code",t)},expression:"form.response_status_code"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Headers "),a("a-tooltip",{attrs:{title:"Support template such as ${query.varname}/${body.varname}/${header.varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),e._l(e.headerKeys,(function(t){return a("a-input-group",{key:t,attrs:{compact:""}},[a("a-auto-complete",{directives:[{name:"decorator",rawName:"v-decorator",value:["Header-"+t],expression:"['Header-'+headerKey,]"}],staticStyle:{width:"47%","margin-bottom":"5px"},attrs:{dataSource:e.headerSet,filterOption:e.filterOption,defaultOpen:!1,placeholder:"Header",disabled:e.formReadOnly},model:{value:e.form["Header-"+t],callback:function(a){e.$set(e.form,"Header-"+t,a)},expression:"form['Header-'+headerKey]"}}),a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Value-"+t],expression:"['Value-'+headerKey,]"}],staticStyle:{width:"53%"},attrs:{placeholder:"Value",disabled:e.formReadOnly},on:{focus:function(){!e.formReadOnly&&t===e.headerKeys[e.headerKeys.length-1]&&e.form["Header-"+t]&&e.addHeader()}},model:{value:e.form["Value-"+t],callback:function(a){e.$set(e.form,"Value-"+t,a)},expression:"form['Value-'+headerKey]"}},[a("a-icon",{staticClass:"dynamic-delete-button",attrs:{slot:"addonAfter",type:"minus-circle-o"},on:{click:function(){return e.formReadOnly?null:e.removeHeader(t)}},slot:"addonAfter"})],1)],1)}))],2)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Body "),a("a-tooltip",{attrs:{title:"Support template such as ${query.varname}/${body.varname}/${header.varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-icon",{staticClass:"full-screen-icon",attrs:{type:"fullscreen"},on:{click:function(t){e.fullScreenTextarea=!0}}}),a("a-textarea",{attrs:{placeholder:"Hello RevSuit!",readOnly:e.formReadOnly,"auto-size":{minRows:10,maxRows:30}},model:{value:e.form.response_body,callback:function(t){e.$set(e.form,"response_body",t)},expression:"form.response_body"}}),a("a-modal",{attrs:{"dialog-style":{top:"40px",bottom:"20px"},width:"80rem",visible:e.fullScreenTextarea,title:"Response Body",okText:""},on:{ok:function(t){e.fullScreenTextarea=!1},cancel:function(t){e.fullScreenTextarea=!1}}},[a("a-textarea",{staticStyle:{height:"100%"},attrs:{placeholder:"Hello RevSuit!",readOnly:e.formReadOnly,"auto-size":{minRows:e.fullScreenTextareaMinRows(),maxRows:1.5*e.fullScreenTextareaMinRows()}},model:{value:e.form.response_body,callback:function(t){e.$set(e.form,"response_body",t)},expression:"form.response_body"}})],1)],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:e.handleCancel}},[e._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:e.formReadOnly},on:{click:e.handleSubmit}},[e._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:e.columns,"data-source":e.data,loading:e.loading,pagination:e.pagination},on:{change:e.handleTableChange},scopedSlots:e._u([{key:"filterDropdown",fn:function(t){var o=t.setSelectedKeys,r=t.selectedKeys,n=(t.clearFilters,t.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:r[0]},on:{change:function(e){return o(e.target.value?[e.target.value]:[])},pressEnter:function(){e.filters[n.dataIndex]=r[0],e.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){e.filters[n.dataIndex]=r[0],e.fetch()}}},[e._v(" Search ")])],1)}},{key:"filterIcon",fn:function(e){return a("a-icon",{style:{color:e?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(t){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*t).toString(16)}},[e._v(" "+e._s(t)+" ")])],1)}},{key:"switchRender",fn:function(t,o,r,n){return a("span",{},[a("a-switch",{attrs:{checked:t},on:{click:function(t){return e.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"action",fn:function(t,o,r){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.viewRule(o)}}},[e._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.editRule(o,r)}}},[e._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(t){return e.deleteRule(o,r)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[e._v("Delete")])],1)],1)}}])})],1)},r=[],n=a("5530"),s=(a("a434"),a("fb6a"),a("34c6")),i=a("56d7"),l=a("2084"),c="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={response_status_code:[{validator:function(e,t,a){return void 0===t||!isNaN(t)&&1001&&this.headerKeys.splice(this.headerKeys.indexOf(e),1)},filterOption:function(e,t){return t.componentOptions.children[0].text.toUpperCase().indexOf(e.toUpperCase())>=0},handleSubmit:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var a={},o={};for(var r in e.form)if(0===r.indexOf("Header-")){var n=r.substr("Header-".length);e.form["Value-"+n]&&(o[e.form[r]]=e.form["Value-"+n])}else-1===r.indexOf("Value-")&&(a[r]=e.form[r]);a.response_headers=o,Object(s["m"])(a).then((function(){e.closeDrawer(),e.fetch({page:e.pagination.current}),e.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(t){e.$notification.error({message:e.formAction+" failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()},fullScreenTextareaMinRows:function(){return document.body.clientHeight/window.getComputedStyle(document.body)["fontSize"].slice(0,-2)*.5}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:l["a"]}},m=h,y=(a("f003"),a("2877")),g=Object(y["a"])(m,o,r,!1,null,"b1cc51ba",null);t["default"]=g.exports},f003:function(e,t,a){"use strict";a("5fa3")}}]); \ No newline at end of file +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f1802c3c"],{"5fa3":function(e,t,a){},"9520c":function(e,t,a){"use strict";a.r(t);var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("a-button",{attrs:{id:"add-rule",type:"primary"},on:{click:e.addRule}},[a("a-icon",{attrs:{type:"plus"}}),e._v(" New Rule ")],1),a("a-drawer",{attrs:{title:e.formAction+" HTTP rule",width:490,visible:e.formVisible,"body-style":{paddingBottom:"80px"}},on:{close:e.closeDrawer}},[a("a-form-model",{ref:"form",attrs:{model:e.form,layout:"vertical"},on:{submit:e.handleSubmit}},[a("BasicRule",{attrs:{form:e.form,readOnly:e.formReadOnly,flagFormat:"raw message"}}),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",{attrs:{rules:e.rules.response_status_code,prop:"response_status_code"}},[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Status Code "),a("a-tooltip",{attrs:{title:"Number between 100-600, or template such as ${query.varname}/${body.varname}/${header.varname}/${flag}/${custom_varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-input",{staticStyle:{width:"100%"},attrs:{placeholder:"200",disabled:e.formReadOnly},model:{value:e.form.response_status_code,callback:function(t){e.$set(e.form,"response_status_code",t)},expression:"form.response_status_code"}})],1)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Headers "),a("a-tooltip",{attrs:{title:"Support template such as ${query.varname}/${body.varname}/${header.varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),e._l(e.headerKeys,(function(t){return a("a-input-group",{key:t,attrs:{compact:""}},[a("a-auto-complete",{directives:[{name:"decorator",rawName:"v-decorator",value:["Header-"+t],expression:"['Header-'+headerKey,]"}],staticStyle:{width:"47%","margin-bottom":"5px"},attrs:{dataSource:e.headerSet,filterOption:e.filterOption,defaultOpen:!1,placeholder:"Header",disabled:e.formReadOnly},model:{value:e.form["Header-"+t],callback:function(a){e.$set(e.form,"Header-"+t,a)},expression:"form['Header-'+headerKey]"}}),a("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["Value-"+t],expression:"['Value-'+headerKey,]"}],staticStyle:{width:"53%"},attrs:{placeholder:"Value",disabled:e.formReadOnly},on:{focus:function(){!e.formReadOnly&&t===e.headerKeys[e.headerKeys.length-1]&&e.form["Header-"+t]&&e.addHeader()}},model:{value:e.form["Value-"+t],callback:function(a){e.$set(e.form,"Value-"+t,a)},expression:"form['Value-'+headerKey]"}},[a("a-icon",{staticClass:"dynamic-delete-button",attrs:{slot:"addonAfter",type:"minus-circle-o"},on:{click:function(){return e.formReadOnly?null:e.removeHeader(t)}},slot:"addonAfter"})],1)],1)}))],2)],1)],1),a("a-row",{attrs:{gutter:24}},[a("a-col",{attrs:{span:24}},[a("a-form-model-item",[a("span",{attrs:{slot:"label"},slot:"label"},[e._v(" Response Body "),a("a-tooltip",{attrs:{title:"Support template such as ${query.varname}/${body.varname}/${header.varname}"}},[a("a-icon",{attrs:{type:"question-circle-o"}})],1)],1),a("a-icon",{staticClass:"full-screen-icon",attrs:{type:"fullscreen"},on:{click:function(t){e.fullScreenTextarea=!0}}}),a("a-textarea",{attrs:{placeholder:"Hello RevSuit!",readOnly:e.formReadOnly,"auto-size":{minRows:10,maxRows:30}},model:{value:e.form.response_body,callback:function(t){e.$set(e.form,"response_body",t)},expression:"form.response_body"}}),a("a-modal",{attrs:{"dialog-style":{top:"40px",bottom:"20px"},width:"80rem",visible:e.fullScreenTextarea,title:"Response Body",okText:""},on:{ok:function(t){e.fullScreenTextarea=!1},cancel:function(t){e.fullScreenTextarea=!1}}},[a("a-textarea",{staticStyle:{height:"100%"},attrs:{placeholder:"Hello RevSuit!",readOnly:e.formReadOnly,"auto-size":{minRows:e.fullScreenTextareaMinRows(),maxRows:1.5*e.fullScreenTextareaMinRows()}},model:{value:e.form.response_body,callback:function(t){e.$set(e.form,"response_body",t)},expression:"form.response_body"}})],1)],1)],1)],1)],1),a("div",{style:{position:"absolute",right:0,bottom:0,width:"100%",borderTop:"1px solid #e9e9e9",padding:"10px 16px",background:"#fff",textAlign:"right",zIndex:1}},[a("a-button",{style:{marginRight:"8px"},on:{click:e.handleCancel}},[e._v(" Cancel ")]),a("a-button",{attrs:{type:"primary",disabled:e.formReadOnly},on:{click:e.handleSubmit}},[e._v(" Submit ")])],1)],1),a("a-table",{staticStyle:{"overflow-x":"auto"},attrs:{columns:e.columns,"data-source":e.data,loading:e.loading,pagination:e.pagination},on:{change:e.handleTableChange},scopedSlots:e._u([{key:"filterDropdown",fn:function(t){var o=t.setSelectedKeys,r=t.selectedKeys,n=(t.clearFilters,t.column);return a("div",{staticStyle:{padding:"8px"}},[a("a-input",{staticStyle:{width:"188px","margin-bottom":"8px",display:"block"},attrs:{placeholder:"Search "+n.dataIndex,value:r[0]},on:{change:function(e){return o(e.target.value?[e.target.value]:[])},pressEnter:function(){e.filters[n.dataIndex]=r[0],e.fetch()}}}),a("a-button",{staticStyle:{width:"90px","margin-right":"8px"},attrs:{type:"primary",icon:"search",size:"small"},on:{click:function(){e.filters[n.dataIndex]=r[0],e.fetch()}}},[e._v(" Search ")])],1)}},{key:"filterIcon",fn:function(e){return a("a-icon",{style:{color:e?"#108ee9":void 0},attrs:{type:"search"}})}},{key:"rank",fn:function(t){return a("span",{},[a("a-tag",{attrs:{color:"#"+(2996213+80*t).toString(16)}},[e._v(" "+e._s(t)+" ")])],1)}},{key:"switchRender",fn:function(t,o,r,n){return a("span",{},[a("a-switch",{attrs:{checked:t},on:{click:function(t){return e.clickSwitch(o,n.dataIndex)}}})],1)}},{key:"action",fn:function(t,o,r){return a("span",{},[a("a-button",{staticStyle:{color:"#67C23A","background-color":"transparent","border-color":"#67C23A","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.viewRule(o)}}},[e._v("View")]),a("a-button",{staticStyle:{color:"#909399","background-color":"transparent","border-color":"#909399","text-shadow":"none",margin:"0 10px 3px 0"},attrs:{size:"small",ghost:""},on:{click:function(t){return e.editRule(o,r)}}},[e._v("Edit")]),a("a-popconfirm",{attrs:{title:"Are you sure delete this task?","ok-text":"Yes","cancel-text":"No"},on:{confirm:function(t){return e.deleteRule(o,r)}}},[a("a-button",{attrs:{type:"danger",size:"small",ghost:""}},[e._v("Delete")])],1)],1)}}])})],1)},r=[],n=a("5530"),s=(a("a434"),a("fb6a"),a("34c6")),i=a("56d7"),l=a("2084"),c="View",d="Edit",u="Create",f=[{title:"ID",dataIndex:"id",key:"id",sorter:!0,sortDirections:["descend","ascend"]},{title:"NAME",dataIndex:"name",key:"name",scopedSlots:{filterDropdown:"filterDropdown",filterIcon:"filterIcon"}},{title:"FLAG FORMAT",dataIndex:"flag_format",key:"flag_format",ellipsis:!0},{title:"RANK",dataIndex:"rank",key:"rank",scopedSlots:{customRender:"rank"}},{title:"PUSH TO CLIENT",dataIndex:"push_to_client",key:"push_to_client",scopedSlots:{customRender:"switchRender"}},{title:"NOTICE",dataIndex:"notice",key:"notice",scopedSlots:{customRender:"switchRender"}},{title:"Action",key:"action",scopedSlots:{customRender:"action"}}],p={response_status_code:[{validator:function(e,t,a){return void 0===t||!isNaN(t)&&1001&&this.headerKeys.splice(this.headerKeys.indexOf(e),1)},filterOption:function(e,t){return t.componentOptions.children[0].text.toUpperCase().indexOf(e.toUpperCase())>=0},handleSubmit:function(){var e=this;this.$refs.form.validate((function(t){if(!t)return!1;var a={},o={};for(var r in e.form)if(0===r.indexOf("Header-")){var n=r.substr("Header-".length);e.form["Value-"+n]&&(o[e.form[r]]=e.form["Value-"+n])}else-1===r.indexOf("Value-")&&(a[r]=e.form[r]);a.response_headers=o,Object(s["o"])(a).then((function(){e.closeDrawer(),e.fetch({page:e.pagination.current}),e.$notification.info({message:"Success",style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:2.5})})).catch((function(t){e.$notification.error({message:e.formAction+" failed",description:t.response.data.error,style:{width:"600px",marginLeft:"".concat(-265,"px")},duration:4})}))}))},handleCancel:function(){this.form={},this.closeDrawer()},fullScreenTextareaMinRows:function(){return document.body.clientHeight/window.getComputedStyle(document.body)["fontSize"].slice(0,-2)*.5}},mounted:function(){this.fetch({page:"1"})},components:{BasicRule:l["a"]}},m=h,y=(a("f003"),a("2877")),g=Object(y["a"])(m,o,r,!1,null,"b1cc51ba",null);t["default"]=g.exports},f003:function(e,t,a){"use strict";a("5fa3")}}]); \ No newline at end of file diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 04f0b1e..17b968c 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -21,6 +21,9 @@ RMI Logs + + Ldap Logs + MySQL Logs @@ -39,6 +42,9 @@ RMI Rules + + Ldap Rules + MySQL Rules diff --git a/frontend/src/api/record.js b/frontend/src/api/record.js index 4ebbb2e..cc9dd54 100644 --- a/frontend/src/api/record.js +++ b/frontend/src/api/record.js @@ -66,6 +66,22 @@ export function deleteRmiRecord(params) { }) } +export function getLdapRecord(params) { + return request({ + url: '/record/ldap', + params: params, + method: 'get' + }) +} + +export function deleteLdapRecord(params) { + return request({ + url: '/record/ldap', + params: params, + method: 'delete' + }) +} + export function getFtpRecord(params) { return request({ url: '/record/ftp', diff --git a/frontend/src/api/rule.js b/frontend/src/api/rule.js index 322b2f1..5e15466 100644 --- a/frontend/src/api/rule.js +++ b/frontend/src/api/rule.js @@ -97,6 +97,30 @@ export function deleteRmiRule(data) { }) } +export function getLdapRule(params) { + return request({ + url: '/rule/ldap', + params: params, + method: 'get' + }) +} + +export function upsertLdapRule(data) { + return request({ + url: '/rule/ldap', + data: data, + method: 'post' + }) +} + +export function deleteLdapRule(data) { + return request({ + url: '/rule/ldap', + data: data, + method: 'delete' + }) +} + export function getFtpRule(params) { return request({ url: '/rule/ftp', diff --git a/frontend/src/api/settings.js b/frontend/src/api/settings.js index 74a52eb..7514097 100644 --- a/frontend/src/api/settings.js +++ b/frontend/src/api/settings.js @@ -42,6 +42,20 @@ export function updateRmiConfig(data) { }) } +export function getLdapConfig() { + return request({ + url: '/setting/getLdapConfig', + }) +} + +export function updateLdapConfig(data) { + return request({ + url: '/setting/updateLdapConfig', + method: "post", + data: data, + }) +} + export function getMySQLConfig() { return request({ url: '/setting/getMySQLConfig', diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 83b72a3..3a52108 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -30,6 +30,11 @@ const routes = [ name: 'RmiLogs', component: () => import( '../views/logs/Rmi') }, + { + path: '/logs/ldap', + name: 'LdapLogs', + component: () => import( '../views/logs/Ldap') + }, { path: '/logs/ftp', name: 'FtpLogs', @@ -56,6 +61,11 @@ const routes = [ name: 'RmiRules', component: () => import( '../views/rules/Rmi') }, + { + path: '/rules/ldap', + name: 'LdapRules', + component: () => import( '../views/rules/Ldap') + }, { path: '/rules/ftp', name: 'FtpRules', diff --git a/frontend/src/views/logs/Ldap.vue b/frontend/src/views/logs/Ldap.vue new file mode 100644 index 0000000..40bed0f --- /dev/null +++ b/frontend/src/views/logs/Ldap.vue @@ -0,0 +1,173 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/rules/Ldap.vue b/frontend/src/views/rules/Ldap.vue new file mode 100644 index 0000000..4058dd6 --- /dev/null +++ b/frontend/src/views/rules/Ldap.vue @@ -0,0 +1,327 @@ + + + \ No newline at end of file diff --git a/frontend/src/views/settings/Ldap.vue b/frontend/src/views/settings/Ldap.vue new file mode 100644 index 0000000..48300ec --- /dev/null +++ b/frontend/src/views/settings/Ldap.vue @@ -0,0 +1,102 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/views/settings/Settings.vue b/frontend/src/views/settings/Settings.vue index 91082fa..428b6e1 100644 --- a/frontend/src/views/settings/Settings.vue +++ b/frontend/src/views/settings/Settings.vue @@ -8,6 +8,7 @@ + @@ -20,6 +21,7 @@ import Http from "./Http" import Dns from "./Dns" import Rmi from "./Rmi" +import Ldap from "./Ldap" import Mysql from "./Mysql" import Ftp from "./Ftp" import Notice from "./Notice" @@ -33,6 +35,7 @@ export default { {key: "HTTP", tab: "PLATFORM|HTTP"}, {key: "DNS", tab: "DNS"}, {key: "RMI", tab: "RMI"}, + {key: "LDAP", tab: "LDAP"}, {key: "MYSQL", tab: "MYSQL"}, {key: "FTP", tab: "FTP"}, {key: "NOTICE", tab: "NOTICE"}, @@ -51,6 +54,7 @@ export default { Http, Dns, Rmi, + Ldap, Mysql, Ftp, Notice, diff --git a/internal/cli/config.tpl.yaml b/internal/cli/config.tpl.yaml index 95601ae..d9b8b62 100644 --- a/internal/cli/config.tpl.yaml +++ b/internal/cli/config.tpl.yaml @@ -1,4 +1,4 @@ -version: 1.3 +version: 1.4 addr: :10000 token: domain: @@ -19,6 +19,9 @@ dns: rmi: enable: true addr: :1099 +ldap: + enable: true + addr: :1389 mysql: enable: true addr: :3306 diff --git a/pkg/dns/rule.go b/pkg/dns/rule.go index 6bd8061..fdad931 100644 --- a/pkg/dns/rule.go +++ b/pkg/dns/rule.go @@ -101,10 +101,7 @@ func ListRules(c *gin.Context) { } db := database.DB.Model(&dnsRule) - if dnsRule.Name != "" { - db.Where("name = ?", dnsRule.Name) - } - db.Count(&count) + db.Where(&dnsRule).Count(&count) page, err := strconv.Atoi(c.Query("page")) if err != nil { @@ -138,10 +135,7 @@ func ListRules(c *gin.Context) { // UpsertRules creates or updates dns rule from user submit func UpsertRules(c *gin.Context) { - var ( - dnsRule Rule - update bool - ) + var dnsRule Rule if err := c.ShouldBind(&dnsRule); err != nil { c.JSON(400, gin.H{ @@ -152,10 +146,6 @@ func UpsertRules(c *gin.Context) { return } - if dnsRule.ID != 0 { - update = true - } - if err := dnsRule.CreateOrUpdate(); err != nil { c.JSON(400, gin.H{ "status": "failed", @@ -165,7 +155,7 @@ func UpsertRules(c *gin.Context) { return } - if update { + if dnsRule.ID != 0 { log.Trace("DNS rule[id:%d] has been updated", dnsRule.ID) } else { log.Trace("DNS rule[id:%d] has been created", dnsRule.ID) diff --git a/pkg/ftp/ftp.go b/pkg/ftp/ftp.go index 53ad647..9b0c3c6 100644 --- a/pkg/ftp/ftp.go +++ b/pkg/ftp/ftp.go @@ -395,10 +395,10 @@ func (s *Server) Run() { } }() - for s.Enable { + for { tcpConn, err := listener.Accept() if err != nil { - if !strings.Contains(err.Error(), net.ErrClosed.Error()) { + if !errors.Is(err, net.ErrClosed) { log.Warn("FTP accept connection error: %v", err) } else { break diff --git a/pkg/ftp/rule.go b/pkg/ftp/rule.go index da75bbb..ca6dcc3 100644 --- a/pkg/ftp/rule.go +++ b/pkg/ftp/rule.go @@ -96,10 +96,7 @@ func ListRules(c *gin.Context) { } db := database.DB.Model(&ftpRule) - if ftpRule.Name != "" { - db.Where("name = ?", ftpRule.Name) - } - db.Count(&count) + db.Where(&ftpRule).Count(&count) page, err := strconv.Atoi(c.Query("page")) if err != nil { @@ -133,10 +130,7 @@ func ListRules(c *gin.Context) { // UpsertRules creates or updates ftp rule from user submit func UpsertRules(c *gin.Context) { - var ( - ftpRule Rule - update bool - ) + var ftpRule Rule if err := c.ShouldBind(&ftpRule); err != nil { c.JSON(400, gin.H{ @@ -147,10 +141,6 @@ func UpsertRules(c *gin.Context) { return } - if ftpRule.ID != 0 { - update = true - } - if err := ftpRule.CreateOrUpdate(); err != nil { c.JSON(400, gin.H{ "status": "failed", @@ -160,7 +150,7 @@ func UpsertRules(c *gin.Context) { return } - if update { + if ftpRule.ID != 0 { log.Trace("FTP rule[id:%d] has been updated", ftpRule.ID) } else { log.Trace("FTP rule[id:%d] has been created", ftpRule.ID) diff --git a/pkg/ldap/config.go b/pkg/ldap/config.go new file mode 100644 index 0000000..042bc7a --- /dev/null +++ b/pkg/ldap/config.go @@ -0,0 +1,6 @@ +package ldap + +type Config struct { + Enable bool + Addr string +} diff --git a/pkg/ldap/ldap.go b/pkg/ldap/ldap.go new file mode 100644 index 0000000..a0dc4b1 --- /dev/null +++ b/pkg/ldap/ldap.go @@ -0,0 +1,197 @@ +package ldap + +import ( + "bytes" + "net" + "sync" + "time" + + "github.com/li4n0/revsuit/internal/database" + "github.com/li4n0/revsuit/internal/ipinfo" + "github.com/li4n0/revsuit/internal/recycler" + "github.com/pkg/errors" + log "unknwon.dev/clog/v2" +) + +type Server struct { + Config + rules []*Rule + rulesLock sync.RWMutex + livingLock sync.Mutex +} + +var ( + server *Server + once sync.Once +) + +func GetServer() *Server { + once.Do(func() { + server = &Server{rulesLock: sync.RWMutex{}, livingLock: sync.Mutex{}} + }) + return server +} + +func (s *Server) getRules() []*Rule { + defer s.rulesLock.RUnlock() + s.rulesLock.RLock() + return s.rules +} + +func (s *Server) UpdateRules() error { + db := database.DB.Model(new(Rule)) + defer s.rulesLock.Unlock() + s.rulesLock.Lock() + return errors.Wrap(db.Order("base_rank desc").Find(&s.rules).Error, "LDAP update rules error") +} + +func (s *Server) handleConnection(conn net.Conn) { + defer func() { + _ = conn.Close() + if err := recover(); err != nil { + recycler.Recycle(err) + } + }() + + if err := conn.SetDeadline(time.Now().Add(time.Second * 30)); err != nil { + log.Warn("LDAP set connection deadline error:%v", err) + return + } + + ip, _, _ := net.SplitHostPort(conn.RemoteAddr().String()) + + buf := make([]byte, 1024) + _, err := conn.Read(buf) + if err != nil { + log.Warn("LDAP read connection error:%v", err) + return + } + + if !bytes.Contains(buf, []byte{ + 0x30, 0x0c, 0x02, 0x01, 0x01, 0x60, 0x07, + 0x02, 0x01, 0x03, 0x04, 0x00, 0x80, 0x00}) { + return + } + + send := []byte{ + 0x30, 0x0c, 0x02, 0x01, 0x01, 0x61, 0x07, + 0x0a, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, + } + _, err = conn.Write(send) + if err != nil { + log.Warn("LDAP write connection error: %v", err) + return + } + _, err = conn.Read(buf) + if err != nil { + log.Warn("LDAP read connection error:%v", err) + return + } + + length := buf[8] + pathBytes := bytes.Buffer{} + for i := 1; i <= int(length); i++ { + temp := []byte{buf[8+i]} + pathBytes.Write(temp) + } + path := pathBytes.String() + + for _, _rule := range s.getRules() { + flag, flagGroup, _ := _rule.Match(path) + if flag == "" { + continue + } + + area := ipinfo.Area(ip) + + // create new record + r, err := NewRecord(_rule, flag, path, ip, area) + if err != nil { + log.Warn("LDAP record[rule_id:%d] created failed :%s", _rule.ID, err) + return + } + log.Info("LDAP record[id:%d rule:%s remote_ip:%s] has been created", r.ID, _rule.Name, ip) + + //only send to client when this connection recorded first time. + if _rule.PushToClient { + if flagGroup != "" { + var count int64 + database.DB.Where("rule_name=? and path like ?", _rule.Name, "%"+flagGroup+"%").Model(&Record{}).Count(&count) + if count <= 1 { + r.PushToClient() + log.Trace("LDAP record[id:%d, flagGroup:%s] has been put to client message queue", r.ID, flagGroup) + } + } else { + r.PushToClient() + log.Trace("LDAP record[id:%d, flag:%s] has been put to client message queue", r.ID, flag) + } + } + + //send notice + if _rule.Notice { + go func() { + r.Notice() + log.Trace("LDAP record[id:%d] notice has been sent", r.ID) + }() + } + return + } +} + +func (s *Server) Stop() { + log.Info("LDAP Server is stopping...") + s.Enable = false + s.livingLock.Unlock() +} + +func (s *Server) Restart() { + s.Stop() + time.Sleep(time.Second * 2) + go s.Run() +} + +func (s *Server) Run() { + s.Enable = true + s.livingLock.Lock() + defer func() { + if s.Enable { + log.Error("LDAP Server exited unexpectedly") + } + s.Enable = false + s.livingLock.Unlock() + }() + + if err := s.UpdateRules(); err != nil { + log.Error(err.Error()) + return + } + + // run server + log.Info("Starting LDAP Server at %v", s.Addr) + + listener, err := net.Listen("tcp", s.Addr) + if err != nil { + log.Error(err.Error()) + return + } + + go func() { + s.livingLock.Lock() + if !s.Enable { + _ = listener.Close() + } + }() + + for { + tcpConn, err := listener.Accept() + if err != nil { + if !errors.Is(err, net.ErrClosed) { + log.Warn("LDAP accept connection error: %v", err) + } else { + break + } + continue + } + go s.handleConnection(tcpConn) + } +} diff --git a/pkg/ldap/record.go b/pkg/ldap/record.go new file mode 100644 index 0000000..88690fc --- /dev/null +++ b/pkg/ldap/record.go @@ -0,0 +1,139 @@ +package ldap + +import ( + "net/http" + "strconv" + "time" + + "github.com/gin-gonic/gin" + "github.com/li4n0/revsuit/internal/database" + "github.com/li4n0/revsuit/internal/notice" + "github.com/li4n0/revsuit/internal/record" + "gorm.io/gorm" + log "unknwon.dev/clog/v2" +) + +var _ record.Record = (*Record)(nil) + +type Record struct { + Path string `form:"path" json:"path"` + record.BaseRecord + Rule Rule `gorm:"foreignKey:RuleName;references:Name;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" form:"-" json:"-" notice:"-"` +} + +func (Record) TableName() string { + return "ldap_records" +} + +func (r Record) Notice() { + notice.Notice(r) +} + +func NewRecord(rule *Rule, flag, path, ip, area string) (r *Record, err error) { + r = &Record{ + BaseRecord: record.BaseRecord{ + Flag: flag, + RemoteIP: ip, + IpArea: area, + RequestTime: time.Now(), + }, + Path: path, + Rule: *rule, + } + return r, database.DB.Create(r).Error +} + +func Records(c *gin.Context) { + var ( + ldapRecord Record + res []Record + count int64 + order = c.Query("order") + pageSize = 10 + ) + + if c.Query("pageSize") != "" { + if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { + if n > 0 && n < 100 { + pageSize = n + } + } + } + + if err := c.ShouldBind(&ldapRecord); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "result": nil, + }) + return + } + + db := database.DB.Model(&ldapRecord) + if ldapRecord.Flag != "" { + db.Where("flag = ?", ldapRecord.Flag) + } + if ldapRecord.Path != "" { + db.Where("path like ?", "%"+ldapRecord.Path+"%") + } + if ldapRecord.RemoteIP != "" { + db.Where("remote_ip = ?", ldapRecord.RemoteIP) + } + if ldapRecord.RuleName != "" { + db.Where("rule_name = ?", ldapRecord.RuleName) + } + + //Delete records + if c.Request.Method == http.MethodDelete { + if err := db.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&res).Error; err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + if database.Driver == database.Sqlite { + db.Exec("VACUUM") + } + + c.JSON(200, gin.H{ + "status": "succeed", + "error": nil, + }) + + log.Info("%d ldap records deleted by %s", db.RowsAffected, c.Request.RemoteAddr) + return + } + + //List records + page, err := strconv.Atoi(c.Query("page")) + if err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "result": nil, + }) + return + } + + if order != "asc" { + order = "desc" + } + + if err := db.Order("id" + " " + order).Count(&count).Offset((page - 1) * pageSize).Limit(pageSize).Find(&res).Error; err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + c.JSON(200, gin.H{ + "status": "succeed", + "error": nil, + "result": gin.H{"count": count, "data": res}, + }) +} diff --git a/pkg/ldap/rule.go b/pkg/ldap/rule.go new file mode 100644 index 0000000..fb84e48 --- /dev/null +++ b/pkg/ldap/rule.go @@ -0,0 +1,192 @@ +package ldap + +import ( + "strconv" + + "github.com/gin-gonic/gin" + "github.com/li4n0/revsuit/internal/database" + "github.com/li4n0/revsuit/internal/rule" + "gorm.io/gorm/clause" + log "unknwon.dev/clog/v2" +) + +// Rule LDAP rule struct +type Rule struct { + rule.BaseRule `yaml:",inline"` +} + +func (Rule) TableName() string { + return "ldap_rules" +} + +// NewRule new ldap rule struct +func NewRule(name, flagFormat string, pushToClient, notice bool) *Rule { + return &Rule{ + BaseRule: rule.BaseRule{ + Name: name, + FlagFormat: flagFormat, + PushToClient: pushToClient, + Notice: notice, + }, + } +} + +// CreateOrUpdate creates or updates the ldap rule in database and ruleSet +func (r *Rule) CreateOrUpdate() (err error) { + db := database.DB.Model(r) + err = db.Clauses(clause.OnConflict{ + Columns: []clause.Column{{Name: "id"}}, + DoUpdates: clause.AssignmentColumns( + []string{ + "name", + "flag_format", + "base_rank", + "push_to_client", + "notice", + }), + }).Create(r).Error + if err != nil { + return + } + + err = GetServer().UpdateRules() + return err +} + +// Delete deletes the ldap rule in database and ruleSet +func (r *Rule) Delete() (err error) { + db := database.DB.Model(r) + err = db.Delete(r).Error + if err != nil { + return + } + + err = GetServer().UpdateRules() + return err +} + +// ListRules lists all ldap rules those satisfy the filter +func ListRules(c *gin.Context) { + var ( + ldapRule Rule + res []Rule + count int64 + order = c.Query("order") + pageSize = 10 + ) + + if c.Query("pageSize") != "" { + if n, err := strconv.Atoi(c.Query("pageSize")); err == nil { + if n > 0 && n < 100 { + pageSize = n + } + } + } + + if err := c.ShouldBind(&ldapRule); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "result": nil, + }) + return + } + + db := database.DB.Model(&ldapRule) + db.Where(&ldapRule).Count(&count) + + page, err := strconv.Atoi(c.Query("page")) + if err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "result": nil, + }) + return + } + + if order != "asc" { + order = "desc" + } + + if err := db.Order("base_rank desc").Order("id" + " " + order).Count(&count).Offset((page - 1) * pageSize).Limit(pageSize).Find(&res).Error; err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + c.JSON(200, gin.H{ + "status": "succeed", + "error": nil, + "result": gin.H{"count": count, "data": res}, + }) +} + +// UpsertRules creates or updates ldap rule from user submit +func UpsertRules(c *gin.Context) { + var ldapRule Rule + + if err := c.ShouldBind(&ldapRule); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + if err := ldapRule.CreateOrUpdate(); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "result": nil, + }) + return + } + + if ldapRule.ID != 0 { + log.Trace("LDAP rule[id:%d] has been updated", ldapRule.ID) + } else { + log.Trace("LDAP rule[id:%d] has been created", ldapRule.ID) + } + + c.JSON(200, gin.H{ + "status": "succeed", + "error": nil, + "result": nil, + }) +} + +// DeleteRules deletes ldap rule from user submit +func DeleteRules(c *gin.Context) { + var ldapRule Rule + + if err := c.ShouldBind(&ldapRule); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + if err := ldapRule.Delete(); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + log.Trace("LDAP rule[id:%d] has been deleted", ldapRule.ID) + + c.JSON(200, gin.H{ + "status": "succeed", + "error": nil, + "data": nil, + }) +} diff --git a/pkg/mysql/rule.go b/pkg/mysql/rule.go index 939436f..8c15f5c 100644 --- a/pkg/mysql/rule.go +++ b/pkg/mysql/rule.go @@ -84,10 +84,7 @@ func ListRules(c *gin.Context) { } db := database.DB.Model(&mysqlRule) - if mysqlRule.Name != "" { - db.Where("name = ?", mysqlRule.Name) - } - db.Count(&count) + db.Where(&mysqlRule).Count(&count) page, err := strconv.Atoi(c.Query("page")) if err != nil { @@ -121,10 +118,7 @@ func ListRules(c *gin.Context) { // UpsertRules create or update mysql rule from user submit func UpsertRules(c *gin.Context) { - var ( - mysqlRule Rule - update bool - ) + var mysqlRule Rule if err := c.ShouldBind(&mysqlRule); err != nil { c.JSON(400, gin.H{ @@ -135,10 +129,6 @@ func UpsertRules(c *gin.Context) { return } - if mysqlRule.ID != 0 { - update = true - } - if err := mysqlRule.CreateOrUpdate(); err != nil { c.JSON(400, gin.H{ "status": "failed", @@ -148,7 +138,7 @@ func UpsertRules(c *gin.Context) { return } - if update { + if mysqlRule.ID != 0 { log.Trace("MySQL rule[id:%d] has been updated", mysqlRule.ID) } else { log.Trace("MySQL rule[id:%d] has been created", mysqlRule.ID) diff --git a/pkg/rhttp/rule.go b/pkg/rhttp/rule.go index 818f3cf..223e8be 100644 --- a/pkg/rhttp/rule.go +++ b/pkg/rhttp/rule.go @@ -102,10 +102,7 @@ func ListRules(c *gin.Context) { } db := database.DB.Model(&httpRule) - if httpRule.Name != "" { - db.Where("name = ?", httpRule.Name) - } - db.Count(&count) + db.Where(&httpRule).Count(&count) page, err := strconv.Atoi(c.Query("page")) if err != nil { @@ -139,10 +136,7 @@ func ListRules(c *gin.Context) { // UpsertRules create or update http rule from user submit func UpsertRules(c *gin.Context) { - var ( - httpRule Rule - update bool - ) + var httpRule Rule if err := c.ShouldBind(&httpRule); err != nil { c.JSON(400, gin.H{ @@ -153,10 +147,6 @@ func UpsertRules(c *gin.Context) { return } - if httpRule.ID != 0 { - update = true - } - if err := httpRule.CreateOrUpdate(); err != nil { c.JSON(400, gin.H{ "status": "failed", @@ -166,7 +156,7 @@ func UpsertRules(c *gin.Context) { return } - if update { + if httpRule.ID != 0 { log.Trace("HTTP rule[id:%d] has been updated", httpRule.ID) } else { log.Trace("HTTP rule[id:%d] has been created", httpRule.ID) diff --git a/pkg/rmi/rmi.go b/pkg/rmi/rmi.go index 6f67b58..2d6a50e 100644 --- a/pkg/rmi/rmi.go +++ b/pkg/rmi/rmi.go @@ -191,10 +191,10 @@ func (s *Server) Run() { } }() - for s.Enable { + for { tcpConn, err := listener.Accept() if err != nil { - if !strings.Contains(err.Error(), net.ErrClosed.Error()) { + if !errors.Is(err, net.ErrClosed) { log.Warn("RMI accept connection error: %v", err) } else { break diff --git a/pkg/rmi/rule.go b/pkg/rmi/rule.go index e9d3cd3..f19c473 100644 --- a/pkg/rmi/rule.go +++ b/pkg/rmi/rule.go @@ -93,10 +93,7 @@ func ListRules(c *gin.Context) { } db := database.DB.Model(&rmiRule) - if rmiRule.Name != "" { - db.Where("name = ?", rmiRule.Name) - } - db.Count(&count) + db.Where(&rmiRule).Count(&count) page, err := strconv.Atoi(c.Query("page")) if err != nil { @@ -130,10 +127,7 @@ func ListRules(c *gin.Context) { // UpsertRules creates or updates rmi rule from user submit func UpsertRules(c *gin.Context) { - var ( - rmiRule Rule - update bool - ) + var rmiRule Rule if err := c.ShouldBind(&rmiRule); err != nil { c.JSON(400, gin.H{ @@ -144,10 +138,6 @@ func UpsertRules(c *gin.Context) { return } - if rmiRule.ID != 0 { - update = true - } - if err := rmiRule.CreateOrUpdate(); err != nil { c.JSON(400, gin.H{ "status": "failed", @@ -157,7 +147,7 @@ func UpsertRules(c *gin.Context) { return } - if update { + if rmiRule.ID != 0 { log.Trace("RMI rule[id:%d] has been updated", rmiRule.ID) } else { log.Trace("RMI rule[id:%d] has been created", rmiRule.ID) diff --git a/pkg/server/config.go b/pkg/server/config.go index e7d9d13..b07b150 100644 --- a/pkg/server/config.go +++ b/pkg/server/config.go @@ -4,6 +4,7 @@ import ( "github.com/li4n0/revsuit/internal/ipinfo" "github.com/li4n0/revsuit/pkg/dns" "github.com/li4n0/revsuit/pkg/ftp" + "github.com/li4n0/revsuit/pkg/ldap" "github.com/li4n0/revsuit/pkg/mysql" "github.com/li4n0/revsuit/pkg/rhttp" "github.com/li4n0/revsuit/pkg/rmi" @@ -31,5 +32,6 @@ type Config struct { DNS dns.Config MySQL mysql.Config RMI rmi.Config + LDAP ldap.Config FTP ftp.Config } diff --git a/pkg/server/router.go b/pkg/server/router.go index 6354c91..328b73a 100644 --- a/pkg/server/router.go +++ b/pkg/server/router.go @@ -10,6 +10,7 @@ import ( "github.com/li4n0/revsuit/internal/file" "github.com/li4n0/revsuit/pkg/dns" "github.com/li4n0/revsuit/pkg/ftp" + "github.com/li4n0/revsuit/pkg/ldap" "github.com/li4n0/revsuit/pkg/mysql" "github.com/li4n0/revsuit/pkg/rhttp" "github.com/li4n0/revsuit/pkg/rmi" @@ -69,6 +70,8 @@ func (revsuit *Revsuit) registerHttpRouter() { settingsGroup.POST("/updateDnsConfig", revsuit.updateDnsConfig) settingsGroup.GET("/getRmiConfig", revsuit.getRmiConfig) settingsGroup.POST("/updateRmiConfig", revsuit.updateRmiConfig) + settingsGroup.GET("/getLdapConfig", revsuit.getLdapConfig) + settingsGroup.POST("/updateLdapConfig", revsuit.updateLdapConfig) settingsGroup.GET("/getMySQLConfig", revsuit.getMySQLConfig) settingsGroup.POST("/updateMySQLConfig", revsuit.updateMySQLConfig) settingsGroup.GET("/getFtpConfig", revsuit.getFtpConfig) @@ -95,6 +98,10 @@ func (revsuit *Revsuit) registerHttpRouter() { rmiGroup.GET("", rmi.Records) rmiGroup.DELETE("", rmi.Records) + ldapGroup := recordGroup.Group("/ldap") + ldapGroup.GET("", ldap.Records) + ldapGroup.DELETE("", ldap.Records) + ftpGroup := recordGroup.Group("/ftp") ftpGroup.GET("", ftp.Records) ftpGroup.DELETE("", ftp.Records) @@ -122,6 +129,11 @@ func (revsuit *Revsuit) registerHttpRouter() { rmiGroup.POST("", rmi.UpsertRules) rmiGroup.DELETE("", rmi.DeleteRules) + ldapGroup = ruleGroup.Group("/ldap") + ldapGroup.GET("", ldap.ListRules) + ldapGroup.POST("", ldap.UpsertRules) + ldapGroup.DELETE("", ldap.DeleteRules) + ftpGroup = ruleGroup.Group("/ftp") ftpGroup.GET("", ftp.ListRules) ftpGroup.POST("", ftp.UpsertRules) diff --git a/pkg/server/server.go b/pkg/server/server.go index 2967117..b5cbc28 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -11,6 +11,7 @@ import ( "github.com/li4n0/revsuit/internal/record" "github.com/li4n0/revsuit/pkg/dns" "github.com/li4n0/revsuit/pkg/ftp" + "github.com/li4n0/revsuit/pkg/ldap" "github.com/li4n0/revsuit/pkg/mysql" http "github.com/li4n0/revsuit/pkg/rhttp" "github.com/li4n0/revsuit/pkg/rmi" @@ -28,6 +29,7 @@ type Revsuit struct { dns *dns.Server mysql *mysql.Server rmi *rmi.Server + ldap *ldap.Server ftp *ftp.Server clients map[int]*gin.Context @@ -66,55 +68,35 @@ func initDatabase(dsn string) { log.Fatal(err.Error()) } - err = database.DB.AutoMigrate(&http.Record{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&dns.Record{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&mysql.Record{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&http.Rule{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&dns.Rule{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&mysql.Rule{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&file.MySQLFile{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&rmi.Record{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&rmi.Rule{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&ftp.Record{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&ftp.Rule{}) - if err != nil { - log.Fatal(err.Error()) - } - err = database.DB.AutoMigrate(&file.FTPFile{}) + err = database.DB.AutoMigrate(&http.Record{}, &http.Rule{}) if err != nil { log.Fatal(err.Error()) } + err = database.DB.AutoMigrate(&dns.Record{}, &dns.Rule{}) + if err != nil { + log.Fatal(err.Error()) + } + + err = database.DB.AutoMigrate(&mysql.Record{}, &mysql.Rule{}, &file.MySQLFile{}) + if err != nil { + log.Fatal(err.Error()) + } + + err = database.DB.AutoMigrate(&rmi.Record{}, &rmi.Rule{}) + if err != nil { + log.Fatal(err.Error()) + } + + err = database.DB.AutoMigrate(&ldap.Record{}, &ldap.Rule{}) + if err != nil { + log.Fatal(err.Error()) + } + + err = database.DB.AutoMigrate(&ftp.Record{}, &ftp.Rule{}, &file.FTPFile{}) + if err != nil { + log.Fatal(err.Error()) + } } func initLog(level string) (logLevel log.Level) { @@ -198,6 +180,9 @@ func New(c *Config) *Revsuit { s.rmi = rmi.GetServer() s.rmi.Config = c.RMI + s.ldap = ldap.GetServer() + s.ldap.Config = c.LDAP + s.ftp = ftp.GetServer() s.ftp.Config = c.FTP @@ -232,6 +217,9 @@ func (revsuit *Revsuit) Run() { if revsuit.rmi != nil && revsuit.rmi.Enable { go revsuit.rmi.Run() } + if revsuit.ldap != nil && revsuit.ldap.Enable { + go revsuit.ldap.Run() + } if revsuit.mysql != nil && revsuit.mysql.Enable { go revsuit.mysql.Run() } diff --git a/pkg/server/settings.go b/pkg/server/settings.go index 6819494..5160c33 100644 --- a/pkg/server/settings.go +++ b/pkg/server/settings.go @@ -9,6 +9,7 @@ import ( "github.com/li4n0/revsuit/internal/database" "github.com/li4n0/revsuit/pkg/dns" "github.com/li4n0/revsuit/pkg/ftp" + "github.com/li4n0/revsuit/pkg/ldap" "github.com/li4n0/revsuit/pkg/mysql" "github.com/li4n0/revsuit/pkg/rhttp" "github.com/li4n0/revsuit/pkg/rmi" @@ -22,6 +23,7 @@ type Rules struct { Dns []dns.Rule Mysql []mysql.Rule Rmi []rmi.Rule + Ldap []ldap.Rule Ftp []ftp.Rule } @@ -35,6 +37,7 @@ func exportRules(c *gin.Context) { db.Model(&dns.Rule{}).Find(&rules.Dns) db.Model(&mysql.Rule{}).Find(&rules.Mysql) db.Model(&rmi.Rule{}).Find(&rules.Rmi) + db.Model(&rmi.Rule{}).Find(&rules.Ldap) db.Model(&ftp.Rule{}).Find(&rules.Ftp) out, err := yaml.Marshal(rules) @@ -88,7 +91,7 @@ func (revsuit *Revsuit) importRules(c *gin.Context) { for _, rule := range rules.Http { if err := db.Model(&rhttp.Rule{}).Create(&rule).Error; err != nil { - errs = append(errs, errors.Wrap(err, fmt.Sprintf("http rule[%s]", rule.Name)).Error()) + errs = append(errs, errors.Wrapf(err, "http rule[%s]", rule.Name).Error()) continue } count++ @@ -99,7 +102,7 @@ func (revsuit *Revsuit) importRules(c *gin.Context) { for _, rule := range rules.Dns { if err := db.Model(&dns.Rule{}).Create(&rule).Error; err != nil { - errs = append(errs, errors.Wrap(err, fmt.Sprintf("dns rule[%s]", rule.Name)).Error()) + errs = append(errs, errors.Wrapf(err, "dns rule[%s]", rule.Name).Error()) continue } count++ @@ -110,7 +113,7 @@ func (revsuit *Revsuit) importRules(c *gin.Context) { for _, rule := range rules.Mysql { if err := db.Model(&mysql.Rule{}).Create(&rule).Error; err != nil { - errs = append(errs, errors.Wrap(err, fmt.Sprintf("mysql rule[%s]", rule.Name)).Error()) + errs = append(errs, errors.Wrapf(err, "mysql rule[%s]", rule.Name).Error()) continue } count++ @@ -121,7 +124,7 @@ func (revsuit *Revsuit) importRules(c *gin.Context) { for _, rule := range rules.Rmi { if err := db.Model(&rmi.Rule{}).Create(&rule).Error; err != nil { - errs = append(errs, errors.Wrap(err, fmt.Sprintf("rmi rule[%s]", rule.Name)).Error()) + errs = append(errs, errors.Wrapf(err, "rmi rule[%s]", rule.Name).Error()) continue } count++ @@ -130,9 +133,20 @@ func (revsuit *Revsuit) importRules(c *gin.Context) { errs = append(errs, err.Error()) } + for _, rule := range rules.Ldap { + if err := db.Model(&ldap.Rule{}).Create(&rule).Error; err != nil { + errs = append(errs, errors.Wrapf(err, "ldap rule[%s]", rule.Name).Error()) + continue + } + count++ + } + if err := revsuit.ldap.UpdateRules(); err != nil { + errs = append(errs, err.Error()) + } + for _, rule := range rules.Ftp { if err := db.Model(&ftp.Rule{}).Create(&rule).Error; err != nil { - errs = append(errs, errors.Wrap(err, fmt.Sprintf("ftp rule[%s]", rule.Name)).Error()) + errs = append(errs, errors.Wrapf(err, "ftp rule[%s]", rule.Name).Error()) continue } count++ @@ -381,6 +395,42 @@ func (revsuit *Revsuit) updateRmiConfig(c *gin.Context) { } } +func (revsuit *Revsuit) getLdapConfig(c *gin.Context) { + c.JSON(200, revsuit.ldap.Config) +} + +func (revsuit *Revsuit) updateLdapConfig(c *gin.Context) { + var form = ldap.Config{} + + if err := c.ShouldBindJSON(&form); err != nil { + c.JSON(400, gin.H{ + "status": "failed", + "error": err.Error(), + "data": nil, + }) + return + } + + if form.Addr != revsuit.ldap.Addr { + revsuit.ldap.Addr = form.Addr + log.Info("Update ldap config [addr] to %s", form.Addr) + } + + if form.Enable != revsuit.ldap.Enable { + log.Info("Update ldap config [enable] to %v", form.Enable) + if form.Enable { + go revsuit.ldap.Run() + } else { + revsuit.ldap.Stop() + } + return + } + + if revsuit.ldap.Enable { + revsuit.ldap.Restart() + } +} + func (revsuit *Revsuit) getNoticeConfig(c *gin.Context) { c.JSON(200, revsuit.config.Notice) }