File: /www/server/panel/BTPanel/static/js/page11.js
import{_ as Z,b as H,P as tt,k as pt,an as ut,aa as _t,t as B,J as E,w as dt,f as ft}from"./utils-lib.js?v=1777008528";import{D as mt}from"./index431.js?v=1777008528";import{c as x,x as d,y as m,A as g,B as S,N as W,G as A,r as w,e as i,w as et,C as h,z as f,D as M,bT as ht,aJ as bt,O as gt,P as yt,F as vt,aT as xt,v as wt}from"./base-lib.js?v=1777008528";import{f as kt,s as Ct}from"./site-list.js?v=1777008528";import{h as at,o as Tt}from"./use-log-detail.js?v=1777008528";import{ad as Dt,ae as Lt,j as Rt,af as $t,g as It}from"./index432.js?v=1777008528";import{c as U,f as J}from"./constants.js?v=1777008528";import{_ as z}from"./index109.js?v=1777008528";import{u as ot,b as Pt}from"./hooks2.js?v=1777008528";import{u as L}from"./column.js?v=1777008528";const St={class:"stat-card"},Ot={key:0,class:"h-[50px] flex items-center justify-between px-6 font-bold text-secondary border-b border-solid border-[var(--el-border-color-lighter)]"},Bt={class:"p-[20px]"},Et=x({__name:"stat-card",props:{title:{default:""}},setup(e){return(t,a)=>(d(),m("div",St,[e.title||t.$slots.extra?(d(),m("div",Ot,[g("span",null,S(e.title),1),W(t.$slots,"extra",{},void 0,!0)])):A("",!0),g("div",Bt,[W(t.$slots,"default",{},void 0,!0)])]))}}),V=Z(Et,[["__scopeId","data-v-6df4da2d"]]);function Ut(e,t){return(e!=null?e:[]).map(a=>{var o,n,s,c,u;return{id:(o=a.id)!=null?o:"",time:(n=a.time_localtime)!=null?n:"",ip:t,server:(s=a.server_name)!=null?s:"",uri:(c=a.uri)!=null?c:"",type:(u=a.filter_rule)!=null?u:"",location:U({ip_country:a.ip_country,ip_subdivisions:a.ip_subdivisions,ip_city:a.ip_city})}})}function Vt(e){return(e!=null?e:[]).map(t=>{var a,o,n,s,c,u;return{id:(a=t.id)!=null?a:"",time:(o=t.time_localtime)!=null?o:"",ip:(n=t.ip)!=null?n:"",server:(s=t.server_name)!=null?s:"",uri:(c=t.uri)!=null?c:"",type:(u=t.filter_rule)!=null?u:"",location:U({ip_country:t.ip_country,ip_subdivisions:t.ip_subdivisions,ip_city:t.ip_city})}})}async function At(e={}){var b,v,k,C,T,D,Y,q;const t=await Lt(e),a=(b=t.data)!=null?b:t,o=((v=a.type)!=null?v:[]).map(([_,l])=>({name:_,value:l})),n=o.reduce((_,l)=>_+l.value,0),s=((k=a.ip)!=null?k:[]).map(([_,l,$,I,P])=>({ip:_,count:l,country:$,province:I,city:P,location:U({ip_country:$,ip_subdivisions:I,ip_city:P}),percentage:J(l,n)})),c=((C=a.uri)!=null?C:[]).map(([_,l])=>({uri:_,count:l,percentage:J(l,n)})),u=s.slice(0,10).map(({ip:_,count:l,location:$,country:I,province:P,city:ct})=>({ip:_,count:l,location:$,country:I,province:P,city:ct})),r={};for(const[_,l]of Object.entries((T=a.ip_list)!=null?T:{}))r[_]={list:Ut(l.list,_),type:(D=l.type)!=null?D:{},uri:(Y=l.uri)!=null?Y:[]};const p={};for(const[_,l]of Object.entries((q=a.uri_list)!=null?q:{}))p[_]={ipList:Vt(l.ip_list)};return{typeList:o,ipRows:s,uriRows:c,ipRank:u,total:n,ipListMap:r,uriListMap:p}}function Mt(e){const t=e.match(/共(\d+)条/);return t?parseInt(t[1],10):0}async function jt(e){var c,u,r;const t=await Dt(e),a=(u=(c=t.data)!=null?c:t)!=null?u:{},o=(r=a.data)!=null?r:[],n=typeof a.page=="string"?Mt(a.page):o.length;return{list:o.map(p=>{var b,v,k,C,T,D;return{id:(b=p.id)!=null?b:"",time:(v=p.time_localtime)!=null?v:"",ip:(k=p.ip)!=null?k:"",server:(C=p.server_name)!=null?C:"",uri:(T=p.uri)!=null?T:"",type:(D=p.filter_rule)!=null?D:"",location:U({ip_country:p.ip_country,ip_subdivisions:p.ip_subdivisions,ip_city:p.ip_city})}}),total:n}}async function Ht(e){var o;const t=await Rt({id:e}),a=(o=t.data)!=null?o:t;return Array.isArray(a)?a[0]:a}async function zt(e){await $t({url_rule:e})}async function Ft(e){var a,o;const t=await It({path:e});return(o=(a=t.data)!=null?a:t)!=null?o:""}const j={YESTERDAY:0,TODAY:1,CUSTOM:2},F=w(1),O=w([]),nt=w([]),Nt=w(0),N=w(0),Gt=e=>[{prop:"ip",label:"攻击IP",render:t=>i("span",{class:"bt-link",onClick:()=>e(t.ip)},[t.ip])},{prop:"location",label:"IP归属地"},{prop:"count",label:"攻击次数"},{prop:"percentage",label:"攻击占比"}],Yt=e=>[{prop:"uri",label:"URI",render:t=>i("span",{class:"bt-link",onClick:()=>e(t.uri)},[t.uri])},{prop:"count",label:"攻击次数"},{prop:"percentage",label:"攻击占比"}],qt=[{prop:"time",label:"攻击时间"},{prop:"ip",label:"攻击IP"},{prop:"server",label:"被保护网站"},{prop:"uri",label:"URI"},{prop:"type",label:"保护类型"}],Wt=(e,t)=>L([{title:"拉黑",onClick:a=>t(a.ip)},{title:"详情",onClick:a=>e(a.ip)}]),Jt=(e,t)=>L([{title:"拉黑",onClick:a=>t(a.uri)},{title:"详情",onClick:a=>e(a.uri)}]),Xt=e=>L([{title:"详情",onClick:t=>e(t.id)}]),He=(e,t)=>[{prop:"time",label:"攻击时间"},{prop:"server",label:"被保护网站"},{prop:"location",label:"IP归属地"},{prop:"uri",label:"URI"},{prop:"type",label:"保护类型"},Kt(e,t)],Kt=(e,t)=>L([{title:"HTTP",onClick:a=>t(a)},{title:"详情",onClick:a=>e(a.id)}]),ze=e=>[{prop:"time",label:"攻击时间",width:135},{prop:"ip",label:"攻击IP",width:100,showOverflowTooltip:!0},{prop:"server",label:"被保护网站",width:130,showOverflowTooltip:!0},{prop:"location",label:"IP归属地",width:120},{prop:"uri",label:"URI",width:200,showOverflowTooltip:!0},{prop:"type",label:"保护类型",width:140,showOverflowTooltip:!0},Qt(e)],Qt=e=>L([{title:"详情",onClick:t=>e(t.id)}]),Zt={class:"flex-1"},te=x({__name:"ip-report",setup(e){const{mainHeight:t}=H(),a=ot({request:async()=>{const n=st();return n?{data:n.ipRows,total:n.ipRows.length}:{data:[],total:0}},columns:[...Gt(K),Wt(K,at)]});et(N,()=>{a.refresh()});const o=a.BtTable;return(n,s)=>{const c=z;return d(),m("div",Zt,[i(c,null,{content:h(()=>[i(f(o),{"max-height":f(t)-280},null,8,["max-height"])]),_:1})])}}}),ee={class:"flex-1"},ae=x({__name:"uri-report",setup(e){const{mainHeight:t}=H(),a=ot({request:async()=>{const n=st();return n?{data:n.uriRows,total:n.uriRows.length}:{data:[],total:0}},columns:[...Yt(Q),Jt(Q,de)]});et(N,()=>{a.refresh()});const o=a.BtTable;return(n,s)=>{const c=z;return d(),m("div",ee,[i(c,null,{content:h(()=>[i(f(o),{"max-height":f(t)-280},null,8,["max-height"])]),_:1})])}}}),oe={class:"flex-1"},ne=x({__name:"search-report",setup(e,{expose:t}){const{mainHeight:a}=H(),o=Pt({request:async u=>{const r=await jt(u);return{data:r.list,total:r.total}},columns:[...qt,Xt(G)]}),n=o.BtTable,s=o.BtPage;function c(u){const r=o.param.value,p=r.p||1;Object.keys(r).forEach(b=>delete r[b]),Object.assign(r,{p:1,limit:10},u),p===1&&o.refresh()}return t({setSearchParams:c}),(u,r)=>{const p=tt,b=pt,v=z;return d(),m("div",oe,[i(v,null,{"header-left":h(()=>[i(p,{type:"primary",class:"mr-4",onClick:f(fe)},{default:h(()=>[...r[0]||(r[0]=[M("拦截搜索查询",-1)])]),_:1},8,["onClick"]),i(b,{href:"https://www.bt.cn/bbs/thread-69834-1-1.html",target:"_blank",type:"primary"},{default:h(()=>[...r[1]||(r[1]=[M("查看教程",-1)])]),_:1})]),content:h(()=>[i(f(n),{"max-height":f(a)-320},null,8,["max-height"])]),"footer-right":h(()=>[i(f(s),{layout:"prev, pager, next, total"})]),_:1})])}}});let y=null;function st(){return y}const se=w(400);function ie(e){se.value=e}const it=ut({options:{title:{text:"总防护类型",textStyle:{fontSize:14},subtext:"0",subtextStyle:{fontSize:14},itemGap:10,left:"49%",top:"43%",textAlign:"center"},tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)"},legend:{show:!1},series:[{type:"pie",radius:["45%","60%"],center:["50%","50%"],label:{show:!1},emphasis:{label:{show:!0,fontSize:14,fontWeight:"bold"}},data:[]}]}}),{BtTabs:re,tabs:Fe,tabsRefs:le}=_t({type:"card",options:[{label:"IP报表",name:"ip",lazy:!0,render:te},{label:"URI报表",name:"uri",lazy:!0,render:ae},{label:"拦截搜索",name:"search",lazy:!0,render:ne}]});function X(e){const t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(a,"-").concat(o)}function rt(){const e=new Date,t=new Date(e);t.setDate(t.getDate()-1);const a=F.value;if(a===j.YESTERDAY){const n=X(t);return{start_time:n,end_time:n}}if(a===j.CUSTOM&&O.value.length===2)return{start_time:O.value[0],end_time:O.value[1]};const o=X(e);return{start_time:o,end_time:o}}async function R(){const e=rt(),t=await At(e);y=t,nt.value=t.ipRank,Nt.value=t.total,it.setOption({title:{subtext:String(t.total)},series:[{data:t.typeList.map(a=>({name:a.name,value:a.value}))}]}),N.value++}function ce(e){F.value=e}function pe(e){O.value=e,F.value=j.CUSTOM,R()}function ue(){const{start_time:e,end_time:t}=rt(),a=e&&t?"?stime=".concat(e,"&etime=").concat(t):"";window.open("/btwaf/content_report.html".concat(a))}function K(e){var a,o,n,s;const t=(a=y==null?void 0:y.ipListMap)==null?void 0:a[e];B({title:"恶意IP - 【".concat(e,"】攻击详情"),area:"930px",component:()=>E(()=>import("./ip-attack-detail.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{ip:e,logs:(o=t==null?void 0:t.list)!=null?o:[],typeData:(n=t==null?void 0:t.type)!=null?n:{},uriData:(s=t==null?void 0:t.uri)!=null?s:[],fetchLogDetail:Ht,openLogDetail:G,openHttpDetail:lt},showFooter:!1})}function Q(e){var a,o;const t=(a=y==null?void 0:y.uriListMap)==null?void 0:a[e];B({title:"被攻击的URI - 【".concat(e,"】防护记录"),area:["930px","580px"],component:()=>E(()=>import("./uri-defense-record.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{uri:e,logs:(o=t==null?void 0:t.ipList)!=null?o:[],openLogDetail:G},showFooter:!1})}async function _e(e){await at(e,R)}async function de(e){try{await dt({content:"确认将 URL ".concat(e," 加入黑名单?")}),await zt(e),ft().success("URL 已拉黑"),R()}catch(t){}}function G(e){Tt({id:e,openHttpDetail:lt})}function lt(e){var t,a;B({title:"HTTP请求详情",area:["800px","500px"],component:()=>E(()=>import("./http-detail.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{httpLog:(t=e.http_log)!=null?t:"",httpLogPath:(a=e.http_log_path)!=null?a:0,fetchHttpLogContent:Ft},showFooter:!1})}async function fe(){await kt();let e={};B({title:"拦截搜索",area:"45rem",component:()=>E(()=>import("./search-form.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),compData:{serverNames:Ct.value,onFormChange:t=>{e=t}},btn:["搜索","取消"],onConfirm:async()=>{const a=le().search;return a&&a.setSearchParams(e),!0}})}function me(){R()}const he=x({__name:"protect-type-pie",props:{chart:{}},setup(e){const t=w(null),{width:a}=ht(t);return bt(()=>{ie(a.value)}),(o,n)=>(d(),m("div",{ref_key:"containerRef",ref:t,style:{height:"220px"}},[(d(),gt(yt(e.chart)))],512))}}),be={class:"overflow-y-auto flex flex-col gap-6",style:{"min-height":"320px"}},ge={class:"flex items-center gap-4"},ye=["onClick"],ve={key:0,class:"text-[12px] text-secondary"},xe={class:"text-secondary"},we={key:0,class:"text-center text-secondary py-4"},ke=x({__name:"attack-ip-rank",props:{list:{}},emits:["block"],setup(e){function t(a){const o=[];return a.country&&o.push(a.country),a.province&&o.push(a.province),a.city&&o.push(a.city),o.join(" ")}return(a,o)=>(d(),m("div",be,[(d(!0),m(vt,null,xt(e.list,n=>(d(),m("div",{key:n.ip,class:"flex items-center justify-between text-base"},[g("div",ge,[g("span",{class:"bt-link !text-[13px]",onClick:s=>a.$emit("block",n.ip)},S(n.ip),9,ye),t(n)?(d(),m("span",ve,"( "+S(t(n))+" )",1)):A("",!0)]),g("span",xe,S(n.count)+"次",1)]))),128)),e.list.length?A("",!0):(d(),m("div",we,"暂无数据"))]))}}),Ce={class:"flex gap-4 h-full py-[1.2rem]"},Te={class:"left-panel flex flex-col gap-4"},De={class:"relative"},Le={class:"absolute right-0 top-0"},Re={class:"flex"},$e=x({__name:"page",setup(e){const t=[{label:"昨天",getValue:()=>null},{label:"今天",getValue:()=>null}];function a(o,n){ce(n),n<t.length?R():pe(o)}return wt(()=>{me()}),(o,n)=>{const s=tt;return d(),m("div",Ce,[g("div",Te,[i(V,{title:"防护类型"},{default:h(()=>[i(he,{chart:f(it).BtECharts},null,8,["chart"])]),_:1}),i(V,{title:"攻击IP排行榜"},{default:h(()=>[i(ke,{list:f(nt),onBlock:f(_e)},null,8,["list","onBlock"])]),_:1})]),i(V,{class:"right-panel flex-1 min-w-0"},{default:h(()=>[g("div",De,[i(f(re)),g("div",Le,[g("div",Re,[i(mt,{buttons:t,"default-index":1,type:"daterange",onChange:a}),i(s,{type:"primary",class:"ml-4",onClick:f(ue)},{default:h(()=>[...n[0]||(n[0]=[M("查看报告",-1)])]),_:1},8,["onClick"])])])])]),_:1})])}}}),Ie=Z($e,[["__scopeId","data-v-764a94fe"]]),Ne=Object.freeze(Object.defineProperty({__proto__:null,default:Ie},Symbol.toStringTag,{value:"Module"}));export{He as i,Ne as p,ze as u};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}