CN-990 fix: 情报聚合接口对接

This commit is contained in:
chenjinsong
2023-06-02 17:47:54 +08:00
parent dd154e6d85
commit 65487f47f6
6 changed files with 142 additions and 202 deletions

View File

@@ -24,6 +24,7 @@
padding-left:10px; padding-left:10px;
padding-right:10px; padding-right:10px;
height: 20px; height: 20px;
line-height: 20px;
} }
.information-aggregation__invalid { .information-aggregation__invalid {
background: #ededed; background: #ededed;
@@ -35,6 +36,7 @@
padding-left:10px; padding-left:10px;
padding-right:10px; padding-right:10px;
height: 20px; height: 20px;
line-height: 20px;
} }
.el-table { .el-table {
@@ -71,4 +73,4 @@
} }
.padding-0{ .padding-0{
padding:0px !important; padding:0px !important;
} }

View File

@@ -283,6 +283,59 @@ if (openMock) {
} }
] ]
} }
return {
msg: 'success',
code: 200,
data: result
}
})
Mock.mock(new RegExp(`${BASE_CONFIG.baseUrl}${BASE_CONFIG.apiVersion}/entity/kb/intelligence/list.*`), 'get', function (requestObj) {
const result = [
{
location: {
isp: 'dba Omsoft',
updateTime: 1685696510,
createTime: 1685696510,
isValid: 1
}
},
{
malware: {
threatType: 'command and control',
malwareName: 'IcedID',
malwareAlias: 'BokBot,IceID',
updateTime: 1685696510,
createTime: 1685696510,
isValid: 1
}
},
{
darkweb: {
nodeType: 'i2p',
updateTime: 1685696510,
createTime: 1685696510,
isValid: 1
}
},
{
userDefinedTag: {
id: 1,
tagValue: '门户网站',
updateTime: 1685696500,
createTime: 1685696500,
isValid: 1
}
},
{
userDefinedTag: {
id: 1,
tagValue: '用户tag',
updateTime: 1685696500,
createTime: 1685696500,
isValid: 1
}
}
]
return { return {
msg: 'success', msg: 'success',
code: 200, code: 200,

View File

@@ -239,7 +239,8 @@ export const api = {
domainNameResolutionRelatedDomain: 'interface/entity/detail/overview/ip/relatedDomain', domainNameResolutionRelatedDomain: 'interface/entity/detail/overview/ip/relatedDomain',
openPort: '', openPort: '',
basicInfo: BASE_CONFIG.apiVersion + '/entity/detail/basic', basicInfo: BASE_CONFIG.apiVersion + '/entity/detail/basic',
tags: BASE_CONFIG.apiVersion + '/entity/detail/kb/intelligence/tag' tags: BASE_CONFIG.apiVersion + '/entity/detail/kb/intelligence/tag',
informationAggregation: BASE_CONFIG.apiVersion + '/entity/kb/intelligence/list'
} }
} }

View File

@@ -90,28 +90,18 @@ export default {
if (tagData) { if (tagData) {
const res = tagData.data const res = tagData.data
if (res.code === 200) { if (res.code === 200) {
switch (this.entity.entityType) { Object.keys(res.data).forEach(k => {
case 'domain': { if (k !== 'userDefinedTags') {
if (res.data.result.malware && res.data.result.malware.malwareName) { Object.keys(res.data[k]).forEach(k2 => {
this.levelTwoTags.push({ value: res.data.result.malware.malwareName, type: entityDetailTags.domain.find(t => t.name === 'malwareName').type }) const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
} if (find) {
if (res.data.result.darkweb && res.data.result.darkweb.nodeType) { this.levelTwoTags.push({ key: k2, value: res.data[k][k2], type: find.type })
this.levelTwoTags.push({ value: res.data.result.darkweb.nodeType, type: entityDetailTags.domain.find(t => t.name === 'nodeType').type }) }
} })
break
} }
case 'ip': { })
if (res.data.result.malware && res.data.result.malware.malwareName) { if (_.isArray(res.data.userDefinedTags)) {
this.levelTwoTags.push({ value: res.data.result.malware.malwareName, type: entityDetailTags.ip.find(t => t.name === 'malwareName').type }) this.levelTwoTags = _.concat(this.levelTwoTags, res.data.userDefinedTags.map(tag => ({ value: tag.tagValue, type: 'normal' })))
}
if (res.data.result.darkweb && res.data.result.darkweb.nodeType) {
this.levelTwoTags.push({ value: res.data.result.darkweb.nodeType, type: entityDetailTags.ip.find(t => t.name === 'nodeType').type })
}
break
}
}
if (_.isArray(res.data.result.userDefinedTags)) {
this.levelTwoTags = _.concat(this.levelTwoTags, res.data.result.userDefinedTags.map(tag => ({ value: tag.tagValue, type: 'normal' })))
} }
} else { } else {
tagError = this.errorMsgHandler(res) tagError = this.errorMsgHandler(res)

View File

@@ -11,7 +11,7 @@
<!--<div class="el-tabs__active-bar is-top" style="width: 80.9998px; transform: translateX(177px);"></div>--> <!--<div class="el-tabs__active-bar is-top" style="width: 80.9998px; transform: translateX(177px);"></div>-->
<i :class="tab.icon"></i>{{tab.label}} <i :class="tab.icon"></i>{{tab.label}}
</template> </template>
<information-aggregation v-if="tab.name === entityDetailTabsName.informationAggregation && tab.name === activeTab" @toggleLoading="setLoading"></information-aggregation> <information-aggregation v-if="tab.name === entityDetailTabsName.informationAggregation && tab.name === activeTab" @toggleLoading="setLoading" :entity="entity"></information-aggregation>
<domain-name-resolution v-else-if="tab.name === entityDetailTabsName.domainNameResolution && tab.name === activeTab" @toggleLoading="setLoading"></domain-name-resolution> <domain-name-resolution v-else-if="tab.name === entityDetailTabsName.domainNameResolution && tab.name === activeTab" @toggleLoading="setLoading"></domain-name-resolution>
<digital-certificate v-else-if="tab.name === entityDetailTabsName.digitalCertificate && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" /> <digital-certificate v-else-if="tab.name === entityDetailTabsName.digitalCertificate && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" />
<security-event v-else-if="tab.name === entityDetailTabsName.securityEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" /> <security-event v-else-if="tab.name === entityDetailTabsName.securityEvent && tab.name === activeTab" @toggleLoading="setLoading" :timeFilter="oneDayTimeFilter" />

View File

@@ -15,17 +15,25 @@
:cell-class-name="intelligenceContentClass" :cell-class-name="intelligenceContentClass"
> >
<el-table-column <el-table-column
key="discoveryTime" key="createTime"
width="150px" width="250px"
:label="$t('entities.tab.informationAggregation.discoveryTime')" :label="$t('entities.tab.informationAggregation.discoveryTime')"
prop="discoveryTime" prop="createTime"
></el-table-column> >
<template #default="scope">
{{dateFormatByAppearance(scope.row.createTime)}}
</template>
</el-table-column>
<el-table-column <el-table-column
key="updateTime" key="updateTime"
width="150px" width="250px"
:label="$t('entities.tab.informationAggregation.updateTime')" :label="$t('entities.tab.informationAggregation.updateTime')"
prop="updateTime" prop="updateTime"
></el-table-column> >
<template #default="scope">
{{dateFormatByAppearance(scope.row.updateTime)}}
</template>
</el-table-column>
<el-table-column <el-table-column
key="intelligenceContent" key="intelligenceContent"
:label="$t('entities.tab.informationAggregation.intelligenceContent')" :label="$t('entities.tab.informationAggregation.intelligenceContent')"
@@ -33,31 +41,25 @@
> >
<template #default="scope"> <template #default="scope">
<div class="intelligence-content"> <div class="intelligence-content">
<div class="information-aggregation-tags"> <!-- <div class="information-aggregation-tags">
<template v-for="ic in scope.row.intelligenceContent" > <template v-for="ic in scope.row.intelligenceContent" >
<template v-if="ic.type === 0" > <template v-if="ic.type === 0" >
<div v-if="ic.threatLevel === -1" class="entity-tag entity-tag--small entity-tag--level-one-negative margin-r-6"> <div v-if="ic.threatLevel === -1" class="entity-tag entity-tag&#45;&#45;small entity-tag&#45;&#45;level-one-negative margin-r-6">
{{ic.value}} {{ic.value}}
</div> </div>
<div v-else-if="ic.threatLevel === 0" class="entity-tag entity-tag--small entity-tag--level-one-normal margin-r-6"> <div v-else-if="ic.threatLevel === 0" class="entity-tag entity-tag&#45;&#45;small entity-tag&#45;&#45;level-one-normal margin-r-6">
{{ic.value}} {{ic.value}}
</div> </div>
<div v-else-if="ic.threatLevel === 1" class="entity-tag entity-tag--small entity-tag--level-one-positive margin-r-6"> <div v-else-if="ic.threatLevel === 1" class="entity-tag entity-tag&#45;&#45;small entity-tag&#45;&#45;level-one-positive margin-r-6">
{{ic.value}} {{ic.value}}
</div> </div>
</template> </template>
</template> </template>
</div> </div>-->
<div class="information-aggregation-tags"> <div class="information-aggregation-tags">
<div v-for="ic in scope.row.intelligenceContent" > <div v-for="ic in scope.row.intelligenceContent" :key="ic.key">
<div v-if="ic.type === 1"> <div>
<div v-if="ic.threatLevel === -1" class="entity-tag entity-tag--small entity-tag--level-two-negative margin-r-6"> <div class="entity-tag entity-tag--small margin-r-6" :class="`entity-tag--level-two-${ic.type}`">
{{ic.value}}
</div>
<div v-else-if="ic.threatLevel === 0" class="entity-tag entity-tag--small entity-tag--level-two-normal margin-r-6">
{{ic.value}}
</div>
<div v-else-if="ic.threatLevel === 1" class="entity-tag entity-tag--small entity-tag--level-two-positive margin-r-6">
{{ic.value}} {{ic.value}}
</div> </div>
</div> </div>
@@ -74,10 +76,10 @@
> >
<template #default="scope"> <template #default="scope">
<div v-if="scope.row.status === 1" class="information-aggregation__valid"> <div v-if="scope.row.status === 1" class="information-aggregation__valid">
有效 valid
</div> </div>
<div v-else-if="scope.row.status === 0" class="information-aggregation__invalid"> <div v-else-if="scope.row.status === 0" class="information-aggregation__invalid">
无效 invalid
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@@ -88,178 +90,70 @@
<script> <script>
import chartMixin from '@/views/charts2/chart-mixin' import chartMixin from '@/views/charts2/chart-mixin'
import axios from 'axios'
import { api } from '@/utils/api'
import { entityDetailTags } from '@/utils/constants'
import { dateFormatByAppearance } from '@/utils/date-util'
export default { export default {
name: 'InformationAggregation', name: 'InformationAggregation',
data () { data () {
return { return {
informationAggregationList: [], informationAggregationList: []
errorMsg: '',
showError: false
} }
}, },
mixins: [chartMixin], mixins: [chartMixin],
methods: { methods: {
dateFormatByAppearance,
intelligenceContentClass ({ row, column, rowIndex, columnIndex }) { intelligenceContentClass ({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 2) { if (columnIndex === 2) {
return 'padding-0' return 'padding-0'
} }
},
getData () {
this.toggleLoading(true)
this.informationAggregationList = []
axios.get(`${api.entity.informationAggregation}/${this.entity.entityType}?resource=${this.entity.entityName}`).then(response => {
const res = response.data
if (res.code === 200) {
res.data.result.forEach(r => {
Object.keys(r).forEach(k => {
const aggregation = {
createTime: r[k].createTime,
updateTime: r[k].updateTime,
status: r[k].isValid,
intelligenceContent: []
}
if (k === 'userDefinedTag') {
aggregation.intelligenceContent.push({ key: k, value: r[k].tagValue, type: 'normal' })
} else {
Object.keys(r[k]).forEach(k2 => {
const find = entityDetailTags[this.entity.entityType].find(t => t.name === k2)
if (find) {
aggregation.intelligenceContent.push({ key: k2, value: r[k][k2], type: find.type })
}
})
}
if (aggregation.intelligenceContent.length > 0) {
this.informationAggregationList.push(aggregation)
}
})
})
} else {
this.showError = true
this.errorMsg = this.errorMsgHandler(res)
}
}).catch(e => {
console.error(e)
this.showError = true
this.errorMsg = this.errorMsgHandler(e)
}).finally(() => {
this.toggleLoading(false)
})
} }
}, },
mounted () { mounted () {
this.toggleLoading(true) this.getData()
// 模拟loading后续添加post请求时记得删除
const timer = setTimeout(() => {
this.toggleLoading(false)
clearTimeout(timer)
}, 150)
this.informationAggregationList = [
{
discoveryTime: '2022-04-12',
updateTime: '2022-04-13',
intelligenceContent: [
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '安全'
},
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '工具'
},
{
type: 1,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '信息技术'
},
{
type: 1,
threatLevel: 0, // 红色:-1灰色0绿色1
value: '互联网'
}
],
status: 1// 1有效0无效
},
{
discoveryTime: '2022-04-11',
updateTime: '2022-04-14',
intelligenceContent: [
{
type: 0,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '恶意软件'
},
{
type: 0,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '垃圾软件'
},
{
type: 1,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '病毒软件'
},
{
type: 1,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '病毒软件'
},
{
type: 1,
threatLevel: 0, // 红色:-1灰色0绿色1
value: '互联网'
}
],
status: 1// 1有效0无效
},
{
discoveryTime: '2022-04-12',
updateTime: '2022-04-12',
intelligenceContent: [
{
type: 0,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '恶意软件'
},
{
type: 1,
threatLevel: -1, // 红色:-1灰色0绿色1
value: '病毒软件'
},
{
type: 1,
threatLevel: 0, // 红色:-1灰色0绿色1
value: '互联网'
}
],
status: 0// 1有效0无效
},
{
discoveryTime: '2022-04-12',
updateTime: '2022-04-12',
intelligenceContent: [
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '安全'
},
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '工具'
},
{
type: 1,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '信息技术'
},
{
type: 1,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '信息技术'
},
{
type: 1,
threatLevel: 0, // 红色:-1灰色0绿色1
value: '互联网'
}
],
status: 1// 1有效0无效
},
{
discoveryTime: '2022-04-12',
updateTime: '2022-04-12',
intelligenceContent: [
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '安全'
},
{
type: 0,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '工具'
},
{
type: 1,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '信息技术'
},
{
type: 1,
threatLevel: 1, // 红色:-1灰色0绿色1
value: '信息技术'
},
{
type: 1,
threatLevel: 0, // 红色:-1灰色0绿色1
value: '互联网'
}
],
status: 0// 1有效0无效
}
]
} }
} }
</script> </script>