mihari 7.3.2 → 7.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.rubocop.yml +0 -2
- data/.shadowenv.d/.gitignore +2 -0
- data/.shadowenv.d/000_unset_all.lisp +39 -0
- data/README.md +0 -8
- data/lib/mihari/analyzers/base.rb +2 -2
- data/lib/mihari/analyzers/binaryedge.rb +5 -5
- data/lib/mihari/analyzers/censys.rb +6 -6
- data/lib/mihari/analyzers/circl.rb +2 -2
- data/lib/mihari/analyzers/crtsh.rb +3 -3
- data/lib/mihari/analyzers/dnstwister.rb +2 -2
- data/lib/mihari/analyzers/feed.rb +12 -18
- data/lib/mihari/analyzers/fofa.rb +6 -6
- data/lib/mihari/analyzers/greynoise.rb +5 -5
- data/lib/mihari/analyzers/hunterhow.rb +4 -4
- data/lib/mihari/analyzers/onyphe.rb +5 -5
- data/lib/mihari/analyzers/otx.rb +2 -2
- data/lib/mihari/analyzers/passivetotal.rb +3 -3
- data/lib/mihari/analyzers/pulsedive.rb +3 -3
- data/lib/mihari/analyzers/securitytrails.rb +4 -4
- data/lib/mihari/analyzers/shodan.rb +5 -5
- data/lib/mihari/analyzers/urlscan.rb +5 -5
- data/lib/mihari/analyzers/virustotal.rb +4 -4
- data/lib/mihari/analyzers/virustotal_intelligence.rb +5 -5
- data/lib/mihari/analyzers/zoomeye.rb +5 -5
- data/lib/mihari/cli/application.rb +1 -1
- data/lib/mihari/clients/base.rb +5 -5
- data/lib/mihari/clients/binaryedge.rb +6 -6
- data/lib/mihari/clients/censys.rb +4 -4
- data/lib/mihari/clients/circl.rb +2 -2
- data/lib/mihari/clients/crtsh.rb +2 -2
- data/lib/mihari/clients/dnstwister.rb +1 -1
- data/lib/mihari/clients/fofa.rb +4 -4
- data/lib/mihari/clients/google_public_dns.rb +2 -2
- data/lib/mihari/clients/greynoise.rb +4 -4
- data/lib/mihari/clients/hunterhow.rb +10 -10
- data/lib/mihari/clients/misp.rb +1 -1
- data/lib/mihari/clients/mmdb.rb +1 -1
- data/lib/mihari/clients/onyphe.rb +4 -4
- data/lib/mihari/clients/otx.rb +1 -1
- data/lib/mihari/clients/passivetotal.rb +5 -5
- data/lib/mihari/clients/publsedive.rb +3 -3
- data/lib/mihari/clients/securitytrails.rb +6 -6
- data/lib/mihari/clients/shodan.rb +6 -6
- data/lib/mihari/clients/shodan_internet_db.rb +1 -1
- data/lib/mihari/clients/the_hive.rb +2 -2
- data/lib/mihari/clients/urlscan.rb +4 -4
- data/lib/mihari/clients/virustotal.rb +4 -4
- data/lib/mihari/clients/zoomeye.rb +12 -12
- data/lib/mihari/commands/alert.rb +1 -1
- data/lib/mihari/commands/artifact.rb +1 -1
- data/lib/mihari/commands/rule.rb +1 -1
- data/lib/mihari/commands/tag.rb +1 -1
- data/lib/mihari/concerns/autonomous_system_normalizable.rb +1 -4
- data/lib/mihari/concerns/configurable.rb +1 -1
- data/lib/mihari/concerns/database_connectable.rb +2 -2
- data/lib/mihari/concerns/retriable.rb +1 -1
- data/lib/mihari/config.rb +6 -2
- data/lib/mihari/constants.rb +2 -2
- data/lib/mihari/emitters/base.rb +2 -2
- data/lib/mihari/emitters/database.rb +1 -1
- data/lib/mihari/emitters/misp.rb +12 -4
- data/lib/mihari/emitters/slack.rb +9 -9
- data/lib/mihari/emitters/the_hive.rb +9 -4
- data/lib/mihari/emitters/webhook.rb +4 -4
- data/lib/mihari/enrichers/base.rb +1 -1
- data/lib/mihari/enrichers/google_public_dns.rb +1 -1
- data/lib/mihari/enrichers/mmdb.rb +1 -1
- data/lib/mihari/enrichers/shodan.rb +3 -3
- data/lib/mihari/enrichers/whois.rb +2 -2
- data/lib/mihari/entities/alert.rb +6 -6
- data/lib/mihari/entities/artifact.rb +17 -17
- data/lib/mihari/entities/autonomous_system.rb +1 -1
- data/lib/mihari/entities/config.rb +8 -4
- data/lib/mihari/entities/cpe.rb +2 -2
- data/lib/mihari/entities/dns.rb +3 -3
- data/lib/mihari/entities/geolocation.rb +3 -3
- data/lib/mihari/entities/ip_address.rb +3 -3
- data/lib/mihari/entities/messages.rb +3 -3
- data/lib/mihari/entities/pagination.rb +3 -3
- data/lib/mihari/entities/port.rb +2 -2
- data/lib/mihari/entities/reverse_dns.rb +2 -2
- data/lib/mihari/entities/rule.rb +8 -8
- data/lib/mihari/entities/tag.rb +3 -3
- data/lib/mihari/entities/vulnerability.rb +2 -2
- data/lib/mihari/entities/whois.rb +7 -7
- data/lib/mihari/errors.rb +1 -1
- data/lib/mihari/models/artifact.rb +2 -2
- data/lib/mihari/models/port.rb +1 -1
- data/lib/mihari/models/tag.rb +3 -0
- data/lib/mihari/rule.rb +10 -14
- data/lib/mihari/schemas/emitter.rb +2 -0
- data/lib/mihari/services/feed.rb +3 -3
- data/lib/mihari/services/getters.rb +1 -1
- data/lib/mihari/services/proxies.rb +1 -1
- data/lib/mihari/services/renderer.rb +2 -0
- data/lib/mihari/services/searchers.rb +1 -1
- data/lib/mihari/sidekiq/application.rb +2 -2
- data/lib/mihari/structs/censys.rb +4 -4
- data/lib/mihari/structs/google_public_dns.rb +3 -3
- data/lib/mihari/structs/greynoise.rb +2 -2
- data/lib/mihari/structs/onyphe.rb +3 -3
- data/lib/mihari/structs/shodan.rb +10 -10
- data/lib/mihari/structs/urlscan.rb +1 -1
- data/lib/mihari/structs/virustotal_intelligence.rb +2 -2
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/api.rb +1 -1
- data/lib/mihari/web/application.rb +1 -1
- data/lib/mihari/web/endpoints/alerts.rb +12 -12
- data/lib/mihari/web/endpoints/artifacts.rb +11 -11
- data/lib/mihari/web/endpoints/configs.rb +7 -2
- data/lib/mihari/web/endpoints/ip_addresses.rb +5 -5
- data/lib/mihari/web/endpoints/rules.rb +26 -26
- data/lib/mihari/web/endpoints/tags.rb +4 -4
- data/lib/mihari/web/public/assets/index-DsMIBgVm.js +1787 -0
- data/lib/mihari/web/public/assets/{index-ReF8ffd-.css → index-qLffdzXi.css} +1 -1
- data/lib/mihari/web/public/index.html +2 -2
- data/lib/mihari/web/public/redoc-static.html +2 -2
- data/lib/mihari.rb +1 -1
- data/mihari.gemspec +15 -15
- data/renovate.json +1 -3
- data/requirements.txt +1 -1
- metadata +37 -36
- data/.standard.yml +0 -4
- data/lib/mihari/web/public/assets/index-lRP933ks.js +0 -1787
- /data/lib/mihari/web/public/assets/{mode-yaml-BC4MIiYj.js → mode-yaml-ELgwiJiP.js} +0 -0
@@ -9,8 +9,8 @@ module Mihari
|
|
9
9
|
class Rules < Grape::API
|
10
10
|
class RuleCreateUpdater < Service
|
11
11
|
#
|
12
|
-
# @
|
13
|
-
# @
|
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: [{
|
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!({
|
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: {
|
74
|
-
failure: [{
|
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({
|
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!({
|
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: {
|
108
|
+
success: {code: 201, model: Entities::Rule},
|
109
109
|
failure: [
|
110
|
-
{
|
111
|
-
{
|
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: {
|
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!({
|
129
|
+
error!({message: failure.message}, 422)
|
130
130
|
when ValidationError
|
131
|
-
error!({
|
131
|
+
error!({message: "Rule format invalid", detail: failure.errors.to_h}, 422)
|
132
132
|
when IntegrityError
|
133
|
-
error!({
|
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: {
|
139
|
+
success: {code: 201, model: Entities::Rule},
|
140
140
|
failure: [
|
141
|
-
{
|
142
|
-
{
|
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: {
|
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!({
|
160
|
+
error!({message: "Rule not found"}, 404)
|
161
161
|
when Psych::SyntaxError
|
162
|
-
error!({
|
162
|
+
error!({message: failure.message}, 422)
|
163
163
|
when ValidationError
|
164
|
-
error!({
|
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: {
|
171
|
-
failure: [{
|
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({
|
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!({
|
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: {
|
36
|
-
failure: [{
|
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({
|
47
|
+
return present({message: ""}, with: Entities::Message) if result.success?
|
48
48
|
|
49
49
|
case result.failure
|
50
50
|
when ActiveRecord::RecordNotFound
|
51
|
-
error!({
|
51
|
+
error!({message: "ID:#{id} not found"}, 404)
|
52
52
|
end
|
53
53
|
raise result.failure
|
54
54
|
end
|