mihari 7.3.1 → 7.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.rubocop.yml +0 -2
  4. data/.shadowenv.d/.gitignore +2 -0
  5. data/.shadowenv.d/000_unset_all.lisp +39 -0
  6. data/README.md +2 -8
  7. data/lib/mihari/analyzers/base.rb +2 -2
  8. data/lib/mihari/analyzers/binaryedge.rb +5 -5
  9. data/lib/mihari/analyzers/censys.rb +6 -6
  10. data/lib/mihari/analyzers/circl.rb +2 -2
  11. data/lib/mihari/analyzers/crtsh.rb +3 -3
  12. data/lib/mihari/analyzers/dnstwister.rb +2 -2
  13. data/lib/mihari/analyzers/feed.rb +12 -18
  14. data/lib/mihari/analyzers/fofa.rb +6 -6
  15. data/lib/mihari/analyzers/greynoise.rb +5 -5
  16. data/lib/mihari/analyzers/hunterhow.rb +4 -4
  17. data/lib/mihari/analyzers/onyphe.rb +5 -5
  18. data/lib/mihari/analyzers/otx.rb +2 -2
  19. data/lib/mihari/analyzers/passivetotal.rb +3 -3
  20. data/lib/mihari/analyzers/pulsedive.rb +3 -3
  21. data/lib/mihari/analyzers/securitytrails.rb +4 -4
  22. data/lib/mihari/analyzers/shodan.rb +5 -5
  23. data/lib/mihari/analyzers/urlscan.rb +5 -5
  24. data/lib/mihari/analyzers/virustotal.rb +4 -4
  25. data/lib/mihari/analyzers/virustotal_intelligence.rb +5 -5
  26. data/lib/mihari/analyzers/zoomeye.rb +5 -5
  27. data/lib/mihari/cli/application.rb +1 -1
  28. data/lib/mihari/clients/base.rb +5 -5
  29. data/lib/mihari/clients/binaryedge.rb +6 -6
  30. data/lib/mihari/clients/censys.rb +4 -4
  31. data/lib/mihari/clients/circl.rb +2 -2
  32. data/lib/mihari/clients/crtsh.rb +2 -2
  33. data/lib/mihari/clients/dnstwister.rb +1 -1
  34. data/lib/mihari/clients/fofa.rb +4 -4
  35. data/lib/mihari/clients/google_public_dns.rb +2 -2
  36. data/lib/mihari/clients/greynoise.rb +4 -4
  37. data/lib/mihari/clients/hunterhow.rb +10 -10
  38. data/lib/mihari/clients/misp.rb +1 -1
  39. data/lib/mihari/clients/mmdb.rb +1 -1
  40. data/lib/mihari/clients/onyphe.rb +4 -4
  41. data/lib/mihari/clients/otx.rb +1 -1
  42. data/lib/mihari/clients/passivetotal.rb +5 -5
  43. data/lib/mihari/clients/publsedive.rb +3 -3
  44. data/lib/mihari/clients/securitytrails.rb +6 -6
  45. data/lib/mihari/clients/shodan.rb +6 -6
  46. data/lib/mihari/clients/shodan_internet_db.rb +1 -1
  47. data/lib/mihari/clients/the_hive.rb +2 -2
  48. data/lib/mihari/clients/urlscan.rb +4 -4
  49. data/lib/mihari/clients/virustotal.rb +4 -4
  50. data/lib/mihari/clients/zoomeye.rb +12 -12
  51. data/lib/mihari/commands/alert.rb +1 -1
  52. data/lib/mihari/commands/artifact.rb +1 -1
  53. data/lib/mihari/commands/rule.rb +1 -1
  54. data/lib/mihari/commands/tag.rb +1 -1
  55. data/lib/mihari/concerns/autonomous_system_normalizable.rb +1 -4
  56. data/lib/mihari/concerns/configurable.rb +1 -1
  57. data/lib/mihari/concerns/database_connectable.rb +2 -2
  58. data/lib/mihari/concerns/retriable.rb +1 -1
  59. data/lib/mihari/config.rb +6 -2
  60. data/lib/mihari/constants.rb +2 -2
  61. data/lib/mihari/emitters/base.rb +2 -2
  62. data/lib/mihari/emitters/database.rb +1 -1
  63. data/lib/mihari/emitters/misp.rb +12 -4
  64. data/lib/mihari/emitters/slack.rb +9 -9
  65. data/lib/mihari/emitters/the_hive.rb +9 -4
  66. data/lib/mihari/emitters/webhook.rb +4 -4
  67. data/lib/mihari/enrichers/base.rb +1 -1
  68. data/lib/mihari/enrichers/google_public_dns.rb +1 -1
  69. data/lib/mihari/enrichers/mmdb.rb +1 -1
  70. data/lib/mihari/enrichers/shodan.rb +10 -12
  71. data/lib/mihari/enrichers/whois.rb +2 -2
  72. data/lib/mihari/entities/alert.rb +6 -6
  73. data/lib/mihari/entities/artifact.rb +17 -17
  74. data/lib/mihari/entities/autonomous_system.rb +1 -1
  75. data/lib/mihari/entities/config.rb +8 -4
  76. data/lib/mihari/entities/cpe.rb +2 -2
  77. data/lib/mihari/entities/dns.rb +3 -3
  78. data/lib/mihari/entities/geolocation.rb +3 -3
  79. data/lib/mihari/entities/ip_address.rb +3 -3
  80. data/lib/mihari/entities/messages.rb +3 -3
  81. data/lib/mihari/entities/pagination.rb +3 -3
  82. data/lib/mihari/entities/port.rb +2 -2
  83. data/lib/mihari/entities/reverse_dns.rb +2 -2
  84. data/lib/mihari/entities/rule.rb +8 -8
  85. data/lib/mihari/entities/tag.rb +3 -3
  86. data/lib/mihari/entities/vulnerability.rb +2 -2
  87. data/lib/mihari/entities/whois.rb +7 -7
  88. data/lib/mihari/errors.rb +1 -1
  89. data/lib/mihari/models/artifact.rb +2 -2
  90. data/lib/mihari/models/port.rb +1 -1
  91. data/lib/mihari/models/tag.rb +3 -0
  92. data/lib/mihari/rule.rb +10 -14
  93. data/lib/mihari/schemas/emitter.rb +2 -0
  94. data/lib/mihari/services/feed.rb +3 -3
  95. data/lib/mihari/services/getters.rb +1 -1
  96. data/lib/mihari/services/proxies.rb +1 -1
  97. data/lib/mihari/services/renderer.rb +2 -0
  98. data/lib/mihari/services/searchers.rb +1 -1
  99. data/lib/mihari/sidekiq/application.rb +2 -2
  100. data/lib/mihari/structs/censys.rb +4 -4
  101. data/lib/mihari/structs/google_public_dns.rb +3 -3
  102. data/lib/mihari/structs/greynoise.rb +2 -2
  103. data/lib/mihari/structs/onyphe.rb +3 -3
  104. data/lib/mihari/structs/shodan.rb +10 -10
  105. data/lib/mihari/structs/urlscan.rb +1 -1
  106. data/lib/mihari/structs/virustotal_intelligence.rb +2 -2
  107. data/lib/mihari/version.rb +1 -1
  108. data/lib/mihari/web/api.rb +1 -1
  109. data/lib/mihari/web/application.rb +1 -1
  110. data/lib/mihari/web/endpoints/alerts.rb +12 -12
  111. data/lib/mihari/web/endpoints/artifacts.rb +11 -11
  112. data/lib/mihari/web/endpoints/configs.rb +7 -2
  113. data/lib/mihari/web/endpoints/ip_addresses.rb +5 -5
  114. data/lib/mihari/web/endpoints/rules.rb +26 -26
  115. data/lib/mihari/web/endpoints/tags.rb +4 -4
  116. data/lib/mihari/web/public/assets/index-DsMIBgVm.js +1787 -0
  117. data/lib/mihari/web/public/assets/{index-ReF8ffd-.css → index-qLffdzXi.css} +1 -1
  118. data/lib/mihari/web/public/index.html +2 -2
  119. data/lib/mihari/web/public/redoc-static.html +2 -2
  120. data/lib/mihari.rb +1 -1
  121. data/mihari.gemspec +16 -16
  122. data/renovate.json +1 -3
  123. data/requirements.txt +1 -1
  124. metadata +37 -36
  125. data/.standard.yml +0 -4
  126. data/lib/mihari/web/public/assets/index-JHS0L8KZ.js +0 -1786
  127. /data/lib/mihari/web/public/assets/{mode-yaml-BC4MIiYj.js → mode-yaml-ELgwiJiP.js} +0 -0
@@ -11,15 +11,15 @@ module Mihari
11
11
  desc "Get IP address data", {
12
12
  success: Entities::IPAddress,
13
13
  failure: [
14
- { code: 404, model: Entities::ErrorMessage },
15
- { code: 422, model: Entities::ErrorMessage }
14
+ {code: 404, model: Entities::ErrorMessage},
15
+ {code: 422, model: Entities::ErrorMessage}
16
16
  ],
17
17
  summary: "Get IP address data"
18
18
  }
19
19
  params do
20
20
  requires :ip, type: String
21
21
  end
22
- get "/:ip", requirements: { ip: %r{[^/]+} } do
22
+ get "/:ip", requirements: {ip: %r{[^/]+}} do
23
23
  ip = params[:ip].to_s
24
24
  result = Services::IPGetter.result(ip)
25
25
  if result.success?
@@ -37,8 +37,8 @@ module Mihari
37
37
  failure = result.failure
38
38
  case failure
39
39
  when Mihari::StatusError
40
- error!({ message: "IP:#{ip} not found" }, failure.status_code) if failure.status_code == 404
41
- error!({ message: "IP format invalid" }, failure.status_code) if failure.status_code == 422
40
+ error!({message: "IP:#{ip} not found"}, failure.status_code) if failure.status_code == 404
41
+ error!({message: "IP format invalid"}, failure.status_code) if failure.status_code == 422
42
42
  end
43
43
  raise failure
44
44
  end
@@ -9,8 +9,8 @@ module Mihari
9
9
  class Rules < Grape::API
10
10
  class RuleCreateUpdater < Service
11
11
  #
12
- # @params [String] yaml
13
- # @params [Boolean] overwrite
12
+ # @param [String] yaml
13
+ # @param [Boolean] overwrite
14
14
  #
15
15
  # @return [Mihari::Models::Rule]
16
16
  #
@@ -51,7 +51,7 @@ module Mihari
51
51
 
52
52
  desc "Get a rule", {
53
53
  success: Entities::Rule,
54
- failure: [{ code: 404, model: Entities::ErrorMessage }],
54
+ failure: [{code: 404, model: Entities::ErrorMessage}],
55
55
  summary: "Get a rule"
56
56
  }
57
57
  params do
@@ -64,14 +64,14 @@ module Mihari
64
64
 
65
65
  case result.failure
66
66
  when ActiveRecord::RecordNotFound
67
- error!({ message: "ID:#{id} not found" }, 404)
67
+ error!({message: "ID:#{id} not found"}, 404)
68
68
  end
69
69
  raise result.failure
70
70
  end
71
71
 
72
72
  desc "Search by a rule", {
73
- success: { code: 201, model: Entities::QueueMessage },
74
- failure: [{ code: 404, model: Entities::ErrorMessage }],
73
+ success: {code: 201, model: Entities::QueueMessage},
74
+ failure: [{code: 404, model: Entities::ErrorMessage}],
75
75
  summary: "Run a rule"
76
76
  }
77
77
  params do
@@ -95,25 +95,25 @@ module Mihari
95
95
  end.to_result
96
96
 
97
97
  message = queued ? "ID:#{id}'s search is queued" : "ID:#{id}'s search is successful"
98
- return present({ message: message, queued: queued }, with: Entities::QueueMessage) if result.success?
98
+ return present({message:, queued:}, with: Entities::QueueMessage) if result.success?
99
99
 
100
100
  case result.failure
101
101
  when ActiveRecord::RecordNotFound
102
- error!({ message: "ID:#{id} not found" }, 404)
102
+ error!({message: "ID:#{id} not found"}, 404)
103
103
  end
104
104
  raise result.failure
105
105
  end
106
106
 
107
107
  desc "Create a rule", {
108
- success: { code: 201, model: Entities::Rule },
108
+ success: {code: 201, model: Entities::Rule},
109
109
  failure: [
110
- { code: 400, model: Entities::ErrorMessage },
111
- { code: 422, model: Entities::ErrorMessage }
110
+ {code: 400, model: Entities::ErrorMessage},
111
+ {code: 422, model: Entities::ErrorMessage}
112
112
  ],
113
113
  summary: "Create a rule"
114
114
  }
115
115
  params do
116
- requires :yaml, type: String, documentation: { param_type: "body" }
116
+ requires :yaml, type: String, documentation: {param_type: "body"}
117
117
  end
118
118
  post "/" do
119
119
  status 201
@@ -126,25 +126,25 @@ module Mihari
126
126
  failure = result.failure
127
127
  case failure
128
128
  when Psych::SyntaxError
129
- error!({ message: failure.message }, 422)
129
+ error!({message: failure.message}, 422)
130
130
  when ValidationError
131
- error!({ message: "Rule format invalid", detail: failure.errors.to_h }, 422)
131
+ error!({message: "Rule format invalid", detail: failure.errors.to_h}, 422)
132
132
  when IntegrityError
133
- error!({ message: failure.message }, 400)
133
+ error!({message: failure.message}, 400)
134
134
  end
135
135
  raise failure
136
136
  end
137
137
 
138
138
  desc "Update a rule", {
139
- success: { code: 201, model: Entities::Rule },
139
+ success: {code: 201, model: Entities::Rule},
140
140
  failure: [
141
- { code: 404, model: Entities::ErrorMessage },
142
- { code: 422, model: Entities::ErrorMessage }
141
+ {code: 404, model: Entities::ErrorMessage},
142
+ {code: 422, model: Entities::ErrorMessage}
143
143
  ],
144
144
  summary: "Update a rule"
145
145
  }
146
146
  params do
147
- requires :yaml, type: String, documentation: { param_type: "body" }
147
+ requires :yaml, type: String, documentation: {param_type: "body"}
148
148
  end
149
149
  put "/" do
150
150
  status 201
@@ -157,18 +157,18 @@ module Mihari
157
157
  failure = result.failure
158
158
  case failure
159
159
  when ActiveRecord::RecordNotFound
160
- error!({ message: "Rule not found" }, 404)
160
+ error!({message: "Rule not found"}, 404)
161
161
  when Psych::SyntaxError
162
- error!({ message: failure.message }, 422)
162
+ error!({message: failure.message}, 422)
163
163
  when ValidationError
164
- error!({ message: "Rule format invalid", detail: failure.errors.to_h }, 422)
164
+ error!({message: "Rule format invalid", detail: failure.errors.to_h}, 422)
165
165
  end
166
166
  raise failure
167
167
  end
168
168
 
169
169
  desc "Delete a rule", {
170
- success: { code: 204, model: Entities::Message },
171
- failure: [{ code: 404, model: Entities::ErrorMessage }],
170
+ success: {code: 204, model: Entities::Message},
171
+ failure: [{code: 404, model: Entities::ErrorMessage}],
172
172
  summary: "Delete a rule"
173
173
  }
174
174
  params do
@@ -179,11 +179,11 @@ module Mihari
179
179
 
180
180
  id = params[:id].to_s
181
181
  result = Services::RuleDestroyer.result(id)
182
- return present({ message: "ID:#{id} is deleted" }, with: Entities::Message) if result.success?
182
+ return present({message: "ID:#{id} is deleted"}, with: Entities::Message) if result.success?
183
183
 
184
184
  case result.failure
185
185
  when ActiveRecord::RecordNotFound
186
- error!({ message: "ID:#{id} not found" }, 404)
186
+ error!({message: "ID:#{id} not found"}, 404)
187
187
  end
188
188
  raise result.failure
189
189
  end
@@ -32,8 +32,8 @@ module Mihari
32
32
  end
33
33
 
34
34
  desc "Delete a tag", {
35
- success: { code: 204, model: Entities::Message },
36
- failure: [{ code: 404, model: Entities::ErrorMessage }],
35
+ success: {code: 204, model: Entities::Message},
36
+ failure: [{code: 404, model: Entities::ErrorMessage}],
37
37
  summary: "Delete a tag"
38
38
  }
39
39
  params do
@@ -44,11 +44,11 @@ module Mihari
44
44
 
45
45
  id = params[:id].to_i
46
46
  result = Services::TagDestroyer.result(id)
47
- return present({ message: "" }, with: Entities::Message) if result.success?
47
+ return present({message: ""}, with: Entities::Message) if result.success?
48
48
 
49
49
  case result.failure
50
50
  when ActiveRecord::RecordNotFound
51
- error!({ message: "ID:#{id} not found" }, 404)
51
+ error!({message: "ID:#{id} not found"}, 404)
52
52
  end
53
53
  raise result.failure
54
54
  end