mihari 5.6.2 → 5.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/README.md +1 -0
  4. data/config.ru +1 -1
  5. data/lib/mihari/actor.rb +18 -2
  6. data/lib/mihari/analyzers/base.rb +13 -12
  7. data/lib/mihari/analyzers/binaryedge.rb +4 -1
  8. data/lib/mihari/analyzers/censys.rb +4 -2
  9. data/lib/mihari/analyzers/circl.rb +4 -1
  10. data/lib/mihari/analyzers/crtsh.rb +4 -1
  11. data/lib/mihari/analyzers/dnstwister.rb +4 -1
  12. data/lib/mihari/analyzers/feed.rb +3 -0
  13. data/lib/mihari/analyzers/fofa.rb +65 -0
  14. data/lib/mihari/analyzers/greynoise.rb +4 -1
  15. data/lib/mihari/analyzers/hunterhow.rb +6 -1
  16. data/lib/mihari/analyzers/onyphe.rb +4 -1
  17. data/lib/mihari/analyzers/otx.rb +4 -1
  18. data/lib/mihari/analyzers/passivetotal.rb +4 -1
  19. data/lib/mihari/analyzers/pulsedive.rb +3 -0
  20. data/lib/mihari/analyzers/securitytrails.rb +4 -1
  21. data/lib/mihari/analyzers/shodan.rb +4 -1
  22. data/lib/mihari/analyzers/urlscan.rb +4 -1
  23. data/lib/mihari/analyzers/virustotal.rb +4 -1
  24. data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -1
  25. data/lib/mihari/analyzers/zoomeye.rb +5 -2
  26. data/lib/mihari/cli/alert.rb +3 -0
  27. data/lib/mihari/cli/base.rb +3 -0
  28. data/lib/mihari/cli/database.rb +3 -0
  29. data/lib/mihari/cli/main.rb +3 -0
  30. data/lib/mihari/cli/rule.rb +3 -0
  31. data/lib/mihari/clients/base.rb +3 -0
  32. data/lib/mihari/clients/binaryedge.rb +5 -2
  33. data/lib/mihari/clients/censys.rb +7 -4
  34. data/lib/mihari/clients/circl.rb +3 -0
  35. data/lib/mihari/clients/crtsh.rb +3 -0
  36. data/lib/mihari/clients/dnstwister.rb +3 -0
  37. data/lib/mihari/clients/fofa.rb +83 -0
  38. data/lib/mihari/clients/greynoise.rb +5 -2
  39. data/lib/mihari/clients/hunterhow.rb +5 -2
  40. data/lib/mihari/clients/misp.rb +3 -0
  41. data/lib/mihari/clients/onyphe.rb +5 -2
  42. data/lib/mihari/clients/otx.rb +3 -0
  43. data/lib/mihari/clients/passivetotal.rb +3 -0
  44. data/lib/mihari/clients/publsedive.rb +4 -1
  45. data/lib/mihari/clients/securitytrails.rb +3 -0
  46. data/lib/mihari/clients/shodan.rb +5 -2
  47. data/lib/mihari/clients/the_hive.rb +3 -0
  48. data/lib/mihari/clients/urlscan.rb +7 -4
  49. data/lib/mihari/clients/virustotal.rb +5 -2
  50. data/lib/mihari/clients/zoomeye.rb +3 -0
  51. data/lib/mihari/commands/alert.rb +9 -16
  52. data/lib/mihari/commands/database.rb +3 -0
  53. data/lib/mihari/commands/rule.rb +10 -1
  54. data/lib/mihari/commands/search.rb +13 -29
  55. data/lib/mihari/commands/version.rb +3 -0
  56. data/lib/mihari/commands/web.rb +4 -1
  57. data/lib/mihari/config.rb +139 -150
  58. data/lib/mihari/constants.rb +1 -1
  59. data/lib/mihari/database.rb +6 -0
  60. data/lib/mihari/emitters/base.rb +13 -11
  61. data/lib/mihari/emitters/database.rb +4 -1
  62. data/lib/mihari/emitters/misp.rb +7 -4
  63. data/lib/mihari/emitters/slack.rb +3 -3
  64. data/lib/mihari/emitters/the_hive.rb +3 -3
  65. data/lib/mihari/emitters/webhook.rb +4 -3
  66. data/lib/mihari/enrichers/base.rb +15 -9
  67. data/lib/mihari/enrichers/google_public_dns.rb +6 -5
  68. data/lib/mihari/enrichers/ipinfo.rb +11 -9
  69. data/lib/mihari/enrichers/shodan.rb +4 -6
  70. data/lib/mihari/enrichers/whois.rb +12 -9
  71. data/lib/mihari/entities/tag.rb +1 -0
  72. data/lib/mihari/errors.rb +6 -0
  73. data/lib/mihari/feed/parser.rb +3 -0
  74. data/lib/mihari/feed/reader.rb +3 -0
  75. data/lib/mihari/http.rb +6 -0
  76. data/lib/mihari/mixins/autonomous_system.rb +3 -0
  77. data/lib/mihari/mixins/configurable.rb +3 -0
  78. data/lib/mihari/mixins/error_notification.rb +3 -0
  79. data/lib/mihari/mixins/falsepositive.rb +3 -0
  80. data/lib/mihari/mixins/refang.rb +3 -0
  81. data/lib/mihari/mixins/retriable.rb +6 -2
  82. data/lib/mihari/models/alert.rb +7 -4
  83. data/lib/mihari/models/artifact.rb +6 -0
  84. data/lib/mihari/models/autonomous_system.rb +4 -1
  85. data/lib/mihari/models/cpe.rb +4 -1
  86. data/lib/mihari/models/dns.rb +4 -1
  87. data/lib/mihari/models/geolocation.rb +4 -1
  88. data/lib/mihari/models/port.rb +4 -1
  89. data/lib/mihari/models/reverse_dns.rb +4 -1
  90. data/lib/mihari/models/rule.rb +6 -3
  91. data/lib/mihari/models/tag.rb +3 -0
  92. data/lib/mihari/models/tagging.rb +3 -0
  93. data/lib/mihari/models/whois.rb +4 -3
  94. data/lib/mihari/rule.rb +31 -12
  95. data/lib/mihari/schemas/alert.rb +3 -0
  96. data/lib/mihari/schemas/analyzer.rb +11 -0
  97. data/lib/mihari/schemas/emitter.rb +3 -0
  98. data/lib/mihari/schemas/enricher.rb +3 -0
  99. data/lib/mihari/schemas/macros.rb +4 -0
  100. data/lib/mihari/schemas/mixins.rb +5 -0
  101. data/lib/mihari/schemas/rule.rb +3 -0
  102. data/lib/mihari/service.rb +26 -0
  103. data/lib/mihari/services/alert_builder.rb +85 -9
  104. data/lib/mihari/services/alert_runner.rb +8 -19
  105. data/lib/mihari/services/rule_builder.rb +13 -12
  106. data/lib/mihari/services/rule_runner.rb +7 -32
  107. data/lib/mihari/structs/binaryedge.rb +22 -28
  108. data/lib/mihari/structs/censys.rb +48 -141
  109. data/lib/mihari/structs/config.rb +19 -30
  110. data/lib/mihari/structs/filters.rb +38 -0
  111. data/lib/mihari/structs/fofa.rb +47 -0
  112. data/lib/mihari/structs/google_public_dns.rb +10 -32
  113. data/lib/mihari/structs/greynoise.rb +33 -90
  114. data/lib/mihari/structs/hunterhow.rb +24 -28
  115. data/lib/mihari/structs/ipinfo.rb +14 -37
  116. data/lib/mihari/structs/onyphe.rb +31 -80
  117. data/lib/mihari/structs/shodan.rb +47 -114
  118. data/lib/mihari/structs/urlscan.rb +24 -69
  119. data/lib/mihari/structs/virustotal_intelligence.rb +20 -64
  120. data/lib/mihari/type_checker.rb +4 -0
  121. data/lib/mihari/types.rb +3 -0
  122. data/lib/mihari/version.rb +1 -1
  123. data/lib/mihari/web/api.rb +15 -10
  124. data/lib/mihari/web/app.rb +64 -56
  125. data/lib/mihari/web/endpoints/alerts.rb +127 -85
  126. data/lib/mihari/web/endpoints/artifacts.rb +91 -79
  127. data/lib/mihari/web/endpoints/configs.rb +18 -13
  128. data/lib/mihari/web/endpoints/ip_addresses.rb +35 -15
  129. data/lib/mihari/web/endpoints/rules.rb +236 -187
  130. data/lib/mihari/web/endpoints/tags.rb +42 -35
  131. data/lib/mihari/web/middleware/connection_adapter.rb +16 -9
  132. data/lib/mihari/web/middleware/error_notification_adapter.rb +17 -10
  133. data/lib/mihari/web/public/assets/{index-28d4c79d.js → index-07fafab5.js} +31 -30
  134. data/lib/mihari/web/public/assets/mode-yaml-24faa242.js +8 -0
  135. data/lib/mihari/web/public/index.html +1 -1
  136. data/lib/mihari.rb +24 -6
  137. data/mihari.gemspec +9 -2
  138. data/mkdocs.yml +4 -2
  139. metadata +38 -133
  140. data/docs/alternatives.md +0 -5
  141. data/docs/analyzers/binaryedge.md +0 -26
  142. data/docs/analyzers/censys.md +0 -31
  143. data/docs/analyzers/circl.md +0 -37
  144. data/docs/analyzers/crtsh.md +0 -26
  145. data/docs/analyzers/dnstwister.md +0 -25
  146. data/docs/analyzers/feed.md +0 -73
  147. data/docs/analyzers/greynoise.md +0 -26
  148. data/docs/analyzers/hunterhow.md +0 -33
  149. data/docs/analyzers/index.md +0 -103
  150. data/docs/analyzers/onyphe.md +0 -26
  151. data/docs/analyzers/otx.md +0 -28
  152. data/docs/analyzers/passivetotal.md +0 -52
  153. data/docs/analyzers/pulsedive.md +0 -28
  154. data/docs/analyzers/securitytrails.md +0 -41
  155. data/docs/analyzers/shodan.md +0 -26
  156. data/docs/analyzers/urlscan.md +0 -28
  157. data/docs/analyzers/virustotal.md +0 -43
  158. data/docs/analyzers/virustotal_intelligence.md +0 -33
  159. data/docs/analyzers/zoomeye.md +0 -38
  160. data/docs/configuration.md +0 -35
  161. data/docs/emitters/database.md +0 -22
  162. data/docs/emitters/hive.md +0 -26
  163. data/docs/emitters/index.md +0 -36
  164. data/docs/emitters/misp.md +0 -21
  165. data/docs/emitters/slack.md +0 -21
  166. data/docs/emitters/webhook.md +0 -63
  167. data/docs/enrichers/google_public_dns.md +0 -19
  168. data/docs/enrichers/index.md +0 -35
  169. data/docs/enrichers/ipinfo.md +0 -26
  170. data/docs/enrichers/shodan.md +0 -22
  171. data/docs/enrichers/whois.md +0 -17
  172. data/docs/github_actions.md +0 -43
  173. data/docs/index.md +0 -11
  174. data/docs/installation.md +0 -31
  175. data/docs/requirements.md +0 -13
  176. data/docs/rule.md +0 -168
  177. data/docs/tags.md +0 -3
  178. data/docs/usage.md +0 -103
  179. data/frontend/.eslintrc.cjs +0 -22
  180. data/frontend/.gitignore +0 -31
  181. data/frontend/.prettierrc.json +0 -8
  182. data/frontend/README.md +0 -3
  183. data/frontend/env.d.ts +0 -5
  184. data/frontend/index.html +0 -21
  185. data/frontend/package-lock.json +0 -7219
  186. data/frontend/package.json +0 -67
  187. data/frontend/public/favicon.ico +0 -0
  188. data/frontend/scripts/swagger_doc_to_yaml.rb +0 -23
  189. data/frontend/src/App.vue +0 -27
  190. data/frontend/src/ace-config.ts +0 -6
  191. data/frontend/src/api-helper.ts +0 -111
  192. data/frontend/src/api.ts +0 -105
  193. data/frontend/src/components/ErrorMessage.vue +0 -31
  194. data/frontend/src/components/Loading.vue +0 -15
  195. data/frontend/src/components/Navbar.vue +0 -42
  196. data/frontend/src/components/Pagination.vue +0 -119
  197. data/frontend/src/components/alert/Alert.vue +0 -87
  198. data/frontend/src/components/alert/Alerts.vue +0 -63
  199. data/frontend/src/components/alert/AlertsWithPagination.vue +0 -90
  200. data/frontend/src/components/alert/AlertsWrapper.vue +0 -128
  201. data/frontend/src/components/alert/Form.vue +0 -182
  202. data/frontend/src/components/artifact/AS.vue +0 -29
  203. data/frontend/src/components/artifact/Artifact.vue +0 -287
  204. data/frontend/src/components/artifact/ArtifactTag.vue +0 -64
  205. data/frontend/src/components/artifact/ArtifactTags.vue +0 -29
  206. data/frontend/src/components/artifact/ArtifactWrapper.vue +0 -57
  207. data/frontend/src/components/artifact/CPEs.vue +0 -23
  208. data/frontend/src/components/artifact/DnsRecords.vue +0 -38
  209. data/frontend/src/components/artifact/Ports.vue +0 -23
  210. data/frontend/src/components/artifact/ReverseDnsNames.vue +0 -31
  211. data/frontend/src/components/artifact/Tags.vue +0 -29
  212. data/frontend/src/components/artifact/WhoisRecord.vue +0 -44
  213. data/frontend/src/components/config/Configs.vue +0 -65
  214. data/frontend/src/components/config/ConfigsWrapper.vue +0 -32
  215. data/frontend/src/components/link/Link.vue +0 -32
  216. data/frontend/src/components/link/Links.vue +0 -42
  217. data/frontend/src/components/rule/EditRule.vue +0 -72
  218. data/frontend/src/components/rule/EditRuleWrapper.vue +0 -48
  219. data/frontend/src/components/rule/Form.vue +0 -158
  220. data/frontend/src/components/rule/InputForm.vue +0 -45
  221. data/frontend/src/components/rule/NewRule.vue +0 -57
  222. data/frontend/src/components/rule/Rule.vue +0 -100
  223. data/frontend/src/components/rule/RuleWrapper.vue +0 -53
  224. data/frontend/src/components/rule/Rules.vue +0 -84
  225. data/frontend/src/components/rule/RulesWrapper.vue +0 -121
  226. data/frontend/src/components/rule/YAML.vue +0 -37
  227. data/frontend/src/components/tag/Tag.vue +0 -65
  228. data/frontend/src/components/tag/Tags.vue +0 -37
  229. data/frontend/src/countries.ts +0 -350
  230. data/frontend/src/index.ts +0 -20
  231. data/frontend/src/links/anyrun.ts +0 -19
  232. data/frontend/src/links/base.ts +0 -14
  233. data/frontend/src/links/censys.ts +0 -20
  234. data/frontend/src/links/crtsh.ts +0 -20
  235. data/frontend/src/links/dnslytics.ts +0 -38
  236. data/frontend/src/links/greynoise.ts +0 -20
  237. data/frontend/src/links/index.ts +0 -40
  238. data/frontend/src/links/intezer.ts +0 -20
  239. data/frontend/src/links/otx.ts +0 -33
  240. data/frontend/src/links/securitytrails.ts +0 -38
  241. data/frontend/src/links/shodan.ts +0 -20
  242. data/frontend/src/links/urlscan.ts +0 -50
  243. data/frontend/src/links/virustotal.ts +0 -72
  244. data/frontend/src/main.ts +0 -41
  245. data/frontend/src/router/index.ts +0 -57
  246. data/frontend/src/rule.ts +0 -14
  247. data/frontend/src/shims-vue.d.ts +0 -6
  248. data/frontend/src/swagger.yaml +0 -771
  249. data/frontend/src/types.ts +0 -188
  250. data/frontend/src/utils.ts +0 -54
  251. data/frontend/src/views/Alerts.vue +0 -20
  252. data/frontend/src/views/Artifact.vue +0 -39
  253. data/frontend/src/views/Configs.vue +0 -20
  254. data/frontend/src/views/EditRule.vue +0 -39
  255. data/frontend/src/views/NewRule.vue +0 -26
  256. data/frontend/src/views/Rule.vue +0 -39
  257. data/frontend/src/views/Rules.vue +0 -20
  258. data/frontend/tests/utils.spec.ts +0 -9
  259. data/frontend/tsconfig.app.json +0 -21
  260. data/frontend/tsconfig.json +0 -14
  261. data/frontend/tsconfig.node.json +0 -13
  262. data/frontend/tsconfig.vitest.json +0 -12
  263. data/frontend/vite.config.ts +0 -24
  264. data/frontend/vitest.config.ts +0 -21
  265. data/lib/mihari/services/alert_proxy.rb +0 -92
  266. data/lib/mihari/templates/rule.yml.erb +0 -5
  267. data/lib/mihari/web/public/assets/mode-yaml-a21faa53.js +0 -8
@@ -1,36 +0,0 @@
1
- # Emitters
2
-
3
- - [Database](database.md)
4
- - [TheHive](hive.md)
5
- - [MISP](misp.md)
6
- - [Slack](slack.md)
7
- - [Webhook](webhook.md)
8
-
9
- ## Options
10
-
11
- All the emitters can have optional `options`.
12
-
13
- ```yaml
14
- emitter: ...
15
- options:
16
- timeout: ...
17
- retry_times: ...
18
- retry_interval: ...
19
- retry_exponential_backoff: ...
20
- ```
21
-
22
- ### Timeout
23
-
24
- `timeout` (`integer`) is an HTTP timeout in seconds. Optional.
25
-
26
- ### Retry Times
27
-
28
- `retry_times` (`integer`) is a number of times of retry when something goes wrong. Optional. Defaults to 3.
29
-
30
- ### Retry Interval
31
-
32
- `retry_interval` (`integer`) is an interval in seconds between retries. Optional. Defaults to 5.
33
-
34
- ### Retry Exponential Backoff
35
-
36
- `retry_exponential_backoff` (`bool`) controls whether to do exponential backoff. Optional. Defaults to `true`.
@@ -1,21 +0,0 @@
1
- # MISP
2
-
3
- - [https://www.misp-project.org/](https://www.misp-project.org/)
4
-
5
- This emitter creates an event on MISP based on an alert. MISP v2 is supported.
6
-
7
- ```yaml
8
- emitter: misp
9
- url: ...
10
- api_key: ...
11
- ```
12
-
13
- ## Components
14
-
15
- ### URL
16
-
17
- `url` (`string`) is a MISP URL. Optional. Defaults to `ENV[MISP_URL]`.
18
-
19
- ### API Key
20
-
21
- `api_key` (`string`) is an API key. Optional. Defaults to `ENV[”MISP_API_KEY”]`.
@@ -1,21 +0,0 @@
1
- # Slack
2
-
3
- - [https://slack.com/](https://slack.com/intl/ja-jp/)
4
-
5
- This emitter post a message to Slack via incoming webhook.
6
-
7
- ```yaml
8
- emitter: slack
9
- webhook_url: ...
10
- channel: ...
11
- ```
12
-
13
- ## Components
14
-
15
- ### Webhook URL
16
-
17
- `url` (`string`) is a Slack's incoming webhook URL. Optional. Defaults to `ENV[SLACK_WEBHOOK_URL]`.
18
-
19
- ### API Key
20
-
21
- `channel` (`string`) is a Slack channel to sent a message. Optional. Defaults to `ENV[SLACK_CHANNEL]` or `#general`.
@@ -1,63 +0,0 @@
1
- # Webhook
2
-
3
- This emitter creates an HTTP request payload based on the specified conditions.
4
-
5
- ```yaml
6
- emitter: webhook
7
- url: ...
8
- method: ...
9
- headers: ...
10
- template: ...
11
- ```
12
-
13
- ## Components
14
-
15
- ### URL
16
-
17
- `url` (`string`) is a webhook URL.
18
-
19
- ### Method
20
-
21
- `method` (`string`)is an HTTP method. Optional. Defaults to `POST`.
22
-
23
- ### Headers
24
-
25
- `headers` (`hash`) are HTTP headers. Optional.
26
-
27
- ### Template
28
-
29
- `template` (`string`) is an [ERB](https://github.com/ruby/erb) template to customize the payload to sent. A template should generate a valid JSON.
30
-
31
- You can use the following parameters inside an ERB template.
32
-
33
- - `rule`: a rule
34
- - `artifacts`: a list of artifacts
35
-
36
- ## Examples
37
-
38
- ### ThreatFox
39
-
40
- ```yaml
41
- - emitter: webhook
42
- url: https://threatfox-api.abuse.ch/api/v1/
43
- headers:
44
- api-key: YOUR_API_KEY
45
- template: threatfox.erb
46
- ```
47
-
48
- ```ruby
49
- {
50
- "query": "submit_ioc",
51
- "threat_type": "payload_delivery",
52
- "ioc_type": "ip:port",
53
- "malware": "foobar",
54
- "confidence_level": 100,
55
- "anonymous": 0,
56
- "iocs": [
57
- <% @artifacts.select { |artifact| artifact.data_type == "ip" }.each_with_index do |artifact, idx| %>
58
- "<%= artifact.data %>:80"
59
- <%= ',' if idx < (@artifacts.length - 1) %>
60
- <% end %>
61
- ]
62
- }
63
- ```
@@ -1,19 +0,0 @@
1
- ---
2
- tags:
3
- - Enrichment:DNS_Record
4
- ---
5
-
6
- # Google Public DNS
7
-
8
- - [https://developers.google.com/speed/public-dns](https://developers.google.com/speed/public-dns)
9
-
10
- This enricher uses Google Public DNS to enrich an URL and domain artifact.
11
-
12
- ```yaml
13
- enricher: google_public_dns
14
- ```
15
-
16
- ## Supported Artifacts
17
-
18
- - URL
19
- - Domain
@@ -1,35 +0,0 @@
1
- # Enrichers
2
-
3
- - [Google Public DNS](google_public_dns.md)
4
- - [IPInfo](ipinfo.md)
5
- - [Shodan](shodan.md)
6
- - [Whois](whois.md)
7
-
8
- ## Options
9
-
10
- All the emitters can have optional `options`.
11
-
12
- ```yaml
13
- enricher: ...
14
- options:
15
- timeout: ...
16
- retry_times: ...
17
- retry_interval: ...
18
- retry_exponential_backoff: ...
19
- ```
20
-
21
- ### Timeout
22
-
23
- `timeout` (`integer`) is an HTTP timeout in seconds. Optional.
24
-
25
- ### Retry Times
26
-
27
- `retry_times` (`integer`) is a number of times of retry when something goes wrong. Optional. Defaults to 3.
28
-
29
- ### Retry Interval
30
-
31
- `retry_interval` (`integer`) is an interval in seconds between retries. Optional. Defaults to 5.
32
-
33
- ### Retry Exponential Backoff
34
-
35
- `retry_exponential_backoff` (`bool`) controls whether to do exponential backoff. Optional. Defaults to `true`.
@@ -1,26 +0,0 @@
1
- ---
2
- tags:
3
- - Enrichment:Autonomous_System
4
- - Enrichment:Geolocation
5
- ---
6
-
7
- # ipinfo.io
8
-
9
- - [https://ipinfo.io/](https://ipinfo.io/)
10
-
11
- This enricher uses ipinfo.io API to enrich an IP artifact.
12
-
13
- ```yaml
14
- enricher: ipinfo
15
- api_key: ...
16
- ```
17
-
18
- ## Components
19
-
20
- ### API Key
21
-
22
- `api_key` (`string`) is an API key. Optional. Defaults to `ENV[”IPINFO_API_KEY”]`.
23
-
24
- ## Supported Artifacts
25
-
26
- - IP address
@@ -1,22 +0,0 @@
1
- ---
2
- tags:
3
- - Enrichment:Port
4
- - Enrichment:CPE
5
- - Enrichment:DNS_Record
6
- ---
7
-
8
- # Shodan (The InternetDB API)
9
-
10
- - [https://www.shodan.io/](https://www.shodan.io/dashboard)
11
-
12
- This enricher uses Shodan InternetDB API to enrich an artifact.
13
-
14
- [https://internetdb.shodan.io/](https://internetdb.shodan.io/)
15
-
16
- ```yaml
17
- enricher: shodan
18
- ```
19
-
20
- ## Supported Artifacts
21
-
22
- - IP address
@@ -1,17 +0,0 @@
1
- ---
2
- tags:
3
- - Enrichment:Whois
4
- ---
5
-
6
- # Whois
7
-
8
- This enricher uses “whois” command to enrich an artifact.
9
-
10
- ```yaml
11
- enricher: whois
12
- ```
13
-
14
- ## Supported Artifacts
15
-
16
- - URL
17
- - Domain
@@ -1,43 +0,0 @@
1
- # GitHub Actions
2
-
3
- GitHub Actions is a good way to run Mihari searches continuously.
4
-
5
- The following is an example of a GitHub Actions workflow to run Mihari.
6
-
7
- ```yaml
8
- name: Mihari searches
9
-
10
- on:
11
- workflow_dispatch:
12
-
13
- jobs:
14
- build:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: actions/checkout@v4
18
- - name: Install dependencies
19
- run: sudo apt-get -yqq install sqlite3 libsqlite3-dev
20
- - name: Set up Ruby 3.2
21
- uses: ruby/setup-ruby@v1
22
- with:
23
- ruby-version: "3.2"
24
- bundler-cache: true
25
- - name: Run Mihari
26
- run: |
27
- mihari search /path/to/rule.yml
28
- ```
29
-
30
- !!! tip
31
-
32
- You need to install `libpq-dev` for PostgreSQL, `libmysqlclient-dev` for MySQL.
33
-
34
- This example assumes that you have `Gemfile` in your repository.
35
-
36
- ```ruby
37
- source "https://rubygems.org"
38
-
39
- gem "pg" # if you use PostgresSQL
40
- gem "mysql2" # if you use MySQL
41
-
42
- gem "mihari"
43
- ```
data/docs/index.md DELETED
@@ -1,11 +0,0 @@
1
- # Mihari
2
-
3
- A query aggregator for OSINT based threat hunting.
4
-
5
- Mihari can aggregate multiple searches across multiple services in a single rule & persist findings in a database.
6
-
7
- - [Requirements](./requirements.md)
8
- - [Installation](./installation.md)
9
- - [How to Write a Rule](./rule.md)
10
- - [Usage](./usage.md)
11
- - [Configuration](./configuration.md)
data/docs/installation.md DELETED
@@ -1,31 +0,0 @@
1
- # Installation
2
-
3
- ## Ruby Gem
4
-
5
- Mihari is packaged as a Ruby Gem. Thus you can install it via `gem` command.
6
-
7
- ```bash
8
- gem install mihari
9
- ```
10
-
11
- Mihari uses SQLite3 as a primary database by default. Thus a gem for SQLite (`sqlite3`) is installed by default.
12
-
13
- If you want to use MySQL or PostgreSQL instead of SQLite3, please install a gem for that by yourself.
14
-
15
- **MySQL**
16
-
17
- ```bash
18
- gem install mysql2
19
- ```
20
-
21
- **PostgreSQL**
22
-
23
- ```bash
24
- gem install pg
25
- ```
26
-
27
- # Docker
28
-
29
- You can built the Docker image by yourself.
30
-
31
- `Dockerfile` is available at [https://github.com/ninoseki/mihari/tree/master/docker](https://github.com/ninoseki/mihari/tree/master/docker).
data/docs/requirements.md DELETED
@@ -1,13 +0,0 @@
1
- # Requirements
2
-
3
- ## Runtime
4
-
5
- Ruby 2.7+ / 3.0+ (tested with 2.7, 3.0, 3.1 and 3.2)
6
-
7
- ## Database
8
-
9
- - SQLite3
10
- - PostgreSQL
11
- - MySQL
12
-
13
- You need to have a database to persistent the data. See [Database](./emitters/database.md) for details.
data/docs/rule.md DELETED
@@ -1,168 +0,0 @@
1
- # How to Write a Rule
2
-
3
- Mihari has [Sigma](https://github.com/SigmaHQ/sigma) like format to describe a set of search queries to express a rule.
4
-
5
- Mihari has three main components to compose a rule.
6
-
7
- ![](https://imgur.com/BBT99BG.png)
8
-
9
- - Analyzers/Queries: a list of queries (analyzers) that builds a list of artifacts
10
- - Enrichers: a list of enrichers that enriches a list of artifacts
11
- - Emitters: a list of emitters that emits a list of artifacts as an alert
12
-
13
- An artifact has five types:
14
-
15
- - IP address (`ip`)
16
- - Domain (`domain`)
17
- - URL (`url`)
18
- - Mail (`mail`)
19
- - Hash (`hash`)
20
-
21
- An alert can have multiple artifacts bundled by a rule.
22
-
23
- !!! note
24
-
25
- A rule is assumed to be executed multiple times continuously. An alert generated by a rule will only have new findings at that time.
26
-
27
- Let's break down the following example:
28
-
29
- ```yaml
30
- id: c7f6968e-dbe1-4612-b0bb-8407a4fe05df
31
- title: Example
32
- description: Mihari rule example
33
- created_on: "2023-01-01"
34
- updated_on: "2023-01-02"
35
- author: ninoseki
36
- references:
37
- - https://github.com/ninoseki/mihari
38
- related:
39
- - 6254bb74-5e5d-42ad-bc1e-231da0293b0f
40
- tags:
41
- - foo
42
- - bar
43
- queries:
44
- - analyzer: shodan
45
- query: ip:1.1.1.1
46
- - analyzer: censys
47
- query: ip:8.8.8.8
48
- enrichers:
49
- - enricher: whois
50
- - enricher: ipinfo
51
- - enricher: shodan
52
- - enricher: google_public_dns
53
- emitters:
54
- - emitter: database
55
- - emitter: misp
56
- - emitter: slack
57
- - emitter: thehive
58
- data_types:
59
- - hash
60
- - ip
61
- - domain
62
- - url
63
- - mail
64
- falsepositives: []
65
- ```
66
-
67
- ## Components
68
-
69
- ### ID
70
-
71
- `id` (`string`) is an unique ID of a rule. UUID v4 is recommended.
72
-
73
- ### Title
74
-
75
- `title` (`string`) is a title of a rule.
76
-
77
- ### Description
78
-
79
- `description` (`string`) is a short description of a rule.
80
-
81
- ### Created/Updated On
82
-
83
- `created_on` (`date`) is a date of a rule creation. Optional.
84
- Also a rule can have `updated_on` that is a date of a rule modification. Optional.
85
-
86
- ### Tags
87
-
88
- `tags` (`array[:string]`) is a list of tags of a rule.
89
-
90
- ### Author
91
-
92
- `author` (`string`) is an author of a rule. Optional.
93
-
94
- ### References
95
-
96
- `references` (`array[:string]`) is a list of a references of a rule. Optional.
97
-
98
- ### Related
99
-
100
- `related` (`array[:string]`) is a list of related rule IDs. Optional.
101
-
102
- ### Queries
103
-
104
- `queries` is a list of queries/analyzers.
105
- See [Analyzers](./analyzers/index.md) to know details of each analyzer.
106
-
107
- ### Enrichers
108
-
109
- `enrichers` is a list of enrichers.
110
- See [Enrichers](./enrichers/index.md) to know details of each enricher.
111
-
112
- Defaults to:
113
-
114
- - `google_public_dns`
115
- - `ipinfo`
116
- - `shodan`
117
- - `whois`
118
-
119
- ### Emitters
120
-
121
- `emitters` is a list of emitters.
122
- See [Emitters](./emitters/index.md) to know details of each emitter.
123
-
124
- Defaults to:
125
-
126
- - `database`
127
-
128
- ### Data Types
129
-
130
- `data_types` (`array[:string]`) is a list of data (artifact) types to allow by a rule. Types not defined in here will be automatically rejected.
131
-
132
- Defaults to:
133
-
134
- - `ip`
135
- - `domain`
136
- - `url`
137
- - `mail`
138
- - `hash`
139
-
140
- ### False positives
141
-
142
- `falsepositives` (`array[:string]`) is a list of false positive values. A string or regexp can be used in here.
143
-
144
- ### Artifact TTL
145
-
146
- `artifact_ttl` (`integer` / alias: `artifact_lifetime`) is an integer value of artifact TTL (Time-To-Live) in seconds.
147
-
148
- Mihari rejects a same artifact in a same rule in general.
149
-
150
- But you may want to get a same artifact after a certain period of time. `artifact_ttl` is for that. If a rule finds a same artifact after `artifact_ttl` seconds have been passed, that artifact will be included in an alert.
151
-
152
- ## How to Run a Rule
153
-
154
- Once you finish writing a rule, you can run the rule by `mihari` CLI.
155
-
156
- !!! note
157
-
158
- You have to initialize the database by `mihari db migrate` if you haven't already done.
159
-
160
- ```bash
161
- mihari search /path/to/rule.yml
162
- ```
163
-
164
- The command outputs an alert to the standard output. Also you can confirm it with a built-in web app.
165
-
166
- ```bash
167
- mihari web
168
- ```
data/docs/tags.md DELETED
@@ -1,3 +0,0 @@
1
- # Tags
2
-
3
- [TAGS]
data/docs/usage.md DELETED
@@ -1,103 +0,0 @@
1
- # Usage
2
-
3
- ```bash
4
- $ mihari
5
- Commands:
6
- mihari --version, -v # Print the version
7
- mihari alert # Sub commands for alert
8
- mihari db # Sub commands for DB
9
- mihari help [COMMAND] # Describe available commands or one specific command
10
- mihari rule # Sub commands for rule
11
- mihari search [PATH_OR_ID] # Search by a rule (Outputs null if there is no new finding)
12
- mihari web # Launch the web app
13
-
14
- Options:
15
- -d, [--debug], [--no-debug] # Sets up debug mode
16
- ```
17
-
18
- ## `mihari db`
19
-
20
- This sub command is for initializing/migrating database.
21
-
22
- ```bash
23
- mihari db migrate
24
- ```
25
-
26
- See [Database](./emitters/database.md) for detailed database configuration.
27
-
28
- ## `mihari rule`
29
-
30
- This sub command is for validating/initializing a rule.
31
-
32
- ```bash
33
- mihari rule init /path/to/rule.yml
34
- mihari rule validate /path/to/rule.yml
35
- ```
36
-
37
- ## `mihari search`
38
-
39
- This is a command for running a rule.
40
-
41
- ```bash
42
- mihari search /path/to/rule.yml
43
- ```
44
-
45
- Mihari asks whether really you want to update a rule if there is a diff by default.
46
-
47
- ```bash
48
- $ mihari search /path/to/rule.yml
49
- There is a diff in the rule. Are you sure you want to overwrite the rule? (y/n)
50
- ```
51
-
52
- It can be suppressed by providing `-f`.
53
-
54
- ```bash
55
- mihari search -f /path/to/rule.yml
56
- ```
57
-
58
- ## `mihari add`
59
-
60
- You may want to add an alert manually. You can do that by this command.
61
-
62
- ```bash
63
- mihari alert /path/to/alert.yml
64
- ```
65
-
66
- ## `mihari web`
67
-
68
- This command is for launching the built-in web app.
69
-
70
- ```bash
71
- mihari web
72
- ```
73
-
74
- It stars the app with `localhost:9292`. You can configure it by providing options.
75
-
76
- ```bash
77
- $ mihari help web
78
- Usage:
79
- mihari web
80
-
81
- Options:
82
- [--port=N] # Hostname to listen on
83
- # Default: 9292
84
- [--host=HOST] # Port to listen on
85
- # Default: localhost
86
- [--threads=THREADS] # min:max threads to use
87
- # Default: 0:5
88
- [--verbose], [--no-verbose] # Report each request
89
- # Default: true
90
- [--worker-timeout=N] # Worker timeout value (in seconds)
91
- # Default: 60
92
- [--hide-config-values], [--no-hide-config-values] # Whether to hide config values or not
93
- # Default: true
94
- [--open], [--no-open] # Whether to open the app in browser or not
95
- # Default: true
96
- [--rack-env=RACK_ENV] # Rack environment
97
- # Default: production
98
- ```
99
-
100
- !!! tip
101
-
102
- The built-in web app offers API to interact with Mihari.
103
- The API docs are available on `/redoc-static.html`
@@ -1,22 +0,0 @@
1
- /* eslint-env node */
2
- require('@rushstack/eslint-patch/modern-module-resolution')
3
-
4
- module.exports = {
5
- root: true,
6
- extends: [
7
- 'plugin:vue/vue3-essential',
8
- 'eslint:recommended',
9
- '@vue/eslint-config-typescript',
10
- '@vue/eslint-config-prettier/skip-formatting'
11
- ],
12
- plugins: ['simple-import-sort'],
13
- rules: {
14
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
15
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
16
- 'simple-import-sort/imports': 'error',
17
- 'simple-import-sort/exports': 'error'
18
- },
19
- parserOptions: {
20
- ecmaVersion: 'latest'
21
- }
22
- }
data/frontend/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- .DS_Store
12
- dist
13
- dist-ssr
14
- coverage
15
- *.local
16
-
17
- /cypress/videos/
18
- /cypress/screenshots/
19
-
20
- # Editor directories and files
21
- .vscode/*
22
- !.vscode/extensions.json
23
- .idea
24
- *.suo
25
- *.ntvs*
26
- *.njsproj
27
- *.sln
28
- *.sw?
29
-
30
- # redoc
31
- public/redoc-static.html