mihari 5.3.0 → 5.3.2

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,8 @@
1
+ ace.define("ace/mode/yaml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"list.markup",regex:/^(?:-{3}|\.{3})\s*(?=#|$)/},{token:"list.markup",regex:/^\s*[\-?](?:$|\s)/},{token:"constant",regex:"!![\\w//]+"},{token:"constant.language",regex:"[&\\*][a-zA-Z0-9-_]+"},{token:["meta.tag","keyword"],regex:/^(\s*\w[^\s:]*?)(:(?=\s|$))/},{token:["meta.tag","keyword"],regex:/(\w[^\s:]*?)(\s*:(?=\s|$))/},{token:"keyword.operator",regex:"<<\\w*:\\w*"},{token:"keyword.operator",regex:"-\\s*(?=[{])"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:/[|>][-+\d]*(?:$|\s+(?:$|#))/,onMatch:function(e,t,n,r){r=r.replace(/ #.*/,"");var i=/^ *((:\s*)?-(\s*[^|>])?)?/.exec(r)[0].replace(/\S\s*$/,"").length,s=parseInt(/\d+[\s+-]*$/.exec(r));return s?(i+=s-1,this.next="mlString"):this.next="mlStringPre",n.length?(n[0]=this.next,n[1]=i):(n.push(this.next),n.push(i)),this.token},next:"mlString"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:/(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)$/},{token:"constant.numeric",regex:/[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/},{token:"constant.language.boolean",regex:"\\b(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:/[^\s,:\[\]\{\}]+/}],mlStringPre:[{token:"indent",regex:/^ *$/},{token:"indent",regex:/^ */,onMatch:function(e,t,n){var r=n[1];return r>=e.length?(this.next="start",n.shift(),n.shift()):(n[1]=e.length-1,this.next=n[0]="mlString"),this.token},next:"mlString"},{defaultToken:"string"}],mlString:[{token:"indent",regex:/^ *$/},{token:"indent",regex:/^ */,onMatch:function(e,t,n){var r=n[1];return r>=e.length?(this.next="start",n.splice(0)):this.next="mlString",this.token},next:"mlString"},{token:"string",regex:".+"}]},this.normalizeRules()};r.inherits(s,i),t.YamlHighlightRules=s}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./fold_mode").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!="#")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!="#")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\S/),a=s.search(/\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?"start":"","";if(u==-1){if(i==a&&r[i]=="#"&&s[i]=="#")return e.foldWidgets[n-1]="",e.foldWidgets[n+1]="","start"}else if(u==i&&r[i]=="#"&&o[i]=="#"&&e.getLine(n-2).search(/\S/)==-1)return e.foldWidgets[n-1]="start",e.foldWidgets[n+1]="","";return u!=-1&&u<i?e.foldWidgets[n-1]="start":e.foldWidgets[n-1]="",i<a?"start":""}}.call(o.prototype)}),ace.define("ace/mode/yaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/yaml_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./yaml_highlight_rules").YamlHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./folding/coffee").FoldMode,a=e("../worker/worker_client").WorkerClient,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u,this.$behaviour=this.$defaultBehaviour};r.inherits(f,i),function(){this.lineCommentStart=["#"],this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a(["ace"],"ace/mode/yaml_worker","YamlWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/yaml"}.call(f.prototype),t.Mode=f}); (function() {
2
+ ace.require(["ace/mode/yaml"], function(m) {
3
+ if (typeof module == "object" && typeof exports == "object" && module) {
4
+ module.exports = m;
5
+ }
6
+ });
7
+ })();
8
+
@@ -6,8 +6,8 @@
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
7
  <link rel="icon" href="/favicon.ico" />
8
8
  <title>Mihari</title>
9
- <script type="module" crossorigin src="/assets/index-71285b15.js"></script>
10
- <link rel="stylesheet" href="/assets/index-2ba8f0a6.css">
9
+ <script type="module" crossorigin src="/assets/index-116033d0.js"></script>
10
+ <link rel="stylesheet" href="/assets/index-33165282.css">
11
11
  </head>
12
12
  <body>
13
13
  <noscript>
data/lib/mihari.rb CHANGED
@@ -20,7 +20,6 @@ require "active_record"
20
20
 
21
21
  # dry-rb
22
22
  require "dry/files"
23
- require "dry/initializer"
24
23
  require "dry/schema"
25
24
  require "dry/struct"
26
25
  require "dry/types"
@@ -114,6 +113,9 @@ require "mihari/database"
114
113
  require "mihari/type_checker"
115
114
  require "mihari/http"
116
115
 
116
+ # Services
117
+ require "mihari/services/rule"
118
+
117
119
  # Structs
118
120
  require "mihari/structs/censys"
119
121
  require "mihari/structs/config"
@@ -122,7 +124,6 @@ require "mihari/structs/google_public_dns"
122
124
  require "mihari/structs/greynoise"
123
125
  require "mihari/structs/ipinfo"
124
126
  require "mihari/structs/onyphe"
125
- require "mihari/structs/rule"
126
127
  require "mihari/structs/shodan"
127
128
  require "mihari/structs/urlscan"
128
129
  require "mihari/structs/virustotal_intelligence"
data/mihari.gemspec CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
5
6
  require "mihari/version"
6
7
 
7
8
  def ci_env?
@@ -36,7 +37,7 @@ Gem::Specification.new do |spec|
36
37
  spec.require_paths = ["lib"]
37
38
 
38
39
  spec.add_development_dependency "bundler", "~> 2.4"
39
- spec.add_development_dependency "coveralls_reborn", "~> 0.27"
40
+ spec.add_development_dependency "coveralls_reborn", "~> 0.28"
40
41
  spec.add_development_dependency "fakefs", "~> 2.5"
41
42
  spec.add_development_dependency "fuubar", "~> 2.5"
42
43
  spec.add_development_dependency "mysql2", "~> 0.5"
@@ -47,7 +48,7 @@ Gem::Specification.new do |spec|
47
48
  spec.add_development_dependency "rerun", "~> 0.14"
48
49
  spec.add_development_dependency "rspec", "~> 3.12"
49
50
  spec.add_development_dependency "simplecov-lcov", "~> 0.8.0"
50
- spec.add_development_dependency "standard", "~> 1.29"
51
+ spec.add_development_dependency "standard", "~> 1.30"
51
52
  spec.add_development_dependency "timecop", "~> 0.9"
52
53
  spec.add_development_dependency "vcr", "~> 6.2"
53
54
  spec.add_development_dependency "webmock", "~> 3.18"
@@ -59,7 +60,7 @@ Gem::Specification.new do |spec|
59
60
  end
60
61
 
61
62
  spec.add_dependency "activerecord", "7.0.6"
62
- spec.add_dependency "addressable", "2.8.4"
63
+ spec.add_dependency "addressable", "2.8.5"
63
64
  spec.add_dependency "awrence", "2.0.1"
64
65
  spec.add_dependency "dotenv", "2.8.1"
65
66
  spec.add_dependency "dry-container", "0.11.0"
@@ -85,7 +86,7 @@ Gem::Specification.new do |spec|
85
86
  spec.add_dependency "rack", "3.0.8"
86
87
  spec.add_dependency "rack-cors", "2.0.1"
87
88
  spec.add_dependency "rackup", "2.1.0"
88
- spec.add_dependency "semantic_logger", "4.13.0"
89
+ spec.add_dependency "semantic_logger", "4.14.0"
89
90
  spec.add_dependency "sentry-ruby", "5.10.0"
90
91
  spec.add_dependency "slack-notifier", "2.4.0"
91
92
  spec.add_dependency "sqlite3", "1.6.3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mihari
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manabu Niseki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-16 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.27'
33
+ version: '0.28'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.27'
40
+ version: '0.28'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fakefs
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.29'
187
+ version: '1.30'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '1.29'
194
+ version: '1.30'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: timecop
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -296,14 +296,14 @@ dependencies:
296
296
  requirements:
297
297
  - - '='
298
298
  - !ruby/object:Gem::Version
299
- version: 2.8.4
299
+ version: 2.8.5
300
300
  type: :runtime
301
301
  prerelease: false
302
302
  version_requirements: !ruby/object:Gem::Requirement
303
303
  requirements:
304
304
  - - '='
305
305
  - !ruby/object:Gem::Version
306
- version: 2.8.4
306
+ version: 2.8.5
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: awrence
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -660,14 +660,14 @@ dependencies:
660
660
  requirements:
661
661
  - - '='
662
662
  - !ruby/object:Gem::Version
663
- version: 4.13.0
663
+ version: 4.14.0
664
664
  type: :runtime
665
665
  prerelease: false
666
666
  version_requirements: !ruby/object:Gem::Requirement
667
667
  requirements:
668
668
  - - '='
669
669
  - !ruby/object:Gem::Version
670
- version: 4.13.0
670
+ version: 4.14.0
671
671
  - !ruby/object:Gem::Dependency
672
672
  name: sentry-ruby
673
673
  requirement: !ruby/object:Gem::Requirement
@@ -799,6 +799,7 @@ files:
799
799
  - frontend/public/favicon.ico
800
800
  - frontend/scripts/swagger_doc_to_yaml.rb
801
801
  - frontend/src/App.vue
802
+ - frontend/src/ace-config.ts
802
803
  - frontend/src/api-helper.ts
803
804
  - frontend/src/api.ts
804
805
  - frontend/src/components/ErrorMessage.vue
@@ -976,6 +977,7 @@ files:
976
977
  - lib/mihari/schemas/enricher.rb
977
978
  - lib/mihari/schemas/macros.rb
978
979
  - lib/mihari/schemas/rule.rb
980
+ - lib/mihari/services/rule.rb
979
981
  - lib/mihari/structs/censys.rb
980
982
  - lib/mihari/structs/config.rb
981
983
  - lib/mihari/structs/filters.rb
@@ -983,7 +985,6 @@ files:
983
985
  - lib/mihari/structs/greynoise.rb
984
986
  - lib/mihari/structs/ipinfo.rb
985
987
  - lib/mihari/structs/onyphe.rb
986
- - lib/mihari/structs/rule.rb
987
988
  - lib/mihari/structs/shodan.rb
988
989
  - lib/mihari/structs/urlscan.rb
989
990
  - lib/mihari/structs/virustotal_intelligence.rb
@@ -1001,16 +1002,9 @@ files:
1001
1002
  - lib/mihari/web/endpoints/tags.rb
1002
1003
  - lib/mihari/web/middleware/connection_adapter.rb
1003
1004
  - lib/mihari/web/middleware/error_notification_adapter.rb
1004
- - lib/mihari/web/public/assets/fa-brands-400-20c4a58b.ttf
1005
- - lib/mihari/web/public/assets/fa-brands-400-74833209.woff2
1006
- - lib/mihari/web/public/assets/fa-regular-400-528d022d.ttf
1007
- - lib/mihari/web/public/assets/fa-regular-400-8e7e5ea1.woff2
1008
- - lib/mihari/web/public/assets/fa-solid-900-67a65763.ttf
1009
- - lib/mihari/web/public/assets/fa-solid-900-7152a693.woff2
1010
- - lib/mihari/web/public/assets/fa-v4compatibility-0515a423.ttf
1011
- - lib/mihari/web/public/assets/fa-v4compatibility-694a17c3.woff2
1012
- - lib/mihari/web/public/assets/index-2ba8f0a6.css
1013
- - lib/mihari/web/public/assets/index-71285b15.js
1005
+ - lib/mihari/web/public/assets/index-116033d0.js
1006
+ - lib/mihari/web/public/assets/index-33165282.css
1007
+ - lib/mihari/web/public/assets/mode-yaml-a21faa53.js
1014
1008
  - lib/mihari/web/public/favicon.ico
1015
1009
  - lib/mihari/web/public/index.html
1016
1010
  - lib/mihari/web/public/redoc-static.html