mihari 5.2.4 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/README.md +0 -10
- data/Rakefile +7 -1
- data/build_frontend.sh +1 -1
- data/frontend/.eslintrc.cjs +22 -0
- data/frontend/.gitignore +18 -12
- data/frontend/.prettierrc.json +8 -0
- data/frontend/env.d.ts +5 -0
- data/frontend/package-lock.json +5095 -9661
- data/frontend/package.json +34 -24
- data/frontend/src/App.vue +5 -5
- data/frontend/src/api-helper.ts +38 -40
- data/frontend/src/api.ts +40 -40
- data/frontend/src/components/ErrorMessage.vue +8 -8
- data/frontend/src/components/Loading.vue +3 -3
- data/frontend/src/components/Navbar.vue +10 -27
- data/frontend/src/components/Pagination.vue +35 -42
- data/frontend/src/components/alert/Alert.vue +21 -26
- data/frontend/src/components/alert/Alerts.vue +23 -25
- data/frontend/src/components/alert/AlertsWithPagination.vue +34 -34
- data/frontend/src/components/alert/AlertsWrapper.vue +42 -49
- data/frontend/src/components/alert/Form.vue +39 -40
- data/frontend/src/components/artifact/AS.vue +7 -7
- data/frontend/src/components/artifact/Artifact.vue +66 -83
- data/frontend/src/components/artifact/ArtifactTag.vue +21 -27
- data/frontend/src/components/artifact/ArtifactTags.vue +8 -8
- data/frontend/src/components/artifact/ArtifactWrapper.vue +22 -25
- data/frontend/src/components/artifact/CPEs.vue +6 -6
- data/frontend/src/components/artifact/DnsRecords.vue +9 -9
- data/frontend/src/components/artifact/Ports.vue +6 -6
- data/frontend/src/components/artifact/ReverseDnsNames.vue +7 -7
- data/frontend/src/components/artifact/Tags.vue +6 -6
- data/frontend/src/components/artifact/WhoisRecord.vue +7 -9
- data/frontend/src/components/config/Configs.vue +7 -10
- data/frontend/src/components/config/ConfigsWrapper.vue +14 -20
- data/frontend/src/components/link/Link.vue +7 -7
- data/frontend/src/components/link/Links.vue +16 -21
- data/frontend/src/components/rule/EditRule.vue +22 -22
- data/frontend/src/components/rule/EditRuleWrapper.vue +22 -28
- data/frontend/src/components/rule/Form.vue +28 -28
- data/frontend/src/components/rule/InputForm.vue +31 -25
- data/frontend/src/components/rule/NewRule.vue +18 -18
- data/frontend/src/components/rule/Rule.vue +25 -27
- data/frontend/src/components/rule/RuleWrapper.vue +24 -31
- data/frontend/src/components/rule/Rules.vue +26 -30
- data/frontend/src/components/rule/RulesWrapper.vue +39 -42
- data/frontend/src/components/rule/YAML.vue +19 -22
- data/frontend/src/components/tag/Tag.vue +24 -32
- data/frontend/src/components/tag/Tags.vue +11 -11
- data/frontend/src/countries.ts +23 -23
- data/frontend/src/index.ts +9 -12
- data/frontend/src/links/anyrun.ts +10 -10
- data/frontend/src/links/base.ts +3 -3
- data/frontend/src/links/censys.ts +10 -10
- data/frontend/src/links/crtsh.ts +10 -10
- data/frontend/src/links/dnslytics.ts +18 -18
- data/frontend/src/links/greynoise.ts +10 -10
- data/frontend/src/links/index.ts +15 -15
- data/frontend/src/links/intezer.ts +10 -10
- data/frontend/src/links/otx.ts +14 -14
- data/frontend/src/links/securitytrails.ts +15 -15
- data/frontend/src/links/shodan.ts +10 -10
- data/frontend/src/links/urlscan.ts +19 -19
- data/frontend/src/links/virustotal.ts +27 -27
- data/frontend/src/main.ts +8 -8
- data/frontend/src/router/index.ts +20 -20
- data/frontend/src/rule.ts +6 -6
- data/frontend/src/shims-vue.d.ts +2 -2
- data/frontend/src/types.ts +91 -91
- data/frontend/src/utils.ts +23 -29
- data/frontend/src/views/Alerts.vue +7 -7
- data/frontend/src/views/Artifact.vue +17 -17
- data/frontend/src/views/Configs.vue +7 -7
- data/frontend/src/views/EditRule.vue +17 -17
- data/frontend/src/views/NewRule.vue +10 -10
- data/frontend/src/views/Rule.vue +17 -17
- data/frontend/src/views/Rules.vue +7 -7
- data/frontend/tests/utils.spec.ts +9 -0
- data/frontend/tsconfig.app.json +21 -0
- data/frontend/tsconfig.json +10 -36
- data/frontend/tsconfig.node.json +13 -0
- data/frontend/tsconfig.vitest.json +12 -0
- data/frontend/vite.config.ts +24 -0
- data/frontend/vitest.config.ts +21 -0
- data/lefthook.yml +4 -2
- data/lib/mihari/analyzers/base.rb +48 -14
- data/lib/mihari/analyzers/binaryedge.rb +10 -15
- data/lib/mihari/analyzers/censys.rb +12 -15
- data/lib/mihari/analyzers/circl.rb +10 -10
- data/lib/mihari/analyzers/crtsh.rb +10 -6
- data/lib/mihari/analyzers/dnstwister.rb +6 -8
- data/lib/mihari/analyzers/feed.rb +21 -10
- data/lib/mihari/analyzers/greynoise.rb +10 -20
- data/lib/mihari/analyzers/onyphe.rb +9 -14
- data/lib/mihari/analyzers/otx.rb +8 -9
- data/lib/mihari/analyzers/passivetotal.rb +10 -10
- data/lib/mihari/analyzers/pulsedive.rb +21 -31
- data/lib/mihari/analyzers/securitytrails.rb +8 -6
- data/lib/mihari/analyzers/shodan.rb +8 -13
- data/lib/mihari/analyzers/urlscan.rb +15 -20
- data/lib/mihari/analyzers/virustotal.rb +16 -26
- data/lib/mihari/analyzers/virustotal_intelligence.rb +11 -17
- data/lib/mihari/analyzers/zoomeye.rb +12 -17
- data/lib/mihari/config.rb +133 -0
- data/lib/mihari/constants.rb +3 -0
- data/lib/mihari/emitters/slack.rb +13 -3
- data/lib/mihari/errors.rb +1 -1
- data/lib/mihari/http.rb +2 -3
- data/lib/mihari/schemas/analyzer.rb +2 -0
- data/lib/mihari/type_checker.rb +6 -6
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/endpoints/configs.rb +5 -1
- data/lib/mihari/web/public/assets/{index-eed1bcd8.css → index-2ba8f0a6.css} +1 -1
- data/lib/mihari/web/public/assets/{index-ac4e5ffa.js → index-71285b15.js} +16 -16
- data/lib/mihari/web/public/index.html +2 -2
- data/lib/mihari/web/public/redoc-static.html +388 -2193
- data/lib/mihari.rb +9 -59
- data/mihari.gemspec +8 -8
- metadata +24 -62
- data/frontend/.browserslistrc +0 -3
- data/frontend/.eslintrc.js +0 -33
- data/frontend/babel.config.js +0 -3
- data/frontend/jest.config.js +0 -9
- data/frontend/tests/unit/utils.spec.ts +0 -7
- data/frontend/vite.config.js +0 -24
@@ -5,10 +5,7 @@
|
|
5
5
|
<th>ID</th>
|
6
6
|
<td>
|
7
7
|
{{ alert.id }}
|
8
|
-
<button
|
9
|
-
class="button is-light is-small is-pulled-right"
|
10
|
-
@click="deleteAlert"
|
11
|
-
>
|
8
|
+
<button class="button is-light is-small is-pulled-right" @click="deleteAlert">
|
12
9
|
<span>Delete</span>
|
13
10
|
<span class="icon is-small">
|
14
11
|
<i class="fas fa-times"></i>
|
@@ -42,51 +39,49 @@
|
|
42
39
|
</template>
|
43
40
|
|
44
41
|
<script lang="ts">
|
45
|
-
import { defineComponent, PropType } from "vue"
|
42
|
+
import { defineComponent, type PropType } from "vue"
|
46
43
|
|
47
|
-
import { generateDeleteAlertTask } from "@/api-helper"
|
48
|
-
import Artifacts from "@/components/artifact/ArtifactTags.vue"
|
49
|
-
import Tags from "@/components/tag/Tags.vue"
|
50
|
-
import { Alert } from "@/types"
|
51
|
-
import { getHumanizedRelativeTime, getLocalDatetime } from "@/utils"
|
44
|
+
import { generateDeleteAlertTask } from "@/api-helper"
|
45
|
+
import Artifacts from "@/components/artifact/ArtifactTags.vue"
|
46
|
+
import Tags from "@/components/tag/Tags.vue"
|
47
|
+
import type { Alert } from "@/types"
|
48
|
+
import { getHumanizedRelativeTime, getLocalDatetime } from "@/utils"
|
52
49
|
|
53
50
|
export default defineComponent({
|
54
51
|
name: "AlertItem",
|
55
52
|
components: {
|
56
53
|
Artifacts,
|
57
|
-
Tags
|
54
|
+
Tags
|
58
55
|
},
|
59
56
|
props: {
|
60
57
|
alert: {
|
61
58
|
type: Object as PropType<Alert>,
|
62
|
-
required: true
|
63
|
-
}
|
59
|
+
required: true
|
60
|
+
}
|
64
61
|
},
|
65
62
|
setup(props, context) {
|
66
63
|
const updateTag = (tag: string) => {
|
67
|
-
context.emit("update-tag", tag)
|
68
|
-
}
|
64
|
+
context.emit("update-tag", tag)
|
65
|
+
}
|
69
66
|
|
70
|
-
const deleteAlertTask = generateDeleteAlertTask()
|
67
|
+
const deleteAlertTask = generateDeleteAlertTask()
|
71
68
|
|
72
69
|
const deleteAlert = async () => {
|
73
|
-
const result = window.confirm(
|
74
|
-
`Are you sure you want to delete ${props.alert.id}?`
|
75
|
-
);
|
70
|
+
const result = window.confirm(`Are you sure you want to delete ${props.alert.id}?`)
|
76
71
|
|
77
72
|
if (result) {
|
78
|
-
await deleteAlertTask.perform(props.alert.id)
|
73
|
+
await deleteAlertTask.perform(props.alert.id)
|
79
74
|
// refresh the page
|
80
|
-
context.emit("refresh-page")
|
75
|
+
context.emit("refresh-page")
|
81
76
|
}
|
82
|
-
}
|
77
|
+
}
|
83
78
|
|
84
79
|
return {
|
85
80
|
updateTag,
|
86
81
|
deleteAlert,
|
87
82
|
getLocalDatetime,
|
88
|
-
getHumanizedRelativeTime
|
89
|
-
}
|
90
|
-
}
|
91
|
-
})
|
83
|
+
getHumanizedRelativeTime
|
84
|
+
}
|
85
|
+
}
|
86
|
+
})
|
92
87
|
</script>
|
@@ -13,54 +13,52 @@
|
|
13
13
|
:pageSize="alerts.pageSize"
|
14
14
|
@update-page="updatePage"
|
15
15
|
></Pagination>
|
16
|
-
<p class="help">
|
17
|
-
({{ alerts.total }} results in total, {{ alerts.alerts.length }} shown)
|
18
|
-
</p>
|
16
|
+
<p class="help">({{ alerts.total }} results in total, {{ alerts.alerts.length }} shown)</p>
|
19
17
|
</template>
|
20
18
|
|
21
19
|
<script lang="ts">
|
22
|
-
import { defineComponent, PropType } from "vue"
|
20
|
+
import { defineComponent, type PropType } from "vue"
|
23
21
|
|
24
|
-
import Alert from "@/components/alert/Alert.vue"
|
25
|
-
import Pagination from "@/components/Pagination.vue"
|
26
|
-
import { Alerts } from "@/types"
|
22
|
+
import Alert from "@/components/alert/Alert.vue"
|
23
|
+
import Pagination from "@/components/Pagination.vue"
|
24
|
+
import type { Alerts } from "@/types"
|
27
25
|
|
28
26
|
export default defineComponent({
|
29
27
|
name: "AlertsItem",
|
30
28
|
components: {
|
31
29
|
Alert,
|
32
|
-
Pagination
|
30
|
+
Pagination
|
33
31
|
},
|
34
32
|
props: {
|
35
33
|
alerts: {
|
36
34
|
type: Object as PropType<Alerts>,
|
37
|
-
required: true
|
38
|
-
}
|
35
|
+
required: true
|
36
|
+
}
|
39
37
|
},
|
40
38
|
emits: ["update-page", "refresh-page", "update-tag"],
|
41
39
|
setup(_, context) {
|
42
40
|
const scrollToTop = () => {
|
43
41
|
window.scrollTo({
|
44
|
-
top: 0
|
45
|
-
})
|
46
|
-
}
|
42
|
+
top: 0
|
43
|
+
})
|
44
|
+
}
|
47
45
|
|
48
46
|
const updatePage = (page: number) => {
|
49
|
-
scrollToTop()
|
50
|
-
context.emit("update-page", page)
|
51
|
-
}
|
47
|
+
scrollToTop()
|
48
|
+
context.emit("update-page", page)
|
49
|
+
}
|
52
50
|
|
53
51
|
const refreshPage = () => {
|
54
|
-
scrollToTop()
|
55
|
-
context.emit("refresh-page")
|
56
|
-
}
|
52
|
+
scrollToTop()
|
53
|
+
context.emit("refresh-page")
|
54
|
+
}
|
57
55
|
|
58
56
|
const updateTag = (tag: string) => {
|
59
|
-
scrollToTop()
|
60
|
-
context.emit("update-tag", tag)
|
61
|
-
}
|
57
|
+
scrollToTop()
|
58
|
+
context.emit("update-tag", tag)
|
59
|
+
}
|
62
60
|
|
63
|
-
return { updatePage, updateTag, refreshPage }
|
64
|
-
}
|
65
|
-
})
|
61
|
+
return { updatePage, updateTag, refreshPage }
|
62
|
+
}
|
63
|
+
})
|
66
64
|
</script>
|
@@ -12,32 +12,32 @@
|
|
12
12
|
</template>
|
13
13
|
|
14
14
|
<script lang="ts">
|
15
|
-
import { defineComponent, nextTick, onMounted, ref, watch } from "vue"
|
15
|
+
import { defineComponent, nextTick, onMounted, ref, watch } from "vue"
|
16
16
|
|
17
|
-
import { generateGetAlertsTask } from "@/api-helper"
|
18
|
-
import Alerts from "@/components/alert/Alerts.vue"
|
19
|
-
import Loading from "@/components/Loading.vue"
|
20
|
-
import { AlertSearchParams } from "@/types"
|
17
|
+
import { generateGetAlertsTask } from "@/api-helper"
|
18
|
+
import Alerts from "@/components/alert/Alerts.vue"
|
19
|
+
import Loading from "@/components/Loading.vue"
|
20
|
+
import type { AlertSearchParams } from "@/types"
|
21
21
|
|
22
22
|
export default defineComponent({
|
23
23
|
name: "AlertsWithPagination",
|
24
24
|
props: {
|
25
25
|
ruleId: {
|
26
|
-
type: String
|
26
|
+
type: String
|
27
27
|
},
|
28
28
|
artifact: {
|
29
|
-
type: String
|
30
|
-
}
|
29
|
+
type: String
|
30
|
+
}
|
31
31
|
},
|
32
32
|
components: {
|
33
33
|
Alerts,
|
34
|
-
Loading
|
34
|
+
Loading
|
35
35
|
},
|
36
36
|
setup(props) {
|
37
|
-
const page = ref(1)
|
38
|
-
const tag = ref<string | undefined>(undefined)
|
37
|
+
const page = ref(1)
|
38
|
+
const tag = ref<string | undefined>(undefined)
|
39
39
|
|
40
|
-
const getAlertsTask = generateGetAlertsTask()
|
40
|
+
const getAlertsTask = generateGetAlertsTask()
|
41
41
|
|
42
42
|
const getAlerts = async () => {
|
43
43
|
const params: AlertSearchParams = {
|
@@ -46,46 +46,46 @@ export default defineComponent({
|
|
46
46
|
ruleId: props.ruleId,
|
47
47
|
tag: tag.value,
|
48
48
|
toAt: undefined,
|
49
|
-
fromAt: undefined
|
50
|
-
}
|
51
|
-
return await getAlertsTask.perform(params)
|
52
|
-
}
|
49
|
+
fromAt: undefined
|
50
|
+
}
|
51
|
+
return await getAlertsTask.perform(params)
|
52
|
+
}
|
53
53
|
|
54
54
|
const updatePage = (newPage: number) => {
|
55
|
-
page.value = newPage
|
56
|
-
}
|
55
|
+
page.value = newPage
|
56
|
+
}
|
57
57
|
|
58
58
|
const resetPage = () => {
|
59
|
-
page.value = 1
|
60
|
-
}
|
59
|
+
page.value = 1
|
60
|
+
}
|
61
61
|
|
62
62
|
const refreshPage = async () => {
|
63
|
-
resetPage()
|
64
|
-
await getAlerts()
|
65
|
-
}
|
63
|
+
resetPage()
|
64
|
+
await getAlerts()
|
65
|
+
}
|
66
66
|
|
67
67
|
const updateTag = (newTag: string | undefined) => {
|
68
68
|
if (tag.value === newTag) {
|
69
|
-
tag.value = undefined
|
69
|
+
tag.value = undefined
|
70
70
|
} else {
|
71
|
-
tag.value = newTag
|
71
|
+
tag.value = newTag
|
72
72
|
}
|
73
|
-
}
|
73
|
+
}
|
74
74
|
|
75
75
|
onMounted(async () => {
|
76
|
-
await getAlerts()
|
77
|
-
})
|
76
|
+
await getAlerts()
|
77
|
+
})
|
78
78
|
|
79
79
|
watch([props, page, tag], async () => {
|
80
|
-
nextTick(async () => await getAlerts())
|
81
|
-
})
|
80
|
+
nextTick(async () => await getAlerts())
|
81
|
+
})
|
82
82
|
|
83
83
|
return {
|
84
84
|
getAlertsTask,
|
85
85
|
refreshPage,
|
86
86
|
updatePage,
|
87
|
-
updateTag
|
88
|
-
}
|
89
|
-
}
|
90
|
-
})
|
87
|
+
updateTag
|
88
|
+
}
|
89
|
+
}
|
90
|
+
})
|
91
91
|
</script>
|
@@ -31,10 +31,7 @@
|
|
31
31
|
|
32
32
|
<Loading v-if="getAlertsTask.isRunning"></Loading>
|
33
33
|
|
34
|
-
<ErrorMessage
|
35
|
-
v-if="getAlertsTask.isError"
|
36
|
-
:error="getAlertsTask.last?.error"
|
37
|
-
></ErrorMessage>
|
34
|
+
<ErrorMessage v-if="getAlertsTask.isError" :error="getAlertsTask.last?.error"></ErrorMessage>
|
38
35
|
|
39
36
|
<AlertsComponent
|
40
37
|
:alerts="getAlertsTask.last.value"
|
@@ -47,18 +44,14 @@
|
|
47
44
|
</template>
|
48
45
|
|
49
46
|
<script lang="ts">
|
50
|
-
import { defineComponent, nextTick, onMounted, ref, watch } from "vue"
|
51
|
-
|
52
|
-
import {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
import
|
58
|
-
import FormComponent from "@/components/alert/Form.vue";
|
59
|
-
import ErrorMessage from "@/components/ErrorMessage.vue";
|
60
|
-
import Loading from "@/components/Loading.vue";
|
61
|
-
import { AlertSearchParams } from "@/types";
|
47
|
+
import { defineComponent, nextTick, onMounted, ref, watch } from "vue"
|
48
|
+
|
49
|
+
import { generateGetAlertsTask, generateGetRuleSetTask, generateGetTagsTask } from "@/api-helper"
|
50
|
+
import AlertsComponent from "@/components/alert/Alerts.vue"
|
51
|
+
import FormComponent from "@/components/alert/Form.vue"
|
52
|
+
import ErrorMessage from "@/components/ErrorMessage.vue"
|
53
|
+
import Loading from "@/components/Loading.vue"
|
54
|
+
import type { AlertSearchParams } from "@/types"
|
62
55
|
|
63
56
|
export default defineComponent({
|
64
57
|
name: "AlertsWrapper",
|
@@ -66,63 +59,63 @@ export default defineComponent({
|
|
66
59
|
AlertsComponent,
|
67
60
|
FormComponent,
|
68
61
|
Loading,
|
69
|
-
ErrorMessage
|
62
|
+
ErrorMessage
|
70
63
|
},
|
71
64
|
setup() {
|
72
|
-
const page = ref(1)
|
73
|
-
const tag = ref<string | undefined>(undefined)
|
74
|
-
const form = ref<InstanceType<typeof FormComponent>>()
|
65
|
+
const page = ref(1)
|
66
|
+
const tag = ref<string | undefined>(undefined)
|
67
|
+
const form = ref<InstanceType<typeof FormComponent>>()
|
75
68
|
|
76
|
-
const getAlertsTask = generateGetAlertsTask()
|
77
|
-
const getTagsTask = generateGetTagsTask()
|
78
|
-
const getRuleSetTask = generateGetRuleSetTask()
|
69
|
+
const getAlertsTask = generateGetAlertsTask()
|
70
|
+
const getTagsTask = generateGetTagsTask()
|
71
|
+
const getRuleSetTask = generateGetRuleSetTask()
|
79
72
|
|
80
73
|
const getAlerts = async () => {
|
81
|
-
const params = form.value?.getSearchParams() as AlertSearchParams
|
82
|
-
return await getAlertsTask.perform(params)
|
83
|
-
}
|
74
|
+
const params = form.value?.getSearchParams() as AlertSearchParams
|
75
|
+
return await getAlertsTask.perform(params)
|
76
|
+
}
|
84
77
|
|
85
78
|
const updatePage = (newPage: number) => {
|
86
|
-
page.value = newPage
|
87
|
-
}
|
79
|
+
page.value = newPage
|
80
|
+
}
|
88
81
|
|
89
82
|
const resetPage = () => {
|
90
|
-
page.value = 1
|
91
|
-
}
|
83
|
+
page.value = 1
|
84
|
+
}
|
92
85
|
|
93
86
|
const search = async () => {
|
94
87
|
// reset page
|
95
|
-
resetPage()
|
88
|
+
resetPage()
|
96
89
|
|
97
|
-
await getAlerts()
|
98
|
-
}
|
90
|
+
await getAlerts()
|
91
|
+
}
|
99
92
|
|
100
93
|
const updateTag = (newTag: string | undefined) => {
|
101
94
|
if (tag.value === newTag) {
|
102
|
-
tag.value = undefined
|
95
|
+
tag.value = undefined
|
103
96
|
} else {
|
104
|
-
tag.value = newTag
|
97
|
+
tag.value = newTag
|
105
98
|
}
|
106
99
|
|
107
|
-
nextTick(async () => await search())
|
108
|
-
}
|
100
|
+
nextTick(async () => await search())
|
101
|
+
}
|
109
102
|
|
110
103
|
const refreshPage = async () => {
|
111
104
|
// it is just an alias of search
|
112
105
|
// this function will be invoked when an alert is deleted
|
113
|
-
await search()
|
114
|
-
}
|
106
|
+
await search()
|
107
|
+
}
|
115
108
|
|
116
109
|
onMounted(async () => {
|
117
|
-
getTagsTask.perform()
|
118
|
-
getRuleSetTask.perform()
|
110
|
+
getTagsTask.perform()
|
111
|
+
getRuleSetTask.perform()
|
119
112
|
|
120
|
-
await getAlerts()
|
121
|
-
})
|
113
|
+
await getAlerts()
|
114
|
+
})
|
122
115
|
|
123
116
|
watch([page, tag], async () => {
|
124
|
-
nextTick(async () => await getAlerts())
|
125
|
-
})
|
117
|
+
nextTick(async () => await getAlerts())
|
118
|
+
})
|
126
119
|
|
127
120
|
return {
|
128
121
|
getAlertsTask,
|
@@ -134,8 +127,8 @@ export default defineComponent({
|
|
134
127
|
updatePage,
|
135
128
|
updateTag,
|
136
129
|
form,
|
137
|
-
page
|
138
|
-
}
|
139
|
-
}
|
140
|
-
})
|
130
|
+
page
|
131
|
+
}
|
132
|
+
}
|
133
|
+
})
|
141
134
|
</script>
|
@@ -95,64 +95,63 @@
|
|
95
95
|
</template>
|
96
96
|
|
97
97
|
<script lang="ts">
|
98
|
-
import { defineComponent, PropType, ref, watch } from "vue"
|
99
|
-
import { useRoute } from "vue-router"
|
98
|
+
import { defineComponent, type PropType, ref, watch } from "vue"
|
99
|
+
import { useRoute } from "vue-router"
|
100
100
|
|
101
|
-
import { AlertSearchParams } from "@/types"
|
102
|
-
import { normalizeQueryParam } from "@/utils"
|
101
|
+
import type { AlertSearchParams } from "@/types"
|
102
|
+
import { normalizeQueryParam } from "@/utils"
|
103
103
|
|
104
104
|
export default defineComponent({
|
105
105
|
name: "AlertsForm",
|
106
106
|
props: {
|
107
107
|
tags: {
|
108
108
|
type: Array as PropType<string[]>,
|
109
|
-
required: true
|
109
|
+
required: true
|
110
110
|
},
|
111
111
|
ruleSet: {
|
112
112
|
type: Array as PropType<string[]>,
|
113
|
-
required: true
|
113
|
+
required: true
|
114
114
|
},
|
115
115
|
page: {
|
116
116
|
type: Number,
|
117
|
-
required: true
|
117
|
+
required: true
|
118
118
|
},
|
119
119
|
tag: {
|
120
120
|
type: String,
|
121
|
-
required: false
|
122
|
-
}
|
121
|
+
required: false
|
122
|
+
}
|
123
123
|
},
|
124
124
|
setup(props) {
|
125
|
-
const route = useRoute()
|
125
|
+
const route = useRoute()
|
126
126
|
|
127
|
-
const artifact = ref<string | undefined>(undefined)
|
128
|
-
const fromAt = ref<string | undefined>(undefined)
|
129
|
-
const tagInput = ref<string | undefined>(props.tag)
|
130
|
-
const ruleId = ref<string | undefined>(undefined)
|
131
|
-
const toAt = ref<string | undefined>(undefined)
|
132
|
-
const asn = ref<number | undefined>(undefined)
|
133
|
-
const dnsRecord = ref<string | undefined>(undefined)
|
134
|
-
const reverseDnsName = ref<string | undefined>(undefined)
|
127
|
+
const artifact = ref<string | undefined>(undefined)
|
128
|
+
const fromAt = ref<string | undefined>(undefined)
|
129
|
+
const tagInput = ref<string | undefined>(props.tag)
|
130
|
+
const ruleId = ref<string | undefined>(undefined)
|
131
|
+
const toAt = ref<string | undefined>(undefined)
|
132
|
+
const asn = ref<number | undefined>(undefined)
|
133
|
+
const dnsRecord = ref<string | undefined>(undefined)
|
134
|
+
const reverseDnsName = ref<string | undefined>(undefined)
|
135
135
|
|
136
136
|
const updateByQueryParams = () => {
|
137
|
-
const asn_ = route.query["asn"]
|
138
|
-
const normalizedAsn = normalizeQueryParam(asn_)
|
139
|
-
asn.value =
|
140
|
-
normalizedAsn === undefined ? undefined : parseInt(normalizedAsn);
|
137
|
+
const asn_ = route.query["asn"]
|
138
|
+
const normalizedAsn = normalizeQueryParam(asn_)
|
139
|
+
asn.value = normalizedAsn === undefined ? undefined : parseInt(normalizedAsn)
|
141
140
|
|
142
|
-
const dnsRecord_ = route.query["dnsRecord"]
|
143
|
-
dnsRecord.value = normalizeQueryParam(dnsRecord_)
|
141
|
+
const dnsRecord_ = route.query["dnsRecord"]
|
142
|
+
dnsRecord.value = normalizeQueryParam(dnsRecord_)
|
144
143
|
|
145
|
-
const reverseDnsName_ = route.query["reverseDnsName"]
|
146
|
-
reverseDnsName.value = normalizeQueryParam(reverseDnsName_)
|
144
|
+
const reverseDnsName_ = route.query["reverseDnsName"]
|
145
|
+
reverseDnsName.value = normalizeQueryParam(reverseDnsName_)
|
147
146
|
|
148
|
-
const tag_ = route.query["tag"]
|
147
|
+
const tag_ = route.query["tag"]
|
149
148
|
if (tagInput.value === undefined) {
|
150
|
-
tagInput.value = normalizeQueryParam(tag_)
|
149
|
+
tagInput.value = normalizeQueryParam(tag_)
|
151
150
|
}
|
152
|
-
}
|
151
|
+
}
|
153
152
|
|
154
153
|
const getSearchParams = (): AlertSearchParams => {
|
155
|
-
updateByQueryParams()
|
154
|
+
updateByQueryParams()
|
156
155
|
|
157
156
|
const params: AlertSearchParams = {
|
158
157
|
artifact: artifact.value === "" ? undefined : artifact.value,
|
@@ -160,17 +159,17 @@ export default defineComponent({
|
|
160
159
|
ruleId: ruleId.value === "" ? undefined : ruleId.value,
|
161
160
|
tag: tagInput.value === "" ? undefined : tagInput.value,
|
162
161
|
toAt: toAt.value === "" ? undefined : toAt.value,
|
163
|
-
fromAt: fromAt.value === "" ? undefined : fromAt.value
|
164
|
-
}
|
165
|
-
return params
|
166
|
-
}
|
162
|
+
fromAt: fromAt.value === "" ? undefined : fromAt.value
|
163
|
+
}
|
164
|
+
return params
|
165
|
+
}
|
167
166
|
|
168
167
|
watch(
|
169
168
|
() => props.tag,
|
170
169
|
() => {
|
171
|
-
tagInput.value = props.tag
|
170
|
+
tagInput.value = props.tag
|
172
171
|
}
|
173
|
-
)
|
172
|
+
)
|
174
173
|
|
175
174
|
return {
|
176
175
|
artifact,
|
@@ -178,8 +177,8 @@ export default defineComponent({
|
|
178
177
|
getSearchParams,
|
179
178
|
ruleId,
|
180
179
|
toAt,
|
181
|
-
tagInput
|
182
|
-
}
|
183
|
-
}
|
184
|
-
})
|
180
|
+
tagInput
|
181
|
+
}
|
182
|
+
}
|
183
|
+
})
|
185
184
|
</script>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
class="tag"
|
5
5
|
:to="{
|
6
6
|
name: 'Alerts',
|
7
|
-
query: { asn: autonomousSystem.asn }
|
7
|
+
query: { asn: autonomousSystem.asn }
|
8
8
|
}"
|
9
9
|
>
|
10
10
|
{{ autonomousSystem.asn }}
|
@@ -13,17 +13,17 @@
|
|
13
13
|
</template>
|
14
14
|
|
15
15
|
<script lang="ts">
|
16
|
-
import { defineComponent, PropType } from "vue"
|
16
|
+
import { defineComponent, type PropType } from "vue"
|
17
17
|
|
18
|
-
import { AutonomousSystem } from "@/types"
|
18
|
+
import type { AutonomousSystem } from "@/types"
|
19
19
|
|
20
20
|
export default defineComponent({
|
21
21
|
name: "AS",
|
22
22
|
props: {
|
23
23
|
autonomousSystem: {
|
24
24
|
type: Object as PropType<AutonomousSystem>,
|
25
|
-
required: true
|
26
|
-
}
|
27
|
-
}
|
28
|
-
})
|
25
|
+
required: true
|
26
|
+
}
|
27
|
+
}
|
28
|
+
})
|
29
29
|
</script>
|