mihari 5.3.1 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/frontend/package-lock.json +672 -652
  4. data/frontend/package.json +22 -22
  5. data/frontend/src/ace-config.ts +6 -0
  6. data/frontend/src/components/alert/Form.vue +2 -2
  7. data/frontend/src/components/rule/EditRule.vue +3 -2
  8. data/frontend/src/components/rule/Form.vue +2 -2
  9. data/frontend/src/components/rule/InputForm.vue +18 -59
  10. data/frontend/src/components/rule/YAML.vue +21 -28
  11. data/frontend/src/views/Artifact.vue +3 -8
  12. data/frontend/src/views/EditRule.vue +2 -7
  13. data/frontend/src/views/Rule.vue +3 -8
  14. data/lib/mihari/analyzers/base.rb +16 -3
  15. data/lib/mihari/analyzers/binaryedge.rb +2 -2
  16. data/lib/mihari/analyzers/censys.rb +2 -2
  17. data/lib/mihari/analyzers/hunterhow.rb +68 -0
  18. data/lib/mihari/analyzers/onyphe.rb +2 -2
  19. data/lib/mihari/analyzers/rule.rb +5 -7
  20. data/lib/mihari/analyzers/shodan.rb +2 -2
  21. data/lib/mihari/analyzers/urlscan.rb +2 -2
  22. data/lib/mihari/analyzers/virustotal_intelligence.rb +2 -2
  23. data/lib/mihari/analyzers/zoomeye.rb +4 -4
  24. data/lib/mihari/clients/hunterhow.rb +47 -0
  25. data/lib/mihari/commands/rule.rb +3 -3
  26. data/lib/mihari/commands/search.rb +3 -3
  27. data/lib/mihari/config.rb +46 -27
  28. data/lib/mihari/constants.rb +3 -3
  29. data/lib/mihari/emitters/base.rb +2 -2
  30. data/lib/mihari/emitters/misp.rb +3 -3
  31. data/lib/mihari/emitters/slack.rb +1 -1
  32. data/lib/mihari/emitters/the_hive.rb +1 -1
  33. data/lib/mihari/emitters/webhook.rb +1 -1
  34. data/lib/mihari/mixins/configurable.rb +5 -0
  35. data/lib/mihari/mixins/falsepositive.rb +1 -1
  36. data/lib/mihari/mixins/retriable.rb +0 -2
  37. data/lib/mihari/schemas/analyzer.rb +12 -2
  38. data/lib/mihari/schemas/rule.rb +1 -1
  39. data/lib/mihari/{structs → services}/rule.rb +16 -16
  40. data/lib/mihari/structs/hunterhow.rb +104 -0
  41. data/lib/mihari/version.rb +1 -1
  42. data/lib/mihari/web/endpoints/rules.rb +9 -8
  43. data/lib/mihari/web/public/assets/index-33165282.css +1 -0
  44. data/lib/mihari/web/public/assets/index-61dc587c.js +1738 -0
  45. data/lib/mihari/web/public/assets/mode-yaml-a21faa53.js +8 -0
  46. data/lib/mihari/web/public/index.html +2 -2
  47. data/lib/mihari.rb +6 -2
  48. data/mihari.gemspec +6 -5
  49. metadata +67 -20
  50. data/lib/mihari/web/public/assets/index-b17c40c6.css +0 -1
  51. data/lib/mihari/web/public/assets/index-f740e4f9.js +0 -799
@@ -83,12 +83,13 @@ module Mihari
83
83
  id = params["id"].to_s
84
84
 
85
85
  begin
86
- rule = Mihari::Structs::Rule.from_model(Mihari::Rule.find(id))
86
+ rule = Mihari::Services::Rule.from_model(Mihari::Rule.find(id))
87
87
  rescue ActiveRecord::RecordNotFound
88
88
  error!({ message: "ID:#{id} is not found" }, 404)
89
89
  end
90
90
 
91
- rule.analyzer.run
91
+ analyzer = rule.to_analyzer
92
+ analyzer.run
92
93
 
93
94
  status 201
94
95
  present({ message: "ID:#{id} is ran successfully" }, with: Entities::Message)
@@ -105,7 +106,7 @@ module Mihari
105
106
  yaml = params[:yaml]
106
107
 
107
108
  begin
108
- rule = Structs::Rule.from_yaml(yaml)
109
+ rule = Services::Rule.from_yaml(yaml)
109
110
  rescue YAMLSyntaxError => e
110
111
  error!({ message: e.message }, 400)
111
112
  end
@@ -128,13 +129,13 @@ module Mihari
128
129
  end
129
130
 
130
131
  begin
131
- rule.model.save
132
+ rule.to_model.save
132
133
  rescue ActiveRecord::RecordNotUnique
133
134
  error!({ message: "ID:#{rule.id} is already registered" }, 400)
134
135
  end
135
136
 
136
137
  status 201
137
- present rule.model, with: Entities::Rule
138
+ present rule.to_model, with: Entities::Rule
138
139
  end
139
140
 
140
141
  desc "Update a rule", {
@@ -156,7 +157,7 @@ module Mihari
156
157
  end
157
158
 
158
159
  begin
159
- rule = Structs::Rule.from_yaml(yaml)
160
+ rule = Services::Rule.from_yaml(yaml)
160
161
  rescue YAMLSyntaxError => e
161
162
  error!({ message: e.message }, 400)
162
163
  end
@@ -171,13 +172,13 @@ module Mihari
171
172
  end
172
173
 
173
174
  begin
174
- rule.model.save
175
+ rule.to_model.save
175
176
  rescue ActiveRecord::RecordNotUnique
176
177
  error!({ message: "ID:#{id} is already registered" }, 400)
177
178
  end
178
179
 
179
180
  status 201
180
- present rule.model, with: Entities::Rule
181
+ present rule.to_model, with: Entities::Rule
181
182
  end
182
183
 
183
184
  desc "Delete a rule", {