mihari 5.2.4 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { BaseLink } from "@/links/base"
|
|
2
|
-
import { Link, LinkType } from "@/types"
|
|
1
|
+
import { BaseLink } from "@/links/base"
|
|
2
|
+
import type { Link, LinkType } from "@/types"
|
|
3
3
|
|
|
4
4
|
class Urlscan extends BaseLink {
|
|
5
|
-
public baseURL: string
|
|
6
|
-
public name: string
|
|
7
|
-
public type: LinkType
|
|
5
|
+
public baseURL: string
|
|
6
|
+
public name: string
|
|
7
|
+
public type: LinkType
|
|
8
8
|
|
|
9
9
|
public constructor() {
|
|
10
|
-
super()
|
|
10
|
+
super()
|
|
11
11
|
|
|
12
|
-
this.baseURL = "https://urlscan.io"
|
|
13
|
-
this.name = "urlscan.io"
|
|
14
|
-
this.type = "domain"
|
|
12
|
+
this.baseURL = "https://urlscan.io"
|
|
13
|
+
this.name = "urlscan.io"
|
|
14
|
+
this.type = "domain"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class UrlscanForDomain extends Urlscan implements Link {
|
|
19
19
|
public constructor() {
|
|
20
|
-
super()
|
|
21
|
-
this.type = "domain"
|
|
20
|
+
super()
|
|
21
|
+
this.type = "domain"
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
public href(data: string): string {
|
|
25
|
-
return this.baseURL + `/domain/${data}
|
|
25
|
+
return this.baseURL + `/domain/${data}`
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class UrlscanForIP extends Urlscan implements Link {
|
|
30
30
|
public constructor() {
|
|
31
|
-
super()
|
|
32
|
-
this.type = "ip"
|
|
31
|
+
super()
|
|
32
|
+
this.type = "ip"
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public href(data: string): string {
|
|
36
|
-
return this.baseURL + `/ip/${data}
|
|
36
|
+
return this.baseURL + `/ip/${data}`
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export class UrlscanForURL extends Urlscan implements Link {
|
|
41
41
|
public constructor() {
|
|
42
|
-
super()
|
|
43
|
-
this.type = "url"
|
|
42
|
+
super()
|
|
43
|
+
this.type = "url"
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
public href(url: string): string {
|
|
47
|
-
const query = encodeURIComponent(`page.url:"${url}" OR task.url:"${url}"`)
|
|
48
|
-
return this.baseURL + `/search/#${query}
|
|
47
|
+
const query = encodeURIComponent(`page.url:"${url}" OR task.url:"${url}"`)
|
|
48
|
+
return this.baseURL + `/search/#${query}`
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { sha256 } from "js-sha256"
|
|
2
|
-
import URL from "url-parse"
|
|
1
|
+
import { sha256 } from "js-sha256"
|
|
2
|
+
import URL from "url-parse"
|
|
3
3
|
|
|
4
|
-
import { BaseLink } from "@/links/base"
|
|
5
|
-
import { Link, LinkType } from "@/types"
|
|
4
|
+
import { BaseLink } from "@/links/base"
|
|
5
|
+
import type { Link, LinkType } from "@/types"
|
|
6
6
|
|
|
7
7
|
class VirusTotal extends BaseLink {
|
|
8
|
-
public baseURL: string
|
|
9
|
-
public name: string
|
|
10
|
-
public type: LinkType
|
|
8
|
+
public baseURL: string
|
|
9
|
+
public name: string
|
|
10
|
+
public type: LinkType
|
|
11
11
|
|
|
12
12
|
public constructor() {
|
|
13
|
-
super()
|
|
13
|
+
super()
|
|
14
14
|
|
|
15
|
-
this.name = "VirusTotal"
|
|
16
|
-
this.baseURL = "https://www.virustotal.com"
|
|
17
|
-
this.type = "domain"
|
|
15
|
+
this.name = "VirusTotal"
|
|
16
|
+
this.baseURL = "https://www.virustotal.com"
|
|
17
|
+
this.type = "domain"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export class VirusTotalForDomain extends VirusTotal implements Link {
|
|
22
22
|
public constructor() {
|
|
23
|
-
super()
|
|
24
|
-
this.type = "domain"
|
|
23
|
+
super()
|
|
24
|
+
this.type = "domain"
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public href(data: string): string {
|
|
28
|
-
return this.baseURL + `/gui/domain/${data}/detection
|
|
28
|
+
return this.baseURL + `/gui/domain/${data}/detection`
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export class VirusTotalForIP extends VirusTotal implements Link {
|
|
33
33
|
public constructor() {
|
|
34
|
-
super()
|
|
35
|
-
this.type = "ip"
|
|
34
|
+
super()
|
|
35
|
+
this.type = "ip"
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
public href(data: string): string {
|
|
39
|
-
return this.baseURL + `/gui/ip-address/${data}/details
|
|
39
|
+
return this.baseURL + `/gui/ip-address/${data}/details`
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export class VirusTotalForURL extends VirusTotal implements Link {
|
|
44
44
|
public constructor() {
|
|
45
|
-
super()
|
|
46
|
-
this.type = "url"
|
|
45
|
+
super()
|
|
46
|
+
this.type = "url"
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
public href(data: string): string {
|
|
50
|
-
const hash = sha256(this.normalizeURL(data))
|
|
51
|
-
return this.baseURL + `/gui/url/${hash}/details
|
|
50
|
+
const hash = sha256(this.normalizeURL(data))
|
|
51
|
+
return this.baseURL + `/gui/url/${hash}/details`
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
private normalizeURL(uri: string): string {
|
|
55
|
-
const parsedUrl = new URL(uri)
|
|
55
|
+
const parsedUrl = new URL(uri)
|
|
56
56
|
if (parsedUrl.pathname === "/" && !uri.endsWith("/")) {
|
|
57
|
-
return `${uri}
|
|
57
|
+
return `${uri}/`
|
|
58
58
|
}
|
|
59
|
-
return uri
|
|
59
|
+
return uri
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export class VirusTotalForHash extends VirusTotal implements Link {
|
|
64
64
|
public constructor() {
|
|
65
|
-
super()
|
|
66
|
-
this.type = "hash"
|
|
65
|
+
super()
|
|
66
|
+
this.type = "hash"
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
public href(data: string): string {
|
|
70
|
-
return this.baseURL + `/gui/file/${data}/details
|
|
70
|
+
return this.baseURL + `/gui/file/${data}/details`
|
|
71
71
|
}
|
|
72
72
|
}
|
data/frontend/src/main.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "bulma/css/bulma.css"
|
|
2
|
-
import "bulma-helpers/css/bulma-helpers.min.css"
|
|
3
|
-
import "@fortawesome/fontawesome-free/css/all.css"
|
|
4
|
-
import "@fortawesome/fontawesome-free/js/all.js"
|
|
1
|
+
import "bulma/css/bulma.css"
|
|
2
|
+
import "bulma-helpers/css/bulma-helpers.min.css"
|
|
3
|
+
import "@fortawesome/fontawesome-free/css/all.css"
|
|
4
|
+
import "@fortawesome/fontawesome-free/js/all.js"
|
|
5
5
|
|
|
6
|
-
import { createApp } from "vue"
|
|
6
|
+
import { createApp } from "vue"
|
|
7
7
|
|
|
8
|
-
import App from "@/App.vue"
|
|
9
|
-
import router from "@/router"
|
|
8
|
+
import App from "@/App.vue"
|
|
9
|
+
import router from "@/router"
|
|
10
10
|
|
|
11
|
-
createApp(App).use(router).mount("#app")
|
|
11
|
+
createApp(App).use(router).mount("#app")
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"
|
|
1
|
+
import { createRouter, createWebHashHistory, type RouteRecordRaw } from "vue-router"
|
|
2
2
|
|
|
3
|
-
import Alerts from "@/views/Alerts.vue"
|
|
4
|
-
import Artifact from "@/views/Artifact.vue"
|
|
5
|
-
import Configs from "@/views/Configs.vue"
|
|
6
|
-
import EditRule from "@/views/EditRule.vue"
|
|
7
|
-
import NewRule from "@/views/NewRule.vue"
|
|
8
|
-
import Rule from "@/views/Rule.vue"
|
|
9
|
-
import Rules from "@/views/Rules.vue"
|
|
3
|
+
import Alerts from "@/views/Alerts.vue"
|
|
4
|
+
import Artifact from "@/views/Artifact.vue"
|
|
5
|
+
import Configs from "@/views/Configs.vue"
|
|
6
|
+
import EditRule from "@/views/EditRule.vue"
|
|
7
|
+
import NewRule from "@/views/NewRule.vue"
|
|
8
|
+
import Rule from "@/views/Rule.vue"
|
|
9
|
+
import Rules from "@/views/Rules.vue"
|
|
10
10
|
|
|
11
11
|
const routes: Array<RouteRecordRaw> = [
|
|
12
12
|
{
|
|
13
13
|
path: "/",
|
|
14
14
|
name: "Alerts",
|
|
15
|
-
component: Alerts
|
|
15
|
+
component: Alerts
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
path: "/configs",
|
|
19
19
|
name: "Configs",
|
|
20
|
-
component: Configs
|
|
20
|
+
component: Configs
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
path: "/artifacts/:id",
|
|
24
24
|
name: "Artifact",
|
|
25
25
|
component: Artifact,
|
|
26
|
-
props: true
|
|
26
|
+
props: true
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
path: "/rules",
|
|
30
30
|
name: "Rules",
|
|
31
|
-
component: Rules
|
|
31
|
+
component: Rules
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
path: "/rules/new",
|
|
35
35
|
name: "NewRule",
|
|
36
|
-
component: NewRule
|
|
36
|
+
component: NewRule
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
path: "/rules/:id",
|
|
40
40
|
name: "Rule",
|
|
41
41
|
component: Rule,
|
|
42
|
-
props: true
|
|
42
|
+
props: true
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
path: "/rules/:id/edit",
|
|
46
46
|
name: "EditRule",
|
|
47
47
|
component: EditRule,
|
|
48
|
-
props: true
|
|
49
|
-
}
|
|
50
|
-
]
|
|
48
|
+
props: true
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
51
|
|
|
52
52
|
const router = createRouter({
|
|
53
53
|
history: createWebHashHistory(),
|
|
54
|
-
routes
|
|
55
|
-
})
|
|
54
|
+
routes
|
|
55
|
+
})
|
|
56
56
|
|
|
57
|
-
export default router
|
|
57
|
+
export default router
|
data/frontend/src/rule.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import dayjs from "dayjs"
|
|
2
|
-
import dedent from "ts-dedent"
|
|
3
|
-
import { v4 } from "uuid"
|
|
1
|
+
import dayjs from "dayjs"
|
|
2
|
+
import dedent from "ts-dedent"
|
|
3
|
+
import { v4 } from "uuid"
|
|
4
4
|
|
|
5
5
|
export function getRuleTemplate(): string {
|
|
6
|
-
const id = v4()
|
|
7
|
-
const now = dayjs()
|
|
6
|
+
const id = v4()
|
|
7
|
+
const now = dayjs()
|
|
8
8
|
|
|
9
9
|
return dedent`id: ${id}
|
|
10
10
|
title: Title goes here
|
|
11
11
|
description: Description goes here
|
|
12
12
|
created_on: ${now.format("YYYY-MM-DD")}
|
|
13
|
-
queries: []
|
|
13
|
+
queries: []`
|
|
14
14
|
}
|
data/frontend/src/shims-vue.d.ts
CHANGED
data/frontend/src/types.ts
CHANGED
|
@@ -1,188 +1,188 @@
|
|
|
1
1
|
export interface Pagination {
|
|
2
|
-
total: number
|
|
3
|
-
currentPage: number
|
|
4
|
-
pageSize: number
|
|
2
|
+
total: number
|
|
3
|
+
currentPage: number
|
|
4
|
+
pageSize: number
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export interface ConfigValue {
|
|
8
|
-
key: string
|
|
9
|
-
value: string | null
|
|
8
|
+
key: string
|
|
9
|
+
value: string | null
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface Config {
|
|
13
|
-
name: string
|
|
14
|
-
isConfigured: boolean
|
|
15
|
-
values: ConfigValue[]
|
|
16
|
-
type: string
|
|
13
|
+
name: string
|
|
14
|
+
isConfigured: boolean
|
|
15
|
+
values: ConfigValue[]
|
|
16
|
+
type: string
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface Tag {
|
|
20
|
-
name: string
|
|
20
|
+
name: string
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface Tags {
|
|
24
|
-
tags: string[]
|
|
24
|
+
tags: string[]
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface RuleSet {
|
|
28
|
-
ruleIds: string[]
|
|
28
|
+
ruleIds: string[]
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface DnsRecord {
|
|
32
|
-
resource: string
|
|
33
|
-
value: string
|
|
32
|
+
resource: string
|
|
33
|
+
value: string
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export interface Contact {
|
|
37
|
-
name: string | null
|
|
38
|
-
organization: string | null
|
|
37
|
+
name: string | null
|
|
38
|
+
organization: string | null
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface Registrar {
|
|
42
|
-
name: string | null
|
|
43
|
-
organization: string | null
|
|
42
|
+
name: string | null
|
|
43
|
+
organization: string | null
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export interface WhoisRecord {
|
|
47
|
-
createdOn: Date | null
|
|
48
|
-
updatedOn: Date | null
|
|
49
|
-
expiresOn: Date | null
|
|
50
|
-
registrar: Registrar | null
|
|
51
|
-
contacts: Contact[]
|
|
47
|
+
createdOn: Date | null
|
|
48
|
+
updatedOn: Date | null
|
|
49
|
+
expiresOn: Date | null
|
|
50
|
+
registrar: Registrar | null
|
|
51
|
+
contacts: Contact[]
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export interface AutonomousSystem {
|
|
55
|
-
asn: number
|
|
55
|
+
asn: number
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export interface Geolocation {
|
|
59
|
-
country: string
|
|
60
|
-
countryCode: string
|
|
59
|
+
country: string
|
|
60
|
+
countryCode: string
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export interface ReverseDnsName {
|
|
64
|
-
name: string
|
|
64
|
+
name: string
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface CPE {
|
|
68
|
-
cpe: string
|
|
68
|
+
cpe: string
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export interface Port {
|
|
72
|
-
port: string
|
|
72
|
+
port: string
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
export interface Artifact {
|
|
76
|
-
id: string
|
|
77
|
-
data: string
|
|
78
|
-
dataType: string
|
|
79
|
-
source: string
|
|
80
|
-
metadata: unknown | null
|
|
81
|
-
createdAt: string
|
|
76
|
+
id: string
|
|
77
|
+
data: string
|
|
78
|
+
dataType: string
|
|
79
|
+
source: string
|
|
80
|
+
metadata: unknown | null
|
|
81
|
+
createdAt: string
|
|
82
82
|
|
|
83
|
-
autonomousSystem: AutonomousSystem | null
|
|
84
|
-
whoisRecord: WhoisRecord | null
|
|
85
|
-
geolocation: Geolocation | null
|
|
83
|
+
autonomousSystem: AutonomousSystem | null
|
|
84
|
+
whoisRecord: WhoisRecord | null
|
|
85
|
+
geolocation: Geolocation | null
|
|
86
86
|
|
|
87
|
-
dnsRecords: DnsRecord[] | null
|
|
88
|
-
reverseDnsNames: ReverseDnsName[] | null
|
|
89
|
-
cpes: CPE[] | null
|
|
90
|
-
ports: Port[] | null
|
|
87
|
+
dnsRecords: DnsRecord[] | null
|
|
88
|
+
reverseDnsNames: ReverseDnsName[] | null
|
|
89
|
+
cpes: CPE[] | null
|
|
90
|
+
ports: Port[] | null
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export interface ArtifactWithTags extends Artifact {
|
|
94
|
-
tags: string[]
|
|
94
|
+
tags: string[]
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export interface Alert {
|
|
98
|
-
id: string
|
|
99
|
-
ruleId: string
|
|
100
|
-
createdAt: string
|
|
98
|
+
id: string
|
|
99
|
+
ruleId: string
|
|
100
|
+
createdAt: string
|
|
101
101
|
|
|
102
|
-
tags: Tag[]
|
|
103
|
-
artifacts: Artifact[]
|
|
102
|
+
tags: Tag[]
|
|
103
|
+
artifacts: Artifact[]
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export interface Alerts extends Pagination {
|
|
107
|
-
alerts: Alert[]
|
|
107
|
+
alerts: Alert[]
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export interface PaginationParams {
|
|
111
|
-
page: number | undefined
|
|
111
|
+
page: number | undefined
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
export interface AlertSearchParams extends PaginationParams {
|
|
115
|
-
artifact: string | undefined
|
|
116
|
-
ruleId: string | undefined
|
|
117
|
-
tag: string | undefined
|
|
118
|
-
fromAt: string | undefined
|
|
119
|
-
toAt: string | undefined
|
|
115
|
+
artifact: string | undefined
|
|
116
|
+
ruleId: string | undefined
|
|
117
|
+
tag: string | undefined
|
|
118
|
+
fromAt: string | undefined
|
|
119
|
+
toAt: string | undefined
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export interface IPInfo {
|
|
123
|
-
ip: string
|
|
124
|
-
hostname: string | null
|
|
125
|
-
loc: string
|
|
126
|
-
countryCode: string
|
|
127
|
-
asn: string
|
|
123
|
+
ip: string
|
|
124
|
+
hostname: string | null
|
|
125
|
+
loc: string
|
|
126
|
+
countryCode: string
|
|
127
|
+
asn: string
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export interface GCS {
|
|
131
|
-
lat: number
|
|
132
|
-
long: number
|
|
131
|
+
lat: number
|
|
132
|
+
long: number
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
export interface Country {
|
|
136
|
-
name: string
|
|
137
|
-
code: string
|
|
138
|
-
lat: number
|
|
139
|
-
long: number
|
|
136
|
+
name: string
|
|
137
|
+
code: string
|
|
138
|
+
lat: number
|
|
139
|
+
long: number
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export type LinkType = "ip" | "domain" | "url" | "hash"
|
|
142
|
+
export type LinkType = "ip" | "domain" | "url" | "hash"
|
|
143
143
|
|
|
144
144
|
export interface Link {
|
|
145
|
-
name: string
|
|
146
|
-
type: string
|
|
147
|
-
baseURL: string
|
|
145
|
+
name: string
|
|
146
|
+
type: string
|
|
147
|
+
baseURL: string
|
|
148
148
|
// eslint-disable-next-line no-unused-vars
|
|
149
|
-
href(data: string): string
|
|
150
|
-
favicon(): string
|
|
149
|
+
href(data: string): string
|
|
150
|
+
favicon(): string
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
export interface Rule {
|
|
154
|
-
id: string
|
|
155
|
-
title: string
|
|
156
|
-
description: string
|
|
157
|
-
yaml: string
|
|
158
|
-
createdAt: string
|
|
159
|
-
updatedAt: string
|
|
160
|
-
tags: Tag[]
|
|
154
|
+
id: string
|
|
155
|
+
title: string
|
|
156
|
+
description: string
|
|
157
|
+
yaml: string
|
|
158
|
+
createdAt: string
|
|
159
|
+
updatedAt: string
|
|
160
|
+
tags: Tag[]
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
export interface CreateRule {
|
|
164
|
-
yaml: string
|
|
164
|
+
yaml: string
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export interface UpdateRule {
|
|
168
|
-
id: string
|
|
169
|
-
yaml: string
|
|
168
|
+
id: string
|
|
169
|
+
yaml: string
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
export interface Query {
|
|
173
|
-
analyzer: string
|
|
174
|
-
query: string
|
|
175
|
-
interval: null
|
|
173
|
+
analyzer: string
|
|
174
|
+
query: string
|
|
175
|
+
interval: null
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
export interface Rules extends Pagination {
|
|
179
|
-
rules: Rule[]
|
|
179
|
+
rules: Rule[]
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
export interface RuleSearchParams extends PaginationParams {
|
|
183
|
-
description: string | undefined
|
|
184
|
-
tag: string | undefined
|
|
185
|
-
title: string | undefined
|
|
186
|
-
fromAt: string | undefined
|
|
187
|
-
toAt: string | undefined
|
|
183
|
+
description: string | undefined
|
|
184
|
+
tag: string | undefined
|
|
185
|
+
title: string | undefined
|
|
186
|
+
fromAt: string | undefined
|
|
187
|
+
toAt: string | undefined
|
|
188
188
|
}
|
data/frontend/src/utils.ts
CHANGED
|
@@ -1,60 +1,54 @@
|
|
|
1
|
-
import dayjs from "dayjs"
|
|
2
|
-
import relativeTime from "dayjs/plugin/relativeTime"
|
|
3
|
-
import timezone from "dayjs/plugin/timezone"
|
|
4
|
-
import utc from "dayjs/plugin/utc"
|
|
5
|
-
import { LocationQueryValue } from "vue-router"
|
|
1
|
+
import dayjs from "dayjs"
|
|
2
|
+
import relativeTime from "dayjs/plugin/relativeTime"
|
|
3
|
+
import timezone from "dayjs/plugin/timezone"
|
|
4
|
+
import utc from "dayjs/plugin/utc"
|
|
5
|
+
import type { LocationQueryValue } from "vue-router"
|
|
6
6
|
|
|
7
|
-
import { getCountryByCode } from "@/countries"
|
|
8
|
-
import { GCS, IPInfo } from "@/types"
|
|
7
|
+
import { getCountryByCode } from "@/countries"
|
|
8
|
+
import type { GCS, IPInfo } from "@/types"
|
|
9
9
|
|
|
10
|
-
dayjs.extend(relativeTime)
|
|
11
|
-
dayjs.extend(timezone)
|
|
12
|
-
dayjs.extend(utc)
|
|
10
|
+
dayjs.extend(relativeTime)
|
|
11
|
+
dayjs.extend(timezone)
|
|
12
|
+
dayjs.extend(utc)
|
|
13
13
|
|
|
14
14
|
export function getLocalDatetime(datetime: string): string {
|
|
15
|
-
return dayjs(datetime).local().format("YYYY-MM-DD HH:mm:ss")
|
|
15
|
+
return dayjs(datetime).local().format("YYYY-MM-DD HH:mm:ss")
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function getHumanizedRelativeTime(datetime: string): string {
|
|
19
|
-
return dayjs(datetime).local().fromNow()
|
|
19
|
+
return dayjs(datetime).local().fromNow()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function getGCSByCountryCode(countryCode: string): GCS | undefined {
|
|
23
|
-
const country = getCountryByCode(countryCode)
|
|
23
|
+
const country = getCountryByCode(countryCode)
|
|
24
24
|
if (country !== undefined) {
|
|
25
|
-
return { lat: country.lat, long: country.long }
|
|
25
|
+
return { lat: country.lat, long: country.long }
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export function getGCSByIPInfo(ipinfo: IPInfo): GCS | undefined {
|
|
30
30
|
if (ipinfo.loc !== undefined) {
|
|
31
|
-
const numbers = ipinfo.loc.split(",")
|
|
31
|
+
const numbers = ipinfo.loc.split(",")
|
|
32
32
|
if (numbers.length === 2) {
|
|
33
|
-
const lat = numbers[0]
|
|
34
|
-
const long = numbers[1]
|
|
33
|
+
const lat = numbers[0]
|
|
34
|
+
const long = numbers[1]
|
|
35
35
|
|
|
36
|
-
return { lat: parseFloat(lat), long: parseFloat(long) }
|
|
36
|
+
return { lat: parseFloat(lat), long: parseFloat(long) }
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
return getGCSByCountryCode(ipinfo.countryCode)
|
|
39
|
+
return getGCSByCountryCode(ipinfo.countryCode)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function normalizeQueryParam(
|
|
43
|
-
param:
|
|
44
|
-
| undefined
|
|
45
|
-
| null
|
|
46
|
-
| string
|
|
47
|
-
| string[]
|
|
48
|
-
| LocationQueryValue
|
|
49
|
-
| LocationQueryValue[]
|
|
43
|
+
param: undefined | null | string | string[] | LocationQueryValue | LocationQueryValue[]
|
|
50
44
|
): string | undefined {
|
|
51
45
|
if (param === undefined || param === null) {
|
|
52
|
-
return undefined
|
|
46
|
+
return undefined
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
if (typeof param === "string") {
|
|
56
|
-
return param
|
|
50
|
+
return param
|
|
57
51
|
}
|
|
58
52
|
|
|
59
|
-
return param.toString()
|
|
53
|
+
return param.toString()
|
|
60
54
|
}
|