2023-08-03 18:47:18 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="detection-drawer" style="height: 100vh;overflow: scroll;padding-bottom: 90px">
|
|
|
|
|
<div class="drawer-basic">
|
|
|
|
|
<div class="drawer-basic-header">
|
|
|
|
|
<div class="drawer-basic-id">ID: {{ drawerInfo.ruleId }}</div>
|
2023-10-16 17:53:46 +08:00
|
|
|
<div :class="`detection-tag-status${drawerInfo.status}`">
|
|
|
|
|
{{ $t(switchStatus(drawerInfo.status)) }}
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('overall.name') }}</div>
|
2023-10-17 10:01:32 +08:00
|
|
|
<div class="basic-function-value">{{ $_.get(detailData, 'name', '-') || '-'}}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('overall.type') }}</div>
|
2023-10-17 10:01:32 +08:00
|
|
|
<div class="basic-function-value">{{ $_.get(detailData, 'eventType', '-') || '-'}}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-description">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('config.dataSet.description') }}</div>
|
2023-10-17 10:01:32 +08:00
|
|
|
<div class="basic-description-value">{{ $_.get(detailData, 'description', '-') || '-' }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="detection-drawer-collapse">
|
|
|
|
|
<el-collapse v-model="activeRule">
|
2023-10-16 17:53:46 +08:00
|
|
|
<el-collapse-item :title="$t('detection.ruleDefinition')" name="rule">
|
2023-08-03 18:47:18 +08:00
|
|
|
<div class="drawer-collapse-content">
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('config.user.source') }}</div>
|
2023-10-30 11:14:58 +08:00
|
|
|
<div class="basic-function-value">{{ changeCategory(detailData.category) }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-if="detailData.ruleType==='indicator_match'">
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detection.library') }}</div>
|
2023-10-17 10:01:32 +08:00
|
|
|
<span class="basic-function-value">{{ $_.get(detailData, 'ruleConfigObj.knowledgeBase.name', '-') || '-' }}</span>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detection.level') }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
<div class="detection-drawer-title">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection__icon" :style="`background-color: ${eventSeverityColor[detailData.ruleConfigObj.level]}`"></div>
|
2023-10-30 11:14:58 +08:00
|
|
|
<div class="basic-function-value">{{ changeSecurityLevel(detailData.ruleConfigObj) }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-else>
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detection.create.dimensions') }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
<span class="detection-tag-blue">{{ detailData.dimensions }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detections.filters') }}</div>
|
|
|
|
|
<span class="detection-tag-blue">Source Port</span>
|
|
|
|
|
<span style="margin: 0 6px;">{{ $t('detections.equal') }}</span><span>19890</span>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function" v-for="item in severityList" :key="item.severity"
|
|
|
|
|
style="padding-bottom: 0">
|
|
|
|
|
<div class="detection-drawer-title">
|
|
|
|
|
<div class="detection__icon" :style="`background-color: ${eventSeverityColor[item.severity]}`"></div>
|
|
|
|
|
<div>{{ toUpperCaseByString(item.severity) }}</div>
|
|
|
|
|
</div>
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detections.conditions') }}</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
<div>
|
|
|
|
|
<div class="detection-tag-gray margin-r-10">> 60 Kpackets/s</div>
|
|
|
|
|
<div class="detection-tag-gray">> 50 Unique Src IPs</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
</el-collapse>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="detection-drawer-collapse" style="margin: 20px 0">
|
|
|
|
|
<el-collapse v-model="activeTrigger">
|
2023-10-16 17:53:46 +08:00
|
|
|
<el-collapse-item :title="$t('detection.create.trigger')" name="trigger">
|
2023-10-30 11:14:58 +08:00
|
|
|
<div class="drawer-collapse-content" v-if="language==='en'">
|
2023-08-03 18:47:18 +08:00
|
|
|
<div class="drawer-collapse-trigger">
|
|
|
|
|
Triggered when conditions occur at least
|
2023-10-16 17:53:46 +08:00
|
|
|
<span style="color: #046ECA">
|
2023-10-30 11:14:58 +08:00
|
|
|
{{ atLeast }} {{ times }}
|
2023-08-03 18:47:18 +08:00
|
|
|
</span> in
|
2023-10-16 17:53:46 +08:00
|
|
|
<span style="color: #046ECA">
|
|
|
|
|
{{ getNumberFromStr($_.get(detailData, 'ruleTriggerObj.interval', '0')) || '-' }}
|
|
|
|
|
{{ $_.get(detailData, 'ruleTriggerObj.intervalVal', '-') || '-' }}
|
2023-08-03 18:47:18 +08:00
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
2023-10-16 17:53:46 +08:00
|
|
|
<div class="detection-drawer-title">{{ $t('detection.evaluationFrequency') }}</div>
|
|
|
|
|
<div class="drawer-trigger-minutes">
|
|
|
|
|
{{ getNumberFromStr($_.get(detailData, 'ruleTriggerObj.resetInterval', '0')) || '-' }}
|
|
|
|
|
{{ $_.get(detailData, 'ruleTriggerObj.intervalVal', '-') || '-' }}
|
|
|
|
|
</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-10-30 11:14:58 +08:00
|
|
|
<div class="drawer-collapse-content" v-if="language==='cn'">
|
|
|
|
|
<div class="drawer-collapse-trigger">
|
|
|
|
|
当条件为
|
|
|
|
|
<span style="color: #046ECA">
|
|
|
|
|
{{ getNumberFromStr($_.get(detailData, 'ruleTriggerObj.interval', '0')) || '-' }}
|
|
|
|
|
{{ changeValueToLabel(detailData.ruleTriggerObj) }}
|
|
|
|
|
</span>内至少出现
|
|
|
|
|
<span style="color: #046ECA">
|
|
|
|
|
{{ $_.get(detailData, 'ruleTriggerObj.atLeast', '-') || '-' }} 次
|
|
|
|
|
</span>时触发
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="drawer-basic-function">
|
|
|
|
|
<div class="detection-drawer-title">评估频率</div>
|
|
|
|
|
<div class="drawer-trigger-minutes">
|
|
|
|
|
{{ getNumberFromStr($_.get(detailData, 'ruleTriggerObj.resetInterval', '0')) || '-' }}
|
|
|
|
|
{{ changeValueToLabel(detailData.ruleTriggerObj) }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-08-03 18:47:18 +08:00
|
|
|
</el-collapse-item>
|
|
|
|
|
</el-collapse>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { switchStatus, toUpperCaseByString } from '@/utils/tools'
|
2023-10-30 11:14:58 +08:00
|
|
|
import { detectionUnitList, eventSeverityColor, securityLevel, storageKey } from '@/utils/constants'
|
2023-08-04 10:38:28 +08:00
|
|
|
import axios from 'axios'
|
2023-08-03 18:47:18 +08:00
|
|
|
import { api } from '@/utils/api'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'DetectionDrawer',
|
|
|
|
|
props: {
|
|
|
|
|
drawerInfo: {
|
|
|
|
|
type: Object
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
activeRule: 'rule',
|
|
|
|
|
activeTrigger: 'trigger',
|
|
|
|
|
detailData: {},
|
|
|
|
|
eventSeverityColor,
|
2023-10-30 11:14:58 +08:00
|
|
|
severityList: [],
|
|
|
|
|
language: 'en',
|
|
|
|
|
atLeast: 0,
|
|
|
|
|
times: 'time'
|
2023-08-03 18:47:18 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
drawerInfo: {
|
|
|
|
|
immediate: true,
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
|
|
|
|
if (n) {
|
|
|
|
|
this.getDetailData()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2023-10-30 11:14:58 +08:00
|
|
|
mounted () {
|
|
|
|
|
this.language = localStorage.getItem(storageKey.language) || 'en'
|
|
|
|
|
},
|
2023-08-03 18:47:18 +08:00
|
|
|
methods: {
|
|
|
|
|
switchStatus,
|
|
|
|
|
toUpperCaseByString,
|
|
|
|
|
getDetailData () {
|
|
|
|
|
this.severityList = [
|
|
|
|
|
{
|
|
|
|
|
severity: 'critical',
|
|
|
|
|
list: ['> 60 Kpackets/s', '> 50 Unique Src IPs']
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
severity: 'high',
|
|
|
|
|
list: ['> 20 Kpackets/s', '> 50 Unique Src IPs']
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
axios.get(`${api.detection.detail}/${this.drawerInfo.ruleId}`).then(res => {
|
2023-08-27 20:34:24 +08:00
|
|
|
if (res.status === 200) {
|
2023-10-30 11:14:58 +08:00
|
|
|
this.detailData = res.data.data
|
|
|
|
|
this.atLeast = this.$_.get(this.detailData, 'ruleTriggerObj.atLeast', '-')
|
|
|
|
|
if (!isNaN(this.atLeast) && this.atLeast > 1) {
|
|
|
|
|
this.times = 'times'
|
|
|
|
|
} else {
|
|
|
|
|
this.times = 'time'
|
|
|
|
|
}
|
2023-08-03 18:47:18 +08:00
|
|
|
}
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.error(err)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getNumberFromStr (str) {
|
|
|
|
|
return str.match(/\d+(\.\d+)?/g)[0]
|
2023-10-30 11:14:58 +08:00
|
|
|
},
|
|
|
|
|
changeCategory (value) {
|
|
|
|
|
if (value) {
|
|
|
|
|
const obj = detectionUnitList.categoryList.find(d => d.value === value)
|
|
|
|
|
let label = value
|
|
|
|
|
if (obj) {
|
|
|
|
|
label = this.$t(obj.label)
|
|
|
|
|
}
|
|
|
|
|
return label
|
|
|
|
|
} else {
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
changeSecurityLevel (config) {
|
|
|
|
|
if (config) {
|
|
|
|
|
if (config.level) {
|
|
|
|
|
const obj = securityLevel.find(d => d.value === config.level)
|
|
|
|
|
let label = config.level
|
|
|
|
|
if (obj) {
|
|
|
|
|
label = this.$t(obj.label)
|
|
|
|
|
}
|
|
|
|
|
return label
|
|
|
|
|
} else {
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
changeValueToLabel (config) {
|
|
|
|
|
if (config) {
|
|
|
|
|
if (config.intervalVal) {
|
|
|
|
|
const obj = detectionUnitList.intervalListCN.find(d => d.value === config.intervalVal)
|
|
|
|
|
let label = config.intervalVal
|
|
|
|
|
if (obj) {
|
|
|
|
|
label = this.$t(obj.label)
|
|
|
|
|
}
|
|
|
|
|
return label
|
|
|
|
|
} else {
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '-'
|
|
|
|
|
}
|
2023-08-03 18:47:18 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
</style>
|