1 line
19 KiB
JavaScript
1 line
19 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{1717:function(t,e,r){"use strict";r.r(e);var n=r(3828),i=r(2059);for(var a in i)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(a);r(3157);var s=r(0),o=r(3159),l=r.n(o),u=Object(s.a)(i.default,n.a,n.b,!1,null,"248f2d61",null);"function"==typeof l.a&&l()(u),e.default=u.exports},1881:function(t,e,r){"use strict";r(7),r(10),r(6),r(8),r(11);var n=r(1);Object.defineProperty(e,"__esModule",{value:!0}),e.unblock=e.block=e.unskip=e.skip=e.getBlockList=e.getSkipList=e.getUserList=e.getIpList=e.getGeneralList=e.getIpInfo=e.getDefaults=void 0,r(57),r(5),r(110),r(17),r(96);var i=n(r(2)),a=n(r(78));function s(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 o(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){(0,i.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l="/CMD_BRUTE_FORCE_MONITOR",u=function(t,e){return a.default.get(o({id:t,url:l},e))},c=function(t,e){return a.default.post({url:l,params:{action:t},schema:e})},f=u("BFM_DEFAULTS",{params:{seek_value:"-1"},after:function(t){return t.flow(t.project({logsize:"BRUTE_LOG_SIZE",userLimit:"USER_LIMIT",ipLimit:"IP_LIMIT",logScanning:"LOG_SCANNING",subjects:"SUBJECT_SELECT",defaultSubject:"SUBJECT_SELECT","scripts.block":"HAVE_BLOCK_SH","scripts.unblock":"HAVE_UNBLOCK_SH","scripts.show_blocked_ips":"HAVE_SHOW_BLOCKED_IPS_SH"}),t.mapProps({logScanning:t.convert.toAppBoolean,subjects:t.toSelect,defaultSubject:t.flow(t.find(t.getProp("selected")),t.getProp("value")),scripts:t.mapValues(t.isEqual("1"))}))}});e.getDefaults=f;var p=u("BFM_IPINFO",{schema:{ipinfo:a.default.REQUIRED_STRING},after:function(t){return t.flow(t.project({ip:"BLOCK_IP",data:"info"}),t.mapProp("data",t.flow(t.convert.toLines,t.filter(t.notEmpty))))}});e.getIpInfo=p;var d=u("BFM_GENERAL_LIST",{params:{show:"LOGINFAILURES"},pagination:!0,schema:{filter:a.default.OPTIONAL_STRING,value:a.default.OPTIONAL_STRING},before:function(t){var e=t.filter,r=t.value,n={};if(t.sort||(n.sort1="-1"),e){var i="ip"===e?2:3;n["comparison".concat(i)]="equals",n["value".concat(i)]=r}return n},after:function(t){return t.flow(t.project({rows:"LOGINFAILURES"}),t.processTableInfo("rows"),t.mapProp("rows",t.toArray),t.mapProp("rows",t.mapArray((function(t){return o(o({},t),{},{date:new Date(Number(t.id.slice(0,13))),index:Number(t.id.slice(13))})}))))}});e.getGeneralList=d;var v=u("BFM_IPLIST",{params:{show:"IPLOGINFAILURES",sort1:-2},pagination:!0,after:function(t){return t.flow(t.project({rows:"IPLOGINFAILURES"}),t.processTableInfo("rows"),t.mapProp("rows",t.flow(t.toArray,t.mapArray(t.project({ip:"ip",failures:"login_failures",first:"first_entry",last:"last_entry",notified:"notified",blocked:"blocked"})),t.mapArrayProps({first:t.convert.toAppDate,last:t.convert.toAppDate,notified:t.isEqual("Yes"),blocked:t.isEqual("Yes")}))))}});e.getIpList=v;var b=u("BFM_USER_LIST",{params:{show:"USERLOGINFAILURES",sort1:-2},pagination:!0,after:function(t){return t.flow(t.project({rows:"USERLOGINFAILURES"}),t.processTableInfo("rows"),t.mapProp("rows",t.flow(t.toArray,t.mapArrayProps({first_entry:t.convert.toAppDate,last_entry:t.convert.toAppDate,notified:t.isEqual("Yes")}))))}});e.getUserList=b;var m=u("BFM_SKIP_LIST",{params:{show:"SKIPLIST"},pagination:!0,after:function(t){return t.flow(t.project({rows:"SKIPLIST"}),t.processTableInfo("rows"),t.mapProp("rows",t.flow(t.toArray,t.mapArray(t.flow(t.moveProp("when","date"),t.mapProp("date",t.convert.toAppDate))))))}});e.getSkipList=m;var _=u("BFM_BLOCK_LIST",{params:{show:"BLOCKED_IPS"},pagination:!0,after:function(t){return t.flow(t.project({rows:"BLOCKED_IPS"}),t.processTableInfo("rows"),t.mapProp("rows",t.toArray),t.mapProp("rows",t.mapArray(t.deleteProp("ip_info"),t.mapProp("date_blocked",t.convert.toAppDate))))}});e.getBlockList=_;var g={type:Array,required:!1},h=a.default.OPTIONAL_STRING,I=c("skiplist",{ip:g,user:g,comments:h,skip_value:h});e.skip=I;var k=c("remove_from_skiplist",{select:a.default.ROWS});e.unskip=k;var O=c("block_ips",{ip:g,user:g});e.block=O;var w=c("unblock",{ip:a.default.ROWS});e.unblock=w},1882:function(t,e,r){"use strict";r.r(e);var n=r(1883),i=r.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);e.default=i.a},1883:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,r(26),r(5);var n={api:[{command:r(1881).getDefaults,bind:{"response.scripts":"scripts"}}],props:{id:{type:String,required:!0},filter:{type:Object,required:!1}},methods:{changeTab:function(t){var e=this,r="general"===t?"admin/brute-force-monitor":"admin/brute-force-monitor/".concat(t);r!==this.$route.name&&(this.$router.push({name:r}),this.$nextTick((function(){e.$refs.tabs.dataCurrentTab=e.id})))}},computed:{filterMessage:function(){if(this.filter){if("ip"===this.filter.filter)return this.$gettextInterpolate(this.$gettext("List filtered by IP: %{ ip }"),{ip:this.filter.value});if("user"===this.filter.filter)return this.$gettextInterpolate(this.$gettext("List filtered by User: %{ user } "),{user:this.filter.value})}return this.$gettext("Select IP address or User to filter results")},headers:function(){var t=[{id:"general",label:this.$gettext("Failed Logins"),desc:this.filterMessage},{id:"ip_list",label:this.$gettext("Failed Logins: IP list"),desc:this.$gettext("Select IP to filter results")},{id:"user_list",label:this.$gettext("Failed logins: Usernames List"),desc:this.$gettext("Select username to filter results")},{id:"skip_list",label:this.$gettext("Skip List"),desc:this.$gettext("Skipped IPs / Users")}];return this.$api.scripts.show_blocked_ips&&t.push({id:"block_list",label:this.$gettext("Block List"),desc:this.$gettext("View / Delete Blocked IPs")}),t}}};e.default=n},1896:function(t,e,r){"use strict";r.r(e);var n=r(1897),i=r.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);e.default=i.a},1897:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={api:[{command:r(1881).getIpInfo,bind:"ipinfo"}]};e.default=n},1922:function(t,e,r){"use strict";r.r(e);var n=r(1930),i=r(1882);for(var a in i)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(a);var s=r(0),o=Object(s.a)(i.default,n.a,n.b,!1,null,null,null);e.default=o.exports},1930:function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n=function(){var t=this.$createElement,e=this._self._c||t;return e("app-page-section",[e("ui-tabs",{ref:"tabs",attrs:{selected:this.id,tabs:this.headers},on:{"update:selected":this.changeTab}},[e("div",{attrs:{slot:"tab:"+this.id},slot:"tab:"+this.id},[this._t("default")],2)])],1)},i=[]},1932:function(t,e,r){var n=r(2003);n.__esModule&&(n=n.default),"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);(0,r(4).default)("4be4e6a8",n,!0,{})},1942:function(t,e,r){"use strict";r.r(e);var n=r(1943),i=r.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);e.default=i.a},1943:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={props:{subject:{type:String,required:!0}}};e.default=n},1944:function(t,e,r){"use strict";r.r(e);var n=r(1945),i=r.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);e.default=i.a},1945:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r(1881),i={props:{select:{type:Array,required:!0,default:function(){return[]}}},methods:{submit:function(){(0,n.skip)({ip:this.select})}}};e.default=i},2001:function(t,e,r){"use strict";r.r(e);var n=r(2023),i=r(1896);for(var a in i)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(a);r(2002);var s=r(0),o=Object(s.a)(i.default,n.a,n.b,!1,null,"2a2fd384",null);e.default=o.exports},2002:function(t,e,r){"use strict";r(1932)},2003:function(t,e,r){},2023:function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("ui-dialog",{attrs:{id:"SHOW_IPINFO_DIALOG",size:"normal"}},[r("translate",{attrs:{slot:"title","translate-params":{ip:t.$api.ipinfo.ip}},slot:"title"},[t._v("\n IP Info: %{ ip }\n ")]),t._v(" "),r("div",{attrs:{slot:"content"},slot:"content"},[r("h2",{staticClass:"ip"},[t._v("\n "+t._s(t.$api.ipinfo.ip)+"\n ")]),t._v(" "),r("ol",{staticClass:"ipinfo"},t._l(t.$api.ipinfo.data,(function(e,n){return e?r("li",{staticClass:"line"},[r("span",{staticClass:"line-content"},[t._v("\n "+t._s(e)+"\n ")])]):t._e()})),0)])],1)},i=[]},2059:function(t,e,r){"use strict";r.r(e);var n=r(2060),i=r.n(n);for(var a in n)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(a);e.default=i.a},2060:function(t,e,r){"use strict";r(7),r(10),r(6),r(8),r(11);var n=r(1);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(r(36));r(5),r(17);var a=n(r(37)),s=n(r(2)),o=r(1881),l=n(r(1922)),u=n(r(2001)),c=n(r(2061)),f=n(r(2062));function p(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 d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){(0,s.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v,b=function(t){var e=t.ip,r=t.user;return e?{filter:"ip",value:e}:r?{filter:"user",value:r}:{}},m={preload:[o.getDefaults,function(t){return(0,o.getGeneralList)(b(t))}],api:[{command:o.getDefaults,bind:"defaults"}],commands:{getGeneralList:o.getGeneralList},components:{Tabs:l.default,IpinfoDialog:u.default,BlockDialog:c.default,SkipIpsDialog:f.default},data:function(){return{seek:"500000",select:[]}},computed:{filter:function(){return b(this.$route.query)},requestData:function(){return d(d({},this.filter),{},{seek_value:"-".concat(this.seek)})}},watch:{$route:function(t,e){t.query.ip===e.query.ip&&t.query.user===e.query.user||this.updateTable()}},methods:{updateTable:function(){this.$refs.table.reloadTable()},validateSeek:function(t){return!(t=Number(t))||t>0&&t<this.$api.defaults.logsize},showIPInfo:(v=(0,a.default)(i.default.mark((function t(e){return i.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,o.getIpInfo)({ipinfo:e});case 2:this.$dialog("SHOW_IPINFO_DIALOG").open();case 3:case"end":return t.stop()}}),t,this)}))),function(t){return v.apply(this,arguments)}),requestBlockIP:function(t){this.select=[t],this.$dialog("BLOCK_DIALOG").open()},requestSkipIP:function(t){this.select=[t],this.$dialog("ADD_IPS_TO_SKIP_LIST").open()},blockIPs:function(){(0,o.block)({ip:this.select}).then(this.$reloadApiTable)}}};e.default=m},2061:function(t,e,r){"use strict";r.r(e);var n=r(2838),i=r(1942);for(var a in i)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(a);var s=r(0),o=Object(s.a)(i.default,n.a,n.b,!1,null,null,null);e.default=o.exports},2062:function(t,e,r){"use strict";r.r(e);var n=r(2839),i=r(1944);for(var a in i)["default"].indexOf(a)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(a);var s=r(0),o=Object(s.a)(i.default,n.a,n.b,!1,null,null,null);e.default=o.exports},2838:function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("ui-dialog",{attrs:{id:"BLOCK_DIALOG",theme:"danger"}},[r("translate",{attrs:{slot:"title","translate-params":{subject:t.subject}},slot:"title"},[t._v("\n Block %{ subject }\n ")]),t._v(" "),r("translate",{attrs:{slot:"content","translate-params":{subject:t.subject}},slot:"content"},[t._v("\n Are you sure you want to block selected %{ subject }?\n ")]),t._v(" "),r("ui-button",{attrs:{slot:"buttons",theme:"danger"},on:{click:function(e){return t.$emit("block")}},slot:"buttons"},[r("translate",[t._v("Block")])],1)],1)},i=[]},2839:function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n=function(){var t=this.$createElement,e=this._self._c||t;return e("ui-dialog",{attrs:{id:"ADD_IPS_TO_SKIP_LIST",theme:"danger"}},[e("translate",{attrs:{slot:"title"},slot:"title"},[this._v("Add to skip list")]),this._v(" "),e("translate",{attrs:{slot:"content","translate-n":this.select.length,"translate-plural":"Are you sure you want to add selected IPs to skip list?"},slot:"content"},[this._v("\n Are you sure you want to add selected IP to skip list?\n ")]),this._v(" "),e("ui-button",{attrs:{slot:"buttons",theme:"danger"},on:{click:this.submit},slot:"buttons"},[e("translate",[this._v("\n Add\n ")])],1)],1)},i=[]},2855:function(t,e,r){var n=r(3158);n.__esModule&&(n=n.default),"string"==typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);(0,r(4).default)("3c82b14c",n,!0,{})},3157:function(t,e,r){"use strict";r(2855)},3158:function(t,e,r){},3159:function(t,e){},3828:function(t,e,r){"use strict";r.d(e,"a",(function(){return n})),r.d(e,"b",(function(){return i}));var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("app-page",{attrs:{id:"brute-force-monitor"}},[r("tabs",t._b({attrs:{id:"general"}},"tabs",{filter:t.filter},!1),[r("ui-form-element",{attrs:{vertical:""}},[r("div",{directives:[{name:"flex",rawName:"v-flex",value:{dir:t.$_Client.isPhone?"column":"row",cross:t.$_Client.isPhone?"start":"center",main:"between"},expression:"{\n dir: $_Client.isPhone\n ? 'column'\n : 'row',\n cross: $_Client.isPhone\n ? 'start'\n : 'center',\n main: 'between'\n }"}],attrs:{slot:"content"},slot:"content"},[r("translate",{attrs:{"translate-params":{log:"brute_log_entries.list",size:t.$options.filters.humanReadableSize(t.$api.defaults.logsize,1024)}}},[t._v("\n %{ log } is %{ size }\n ")]),t._v(" "),r("div",{directives:[{name:"flex",rawName:"v-flex",value:{dir:t.$_Client.isPhone?"column":"row"},expression:"{\n dir: $_Client.isPhone\n ? 'column'\n : 'row',\n }"}]},[r("div",{directives:[{name:"flex",rawName:"v-flex",value:{dir:"column"},expression:"{ dir: 'column' }"}]},[r("input-radio",{attrs:{value:"0"},model:{value:t.seek,callback:function(e){t.seek=e},expression:"seek"}},[r("translate",[t._v("Show whole file")])],1),t._v(" "),r("input-radio",{attrs:{value:!0,model:"0"!==t.seek},on:{change:function(e){t.seek=""}}},[r("translate",[t._v("\n Custom number of bytes from the end of the file\n ")])],1)],1),t._v(" "),r("transition",{attrs:{name:"fade"}},[r("ui-form-element",{attrs:{vertical:"",group:"seek",validators:{required:!0,validateSeek:t.validateSeek}}},[r("div",{directives:[{name:"flex",rawName:"v-flex",value:{main:"end"},expression:"{ main: 'end' }"},{name:"margin",rawName:"v-margin",value:[0,1],expression:"[0, 1]"}],attrs:{slot:"content"},slot:"content"},["0"!==t.seek?r("input-text",{attrs:{number:""},model:{value:t.seek,callback:function(e){t.seek=e},expression:"seek"}}):t._e()],1),t._v(" "),r("translate",{attrs:{slot:"error:validateSeek","translate-params":{size:t.$options.filters.humanReadableSize(t.$api.defaults.logsize,1024)}},slot:"error:validateSeek"},[t._v("\n Seek should be smaller than %{ size }\n ")])],1)],1),t._v(" "),r("ui-button",{directives:[{name:"margin",rawName:"v-margin",value:[,,,1],expression:"[,,,1]"}],attrs:{theme:"safe",size:"normal","validate-group":"seek"},on:{click:t.updateTable}},[r("translate",[t._v("Update List")])],1)],1)],1)]),t._v(" "),r("ui-api-table",t._b({ref:"table",attrs:{"disable-select":""},scopedSlots:t._u([{key:"col:id",fn:function(e){var r=e.date,n=e.index;return[t._v("\n "+t._s(t._f("date")(r))+" ("+t._s(n+1)+")\n ")]}},{key:"col:ip",fn:function(e){var n=e.ip;return r("ui-hoverable-tooltip",{attrs:{position:"right",theme:"dark"}},[r("ui-link",{attrs:{slot:"toggle"},slot:"toggle"},[t._v("\n "+t._s(n)+"\n ")]),t._v(" "),r("div",{directives:[{name:"flex",rawName:"v-flex",value:{dir:"column"},expression:"{ dir: 'column' }"}],attrs:{slot:"content"},slot:"content"},[r("ui-link",{directives:[{name:"margin",rawName:"v-margin",value:[.5,1],expression:"[.5, 1]"}],staticClass:"wrap:nowrap",attrs:{name:"admin/brute-force-monitor",query:{ip:n}}},[r("translate",[t._v("Filter IP")])],1),t._v(" "),r("ui-link",{directives:[{name:"margin",rawName:"v-margin",value:[.5,1],expression:"[.5, 1]"}],staticClass:"wrap:nowrap",on:{click:function(e){return t.showIPInfo(n)}}},[r("translate",[t._v("IP Info")])],1),t._v(" "),t.$api.defaults.scripts.block?r("ui-link",{directives:[{name:"margin",rawName:"v-margin",value:[.5,1],expression:"[.5, 1]"}],staticClass:"wrap:nowrap",on:{click:function(e){return t.requestBlockIP(n)}}},[r("translate",[t._v("Block IP")])],1):t._e(),t._v(" "),r("ui-link",{directives:[{name:"margin",rawName:"v-margin",value:[.5,1],expression:"[.5, 1]"}],staticClass:"wrap:nowrap",on:{click:function(e){return t.requestSkipIP(n)}}},[r("translate",[t._v("Skip IP")])],1)],1)],1)}},{key:"col:user",fn:function(e){var n=e.user;return r("ui-link",{attrs:{name:"admin/brute-force-monitor",query:{user:n}},domProps:{textContent:t._s(n)}})}}])},"ui-api-table",{command:t.$commands.getGeneralList,rowID:"id",columns:{id:{label:t.$gettext("ID")},ip:{label:t.$gettext("IP")},user:{label:t.$gettext("User")},attempts:{label:t.$gettext("Attempts")},filter:{label:t.$gettext("Filter")},log_entry:{label:t.$gettext("Log Entry"),grow:!0}},initialSort:{key:"id",order:"DESC"},requestData:t.requestData,verticalLayout:t.$_Client.isPhone},!1),[t._v(" "),t._v(" "),t._v(" "),t.filter.filter?r("ui-button-link",{attrs:{slot:"buttons:before",name:"admin/brute-force-monitor",theme:"light",size:"normal",icon:"close"},slot:"buttons:before"},[r("translate",[t._v("Clear Filter")])],1):t._e()],1)],1),t._v(" "),r("ipinfo-dialog"),t._v(" "),r("skip-ips-dialog",t._b({},"skip-ips-dialog",{select:t.select},!1)),t._v(" "),r("block-dialog",{attrs:{subject:t.$ngettext("IP Address","IP Addresses",t.select.length)},on:{block:t.blockIPs}})],1)},i=[]}}]); |