mihari 5.3.0 → 5.3.2

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +8 -2
  3. data/frontend/package-lock.json +657 -576
  4. data/frontend/package.json +23 -20
  5. data/frontend/src/ace-config.ts +6 -0
  6. data/frontend/src/components/Loading.vue +1 -1
  7. data/frontend/src/components/alert/Alert.vue +1 -1
  8. data/frontend/src/components/alert/AlertsWrapper.vue +1 -1
  9. data/frontend/src/components/alert/Form.vue +2 -2
  10. data/frontend/src/components/artifact/Artifact.vue +3 -3
  11. data/frontend/src/components/config/Configs.vue +2 -2
  12. data/frontend/src/components/rule/EditRule.vue +4 -3
  13. data/frontend/src/components/rule/Form.vue +2 -2
  14. data/frontend/src/components/rule/InputForm.vue +18 -59
  15. data/frontend/src/components/rule/NewRule.vue +1 -1
  16. data/frontend/src/components/rule/Rule.vue +3 -3
  17. data/frontend/src/components/rule/RulesWrapper.vue +1 -1
  18. data/frontend/src/components/rule/YAML.vue +21 -28
  19. data/frontend/src/main.ts +33 -3
  20. data/frontend/src/views/Artifact.vue +3 -8
  21. data/frontend/src/views/EditRule.vue +2 -7
  22. data/frontend/src/views/Rule.vue +3 -8
  23. data/lib/mihari/analyzers/base.rb +6 -0
  24. data/lib/mihari/analyzers/binaryedge.rb +1 -1
  25. data/lib/mihari/analyzers/censys.rb +1 -1
  26. data/lib/mihari/analyzers/onyphe.rb +1 -1
  27. data/lib/mihari/analyzers/rule.rb +4 -7
  28. data/lib/mihari/analyzers/shodan.rb +1 -1
  29. data/lib/mihari/analyzers/urlscan.rb +1 -1
  30. data/lib/mihari/analyzers/virustotal_intelligence.rb +1 -1
  31. data/lib/mihari/analyzers/zoomeye.rb +2 -2
  32. data/lib/mihari/commands/rule.rb +3 -3
  33. data/lib/mihari/commands/search.rb +3 -3
  34. data/lib/mihari/constants.rb +3 -0
  35. data/lib/mihari/emitters/base.rb +2 -2
  36. data/lib/mihari/emitters/misp.rb +3 -3
  37. data/lib/mihari/emitters/slack.rb +1 -1
  38. data/lib/mihari/emitters/the_hive.rb +1 -1
  39. data/lib/mihari/emitters/webhook.rb +1 -1
  40. data/lib/mihari/mixins/configurable.rb +5 -0
  41. data/lib/mihari/mixins/falsepositive.rb +1 -1
  42. data/lib/mihari/mixins/retriable.rb +0 -2
  43. data/lib/mihari/{structs → services}/rule.rb +16 -16
  44. data/lib/mihari/version.rb +1 -1
  45. data/lib/mihari/web/endpoints/rules.rb +9 -8
  46. data/lib/mihari/web/public/assets/index-116033d0.js +1737 -0
  47. data/lib/mihari/web/public/assets/index-33165282.css +1 -0
  48. data/lib/mihari/web/public/assets/mode-yaml-a21faa53.js +8 -0
  49. data/lib/mihari/web/public/index.html +2 -2
  50. data/lib/mihari.rb +3 -2
  51. data/mihari.gemspec +5 -4
  52. metadata +15 -21
  53. data/lib/mihari/web/public/assets/fa-brands-400-20c4a58b.ttf +0 -0
  54. data/lib/mihari/web/public/assets/fa-brands-400-74833209.woff2 +0 -0
  55. data/lib/mihari/web/public/assets/fa-regular-400-528d022d.ttf +0 -0
  56. data/lib/mihari/web/public/assets/fa-regular-400-8e7e5ea1.woff2 +0 -0
  57. data/lib/mihari/web/public/assets/fa-solid-900-67a65763.ttf +0 -0
  58. data/lib/mihari/web/public/assets/fa-solid-900-7152a693.woff2 +0 -0
  59. data/lib/mihari/web/public/assets/fa-v4compatibility-0515a423.ttf +0 -0
  60. data/lib/mihari/web/public/assets/fa-v4compatibility-694a17c3.woff2 +0 -0
  61. data/lib/mihari/web/public/assets/index-2ba8f0a6.css +0 -5
  62. data/lib/mihari/web/public/assets/index-71285b15.js +0 -50
@@ -14,13 +14,17 @@
14
14
  "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
15
15
  },
16
16
  "dependencies": {
17
- "@fortawesome/fontawesome-free": "^6.4.0",
18
- "@vueuse/core": "^10.2.1",
19
- "@vueuse/router": "^10.2.1",
17
+ "@fortawesome/fontawesome-svg-core": "^6.4.2",
18
+ "@fortawesome/free-solid-svg-icons": "^6.4.2",
19
+ "@fortawesome/vue-fontawesome": "^3.0.3",
20
+ "@vueuse/core": "^10.3.0",
21
+ "@vueuse/router": "^10.3.0",
22
+ "ace-builds": "^1.23.4",
20
23
  "axios": "^1.4.0",
21
24
  "bulma": "^0.9.4",
22
25
  "bulma-helpers": "^0.4.3",
23
26
  "dayjs": "^1.11.9",
27
+ "font-awesome-animation": "^1.1.1",
24
28
  "js-sha256": "^0.9.0",
25
29
  "truncate": "^3.0.0",
26
30
  "ts-dedent": "^2.2.0",
@@ -29,36 +33,35 @@
29
33
  "vue": "^3.3.4",
30
34
  "vue-concurrency": "4.0.1",
31
35
  "vue-json-pretty": "^2.2.4",
32
- "vue-prism-editor": "^2.0.0-alpha.2",
33
- "vue-router": "^4.2.4"
36
+ "vue-router": "^4.2.4",
37
+ "vue3-ace-editor": "^2.2.3"
34
38
  },
35
39
  "devDependencies": {
36
- "@redocly/cli": "^1.0.0-beta.131",
40
+ "@redocly/cli": "1.0.0",
37
41
  "@rushstack/eslint-patch": "^1.3.2",
38
- "@tsconfig/node20": "^1.0.2",
42
+ "@tsconfig/node20": "^20.1.1",
39
43
  "@types/jsdom": "^21.1.1",
40
- "@types/node": "^20.4.2",
41
- "@types/prismjs": "^1.26.0",
44
+ "@types/node": "^20.4.8",
42
45
  "@types/url-parse": "^1.4.8",
43
- "@typescript-eslint/eslint-plugin": "^6.0.0",
44
- "@typescript-eslint/parser": "^6.0.0",
46
+ "@typescript-eslint/eslint-plugin": "^6.2.1",
47
+ "@typescript-eslint/parser": "^6.2.1",
45
48
  "@vitejs/plugin-vue": "^4.2.3",
46
- "@vue/eslint-config-prettier": "^7.1.0",
49
+ "@vue/eslint-config-prettier": "^8.0.0",
47
50
  "@vue/eslint-config-typescript": "^11.0.3",
48
- "@vue/test-utils": "2.4.0",
51
+ "@vue/test-utils": "2.4.1",
49
52
  "@vue/tsconfig": "^0.4.0",
50
- "eslint": "^8.45.0",
51
- "eslint-config-prettier": "^8.8.0",
53
+ "eslint": "^8.46.0",
54
+ "eslint-config-prettier": "^9.0.0",
52
55
  "eslint-plugin-prettier": "^5.0.0",
53
56
  "eslint-plugin-simple-import-sort": "^10.0.0",
54
- "eslint-plugin-vue": "^9.15.1",
57
+ "eslint-plugin-vue": "^9.16.1",
55
58
  "husky": "^8.0.3",
56
59
  "jsdom": "^22.1.0",
57
60
  "npm-run-all": "^4.1.5",
58
- "prettier": "^3.0.0",
61
+ "prettier": "^3.0.1",
59
62
  "typescript": "~5.1.6",
60
- "vite": "^4.4.4",
61
- "vitest": "^0.33.0",
62
- "vue-tsc": "^1.8.5"
63
+ "vite": "^4.4.9",
64
+ "vitest": "^0.34.1",
65
+ "vue-tsc": "^1.8.8"
63
66
  }
64
67
  }
@@ -0,0 +1,6 @@
1
+ import ace from "ace-builds"
2
+ import modeYamlUrl from "ace-builds/src-min-noconflict/mode-yaml?url"
3
+ import themeMonokaiUrl from "ace-builds/src-min-noconflict/theme-monokai?url"
4
+
5
+ ace.config.setModuleUrl("ace/mode/yaml", modeYamlUrl)
6
+ ace.config.setModuleUrl("ace/theme/monokai", themeMonokaiUrl)
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="has-text-centered">
3
3
  <div class="fa-3x">
4
- <i class="fas fa-spinner fa-spin"></i>
4
+ <font-awesome-icon icon="spinner" spin></font-awesome-icon>
5
5
  </div>
6
6
  </div>
7
7
  </template>
@@ -8,7 +8,7 @@
8
8
  <button class="button is-light is-small is-pulled-right" @click="deleteAlert">
9
9
  <span>Delete</span>
10
10
  <span class="icon is-small">
11
- <i class="fas fa-times"></i>
11
+ <font-awesome-icon icon="times"></font-awesome-icon>
12
12
  </span>
13
13
  </button>
14
14
  </td>
@@ -16,7 +16,7 @@
16
16
  <p class="control">
17
17
  <a class="button is-primary" @click="search">
18
18
  <span class="icon is-small">
19
- <i class="fas fa-search"></i>
19
+ <font-awesome-icon icon="search"></font-awesome-icon>
20
20
  </span>
21
21
  <span>Search</span>
22
22
  </a>
@@ -95,7 +95,7 @@
95
95
  </template>
96
96
 
97
97
  <script lang="ts">
98
- import { defineComponent, type PropType, ref, watch } from "vue"
98
+ import { defineComponent, type PropType, ref, toRef,watch } from "vue"
99
99
  import { useRoute } from "vue-router"
100
100
 
101
101
  import type { AlertSearchParams } from "@/types"
@@ -126,7 +126,7 @@ export default defineComponent({
126
126
 
127
127
  const artifact = ref<string | undefined>(undefined)
128
128
  const fromAt = ref<string | undefined>(undefined)
129
- const tagInput = ref<string | undefined>(props.tag)
129
+ const tagInput = toRef(props, "tag")
130
130
  const ruleId = ref<string | undefined>(undefined)
131
131
  const toAt = ref<string | undefined>(undefined)
132
132
  const asn = ref<number | undefined>(undefined)
@@ -44,7 +44,7 @@
44
44
  <button class="button is-primary is-light is-small" @click="enrichArtifact">
45
45
  <span>Enrich</span>
46
46
  <span class="icon is-small">
47
- <i class="fas fa-lightbulb"></i>
47
+ <font-awesome-icon icon="lightbulb"></font-awesome-icon>
48
48
  </span>
49
49
  </button>
50
50
 
@@ -55,14 +55,14 @@
55
55
  >
56
56
  <span>Metadata</span>
57
57
  <span class="icon is-small">
58
- <i class="fas fa-info-circle"></i>
58
+ <font-awesome-icon icon="info-circle"></font-awesome-icon>
59
59
  </span>
60
60
  </button>
61
61
 
62
62
  <button class="button is-light is-small" @click="deleteArtifact">
63
63
  <span>Delete</span>
64
64
  <span class="icon is-small">
65
- <i class="fas fa-times"></i>
65
+ <font-awesome-icon icon="times"></font-awesome-icon>
66
66
  </span>
67
67
  </button>
68
68
  </span>
@@ -21,13 +21,13 @@
21
21
  <td>
22
22
  <button class="button is-success is-small ml-1" v-if="config.isConfigured">
23
23
  <span class="icon is-small">
24
- <i class="fas fa-check"></i>
24
+ <font-awesome-icon icon="check"></font-awesome-icon>
25
25
  </span>
26
26
  <span>Yes</span>
27
27
  </button>
28
28
  <button class="button is-warning is-small ml-1" v-else>
29
29
  <span class="icon is-small">
30
- <i class="fas fa-exclamation"></i>
30
+ <font-awesome-icon icon="exclamation"></font-awesome-icon>
31
31
  </span>
32
32
  <span>No</span>
33
33
  </button>
@@ -8,7 +8,7 @@
8
8
  <p class="control">
9
9
  <a class="button is-primary" @click="edit">
10
10
  <span class="icon is-small">
11
- <i class="fas fa-edit"></i>
11
+ <font-awesome-icon icon="edit"></font-awesome-icon>
12
12
  </span>
13
13
  <span>Edit</span>
14
14
  </a>
@@ -23,7 +23,7 @@
23
23
  </template>
24
24
 
25
25
  <script lang="ts">
26
- import { defineComponent, type PropType, ref } from "vue"
26
+ import { defineComponent, type PropType, toRef } from "vue"
27
27
  import { useRouter } from "vue-router"
28
28
 
29
29
  import { generateUpdateRuleTask } from "@/api-helper"
@@ -46,7 +46,8 @@ export default defineComponent({
46
46
  setup(props) {
47
47
  const router = useRouter()
48
48
 
49
- const yaml = ref(props.rule.yaml)
49
+ const rule = toRef(props, "rule")
50
+ const yaml = toRef(rule.value, "yaml")
50
51
 
51
52
  const updateRuleTask = generateUpdateRuleTask()
52
53
 
@@ -88,7 +88,7 @@
88
88
  </template>
89
89
 
90
90
  <script lang="ts">
91
- import { defineComponent, type PropType, ref, watch } from "vue"
91
+ import { defineComponent, type PropType, ref, toRef,watch } from "vue"
92
92
  import { useRoute } from "vue-router"
93
93
 
94
94
  import type { RuleSearchParams } from "@/types"
@@ -115,7 +115,7 @@ export default defineComponent({
115
115
 
116
116
  const description = ref<string | undefined>(undefined)
117
117
  const fromAt = ref<string | undefined>(undefined)
118
- const tagInput = ref<string | undefined>(props.tag)
118
+ const tagInput = toRef(props, "tag")
119
119
  const title = ref<string | undefined>(undefined)
120
120
  const toAt = ref<string | undefined>(undefined)
121
121
 
@@ -1,31 +1,29 @@
1
1
  <template>
2
- <div class="block my-editor-wrapper" ref="wrapper">
3
- <PrismEditor
4
- class="my-editor"
5
- v-model="yamlInput"
6
- :highlight="highlighter"
7
- line-numbers
8
- ></PrismEditor>
2
+ <div class="block">
3
+ <VAceEditor
4
+ class="vue-ace-editor"
5
+ v-model:value="yamlInput"
6
+ lang="yaml"
7
+ theme="monokai"
8
+ :options="{
9
+ fontSize: 16,
10
+ minLines: 6,
11
+ maxLines: 10000
12
+ }"
13
+ ></VAceEditor>
9
14
  </div>
10
15
  </template>
11
16
 
12
17
  <script lang="ts">
13
- // eslint-disable-next-line simple-import-sort/imports
14
- import "vue-prism-editor/dist/prismeditor.min.css"
18
+ import "@/ace-config"
15
19
 
16
- import { defineComponent, ref, watchEffect } from "vue"
17
- import { PrismEditor } from "vue-prism-editor"
18
-
19
- import Prism from "prismjs"
20
-
21
- import "prismjs/components/prism-yaml"
22
- import "prismjs/plugins/custom-class/prism-custom-class"
23
- import "prismjs/themes/prism-twilight.css"
20
+ import { defineComponent, toRef, watchEffect } from "vue"
21
+ import { VAceEditor } from "vue3-ace-editor"
24
22
 
25
23
  export default defineComponent({
26
24
  name: "RuleInputForm",
27
25
  components: {
28
- PrismEditor
26
+ VAceEditor
29
27
  },
30
28
  props: {
31
29
  yaml: {
@@ -35,52 +33,13 @@ export default defineComponent({
35
33
  },
36
34
  emits: ["update-yaml"],
37
35
  setup(props, context) {
38
- const yamlInput = ref(props.yaml)
39
- const wrapper = ref<HTMLElement | undefined>(undefined)
40
-
41
- Prism.plugins.customClass.map({
42
- number: "prism-number",
43
- tag: "prism-tag"
44
- })
45
-
46
- const highlighter = (code: string) => {
47
- return Prism.highlight(code, Prism.languages.yaml, "yaml")
48
- }
36
+ const yamlInput = toRef(props, "yaml")
49
37
 
50
38
  watchEffect(() => {
51
39
  context.emit("update-yaml", yamlInput.value)
52
-
53
- // TODO: a dirty hack to change the default text color
54
- if (wrapper.value) {
55
- const strings = wrapper.value.querySelectorAll(":not(span.token)")
56
- strings.forEach((string) => {
57
- ;(string as HTMLElement).style.color = "white"
58
- })
59
- }
60
40
  })
61
41
 
62
- return { yamlInput, highlighter, wrapper }
42
+ return { yamlInput }
63
43
  }
64
44
  })
65
45
  </script>
66
-
67
- <style scoped>
68
- .my-editor {
69
- background: hsl(0, 0%, 8%);
70
- font-family:
71
- Fira code,
72
- Fira Mono,
73
- Consolas,
74
- Menlo,
75
- Courier,
76
- monospace;
77
- font-size: 1em;
78
- line-height: 1.5;
79
- padding: 5px;
80
- }
81
-
82
- .my-editor-wrapper {
83
- background: hsl(0, 0%, 8%);
84
- padding: 10px;
85
- }
86
- </style>
@@ -8,7 +8,7 @@
8
8
  <p class="control">
9
9
  <a class="button is-primary" @click="create">
10
10
  <span class="icon is-small">
11
- <i class="fas fa-plus"></i>
11
+ <font-awesome-icon icon="plus"></font-awesome-icon>
12
12
  </span>
13
13
  <span>Create</span>
14
14
  </a>
@@ -17,7 +17,7 @@
17
17
  <button class="button is-primary is-light is-small" @click="runRule">
18
18
  <span>Run</span>
19
19
  <span class="icon is-small">
20
- <i class="fas fa-arrow-right"></i>
20
+ <font-awesome-icon icon="arrow-right"></font-awesome-icon>
21
21
  </span>
22
22
  </button>
23
23
  <router-link
@@ -26,13 +26,13 @@
26
26
  >
27
27
  <span>Edit</span>
28
28
  <span class="icon is-small">
29
- <i class="fas fa-edit"></i>
29
+ <font-awesome-icon icon="edit"></font-awesome-icon>
30
30
  </span>
31
31
  </router-link>
32
32
  <button class="button is-light is-small" @click="deleteRule">
33
33
  <span>Delete</span>
34
34
  <span class="icon is-small">
35
- <i class="fas fa-times"></i>
35
+ <font-awesome-icon icon="times"></font-awesome-icon>
36
36
  </span>
37
37
  </button>
38
38
  </span>
@@ -14,7 +14,7 @@
14
14
  <p class="control">
15
15
  <a class="button is-primary" @click="search">
16
16
  <span class="icon is-small">
17
- <i class="fas fa-search"></i>
17
+ <font-awesome-icon icon="search"></font-awesome-icon>
18
18
  </span>
19
19
  <span>Search</span>
20
20
  </a>
@@ -1,44 +1,37 @@
1
1
  <template>
2
- <pre ref="pre" class="line-numbers"><code class="language-yaml">{{ yaml }}</code></pre>
2
+ <div class="block">
3
+ <VAceEditor
4
+ class="vue-ace-editor"
5
+ :value="yaml"
6
+ lang="yaml"
7
+ theme="monokai"
8
+ :options="{
9
+ readOnly: true,
10
+ fontSize: 16,
11
+ maxLines: 10000,
12
+ minLines: 6
13
+ }"
14
+ ></VAceEditor>
15
+ </div>
3
16
  </template>
4
17
 
5
18
  <script lang="ts">
6
- // eslint-disable-next-line simple-import-sort/imports
7
- import { defineComponent, onMounted, ref } from "vue"
19
+ import "@/ace-config"
8
20
 
9
- import Prism from "prismjs"
10
-
11
- import "prismjs/components/prism-yaml"
12
- import "prismjs/plugins/custom-class/prism-custom-class"
13
- import "prismjs/plugins/line-numbers/prism-line-numbers.css"
14
- import "prismjs/plugins/line-numbers/prism-line-numbers"
15
- import "prismjs/themes/prism-twilight.css"
21
+ import { defineComponent } from "vue"
22
+ import { VAceEditor } from "vue3-ace-editor"
16
23
 
17
24
  export default defineComponent({
18
25
  name: "YAML",
26
+ components: {
27
+ VAceEditor
28
+ },
19
29
  props: {
20
30
  yaml: {
21
31
  type: String,
22
32
  required: true
23
33
  }
24
34
  },
25
- setup() {
26
- const pre = ref<HTMLElement | undefined>(undefined)
27
-
28
- Prism.plugins.customClass.map({
29
- number: "prism-number",
30
- tag: "prism-tag"
31
- })
32
-
33
- onMounted(() => {
34
- if (pre.value) {
35
- pre.value.querySelectorAll("code").forEach((elem) => {
36
- Prism.highlightElement(elem)
37
- })
38
- }
39
- })
40
-
41
- return { pre }
42
- }
35
+ setup() {}
43
36
  })
44
37
  </script>
data/frontend/src/main.ts CHANGED
@@ -1,11 +1,41 @@
1
1
  import "bulma/css/bulma.css"
2
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"
3
+ import "font-awesome-animation/css/font-awesome-animation.min.css"
5
4
 
5
+ import { library } from "@fortawesome/fontawesome-svg-core"
6
+ import {
7
+ faArrowRight,
8
+ faCheck,
9
+ faEdit,
10
+ faExclamation,
11
+ faInfoCircle,
12
+ faLightbulb,
13
+ faPlus,
14
+ faSearch,
15
+ faSpinner,
16
+ faTimes
17
+ } from "@fortawesome/free-solid-svg-icons"
18
+ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"
6
19
  import { createApp } from "vue"
7
20
 
8
21
  import App from "@/App.vue"
9
22
  import router from "@/router"
10
23
 
11
- createApp(App).use(router).mount("#app")
24
+ library.add(
25
+ faArrowRight,
26
+ faCheck,
27
+ faEdit,
28
+ faExclamation,
29
+ faInfoCircle,
30
+ faLightbulb,
31
+ faPlus,
32
+ faSearch,
33
+ faSpinner,
34
+ faTimes
35
+ )
36
+
37
+ const app = createApp(App)
38
+
39
+ app.component("font-awesome-icon", FontAwesomeIcon)
40
+
41
+ app.use(router).mount("#app")
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <Artifact :id="artifactId"></Artifact>
2
+ <Artifact :id="id"></Artifact>
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
6
6
  import { useTitle } from "@vueuse/core"
7
- import { defineComponent, onMounted, ref, watch } from "vue"
7
+ import { defineComponent, onMounted, watch } from "vue"
8
8
 
9
9
  import Artifact from "@/components/artifact/ArtifactWrapper.vue"
10
10
 
@@ -20,10 +20,8 @@ export default defineComponent({
20
20
  }
21
21
  },
22
22
  setup(props) {
23
- const artifactId = ref<string>(props.id)
24
-
25
23
  const updateTitle = () => {
26
- useTitle(`Artifact:${artifactId.value} - Mihari`)
24
+ useTitle(`Artifact:${props.id} - Mihari`)
27
25
  }
28
26
 
29
27
  onMounted(() => {
@@ -33,12 +31,9 @@ export default defineComponent({
33
31
  watch(
34
32
  () => props.id,
35
33
  () => {
36
- artifactId.value = props.id
37
34
  updateTitle()
38
35
  }
39
36
  )
40
-
41
- return { artifactId }
42
37
  }
43
38
  })
44
39
  </script>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <script lang="ts">
6
6
  import { useTitle } from "@vueuse/core"
7
- import { defineComponent, onMounted, ref, watch } from "vue"
7
+ import { defineComponent, onMounted, watch } from "vue"
8
8
 
9
9
  import EditRule from "@/components/rule/EditRuleWrapper.vue"
10
10
 
@@ -20,10 +20,8 @@ export default defineComponent({
20
20
  }
21
21
  },
22
22
  setup(props) {
23
- const ruleId = ref<string>(props.id)
24
-
25
23
  const updateTitle = () => {
26
- useTitle(`Edit rule:${ruleId.value} - Mihari`)
24
+ useTitle(`Edit rule:${props.id} - Mihari`)
27
25
  }
28
26
 
29
27
  onMounted(() => {
@@ -33,12 +31,9 @@ export default defineComponent({
33
31
  watch(
34
32
  () => props.id,
35
33
  () => {
36
- ruleId.value = props.id
37
34
  updateTitle()
38
35
  }
39
36
  )
40
-
41
- return { ruleId }
42
37
  }
43
38
  })
44
39
  </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <Rule :id="ruleId"></Rule>
2
+ <Rule :id="id"></Rule>
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
6
6
  import { useTitle } from "@vueuse/core"
7
- import { defineComponent, onMounted, ref, watch } from "vue"
7
+ import { defineComponent, onMounted, watch } from "vue"
8
8
 
9
9
  import Rule from "@/components/rule/RuleWrapper.vue"
10
10
 
@@ -20,10 +20,8 @@ export default defineComponent({
20
20
  }
21
21
  },
22
22
  setup(props) {
23
- const ruleId = ref<string>(props.id)
24
-
25
23
  const updateTitle = () => {
26
- useTitle(`Rule:${ruleId.value} - Mihari`)
24
+ useTitle(`Rule:${props.id} - Mihari`)
27
25
  }
28
26
 
29
27
  onMounted(() => {
@@ -33,12 +31,9 @@ export default defineComponent({
33
31
  watch(
34
32
  () => props.id,
35
33
  () => {
36
- ruleId.value = props.id
37
34
  updateTitle()
38
35
  }
39
36
  )
40
-
41
- return { ruleId }
42
37
  }
43
38
  })
44
39
  </script>
@@ -73,6 +73,12 @@ module Mihari
73
73
 
74
74
  alias_method :source, :class_name
75
75
 
76
+ private
77
+
78
+ def sleep_interval
79
+ sleep(interval) if interval
80
+ end
81
+
76
82
  class << self
77
83
  #
78
84
  # Initialize an analyzer by query params
@@ -64,7 +64,7 @@ module Mihari
64
64
  break if total <= page * PAGE_SIZE
65
65
 
66
66
  # sleep #{interval} seconds to avoid the rate limitation (if it is set)
67
- sleep(interval) if interval
67
+ sleep_interval
68
68
  end
69
69
  responses
70
70
  end
@@ -42,7 +42,7 @@ module Mihari
42
42
  break if cursor.nil? || cursor.empty?
43
43
 
44
44
  # sleep #{interval} seconds to avoid the rate limitation (if it is set)
45
- sleep(interval) if interval
45
+ sleep_interval
46
46
  end
47
47
 
48
48
  artifacts.flatten.uniq(&:data)
@@ -65,7 +65,7 @@ module Mihari
65
65
  break if total <= page * PAGE_SIZE
66
66
 
67
67
  # sleep #{interval} seconds to avoid the rate limitation (if it is set)
68
- sleep(interval) if interval
68
+ sleep_interval
69
69
  end
70
70
  responses
71
71
  end