mihari 5.6.2 → 5.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) 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/docs/analyzers/fofa.md +31 -0
  6. data/docs/analyzers/index.md +1 -0
  7. data/frontend/package-lock.json +73 -73
  8. data/frontend/package.json +5 -5
  9. data/frontend/src/components/alert/Form.vue +1 -14
  10. data/frontend/src/components/artifact/AS.vue +2 -8
  11. data/frontend/src/components/artifact/DnsRecords.vue +2 -8
  12. data/frontend/src/components/artifact/ReverseDnsNames.vue +2 -10
  13. data/frontend/src/components/artifact/WhoisRecord.vue +1 -1
  14. data/lib/mihari/actor.rb +14 -4
  15. data/lib/mihari/analyzers/base.rb +13 -12
  16. data/lib/mihari/analyzers/binaryedge.rb +4 -1
  17. data/lib/mihari/analyzers/censys.rb +4 -2
  18. data/lib/mihari/analyzers/circl.rb +4 -1
  19. data/lib/mihari/analyzers/crtsh.rb +4 -1
  20. data/lib/mihari/analyzers/dnstwister.rb +4 -1
  21. data/lib/mihari/analyzers/feed.rb +3 -0
  22. data/lib/mihari/analyzers/fofa.rb +65 -0
  23. data/lib/mihari/analyzers/greynoise.rb +4 -1
  24. data/lib/mihari/analyzers/hunterhow.rb +6 -1
  25. data/lib/mihari/analyzers/onyphe.rb +4 -1
  26. data/lib/mihari/analyzers/otx.rb +4 -1
  27. data/lib/mihari/analyzers/passivetotal.rb +4 -1
  28. data/lib/mihari/analyzers/pulsedive.rb +3 -0
  29. data/lib/mihari/analyzers/securitytrails.rb +4 -1
  30. data/lib/mihari/analyzers/shodan.rb +4 -1
  31. data/lib/mihari/analyzers/urlscan.rb +4 -1
  32. data/lib/mihari/analyzers/virustotal.rb +4 -1
  33. data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -1
  34. data/lib/mihari/analyzers/zoomeye.rb +5 -2
  35. data/lib/mihari/cli/alert.rb +3 -0
  36. data/lib/mihari/cli/base.rb +3 -0
  37. data/lib/mihari/cli/database.rb +3 -0
  38. data/lib/mihari/cli/main.rb +3 -0
  39. data/lib/mihari/cli/rule.rb +3 -0
  40. data/lib/mihari/clients/base.rb +3 -0
  41. data/lib/mihari/clients/binaryedge.rb +5 -2
  42. data/lib/mihari/clients/censys.rb +7 -4
  43. data/lib/mihari/clients/circl.rb +3 -0
  44. data/lib/mihari/clients/crtsh.rb +3 -0
  45. data/lib/mihari/clients/dnstwister.rb +3 -0
  46. data/lib/mihari/clients/fofa.rb +83 -0
  47. data/lib/mihari/clients/greynoise.rb +5 -2
  48. data/lib/mihari/clients/hunterhow.rb +5 -2
  49. data/lib/mihari/clients/misp.rb +3 -0
  50. data/lib/mihari/clients/onyphe.rb +5 -2
  51. data/lib/mihari/clients/otx.rb +3 -0
  52. data/lib/mihari/clients/passivetotal.rb +3 -0
  53. data/lib/mihari/clients/publsedive.rb +4 -1
  54. data/lib/mihari/clients/securitytrails.rb +3 -0
  55. data/lib/mihari/clients/shodan.rb +5 -2
  56. data/lib/mihari/clients/the_hive.rb +3 -0
  57. data/lib/mihari/clients/urlscan.rb +7 -4
  58. data/lib/mihari/clients/virustotal.rb +5 -2
  59. data/lib/mihari/clients/zoomeye.rb +3 -0
  60. data/lib/mihari/commands/alert.rb +5 -14
  61. data/lib/mihari/commands/database.rb +3 -0
  62. data/lib/mihari/commands/rule.rb +10 -1
  63. data/lib/mihari/commands/search.rb +9 -6
  64. data/lib/mihari/commands/version.rb +3 -0
  65. data/lib/mihari/commands/web.rb +4 -1
  66. data/lib/mihari/config.rb +139 -150
  67. data/lib/mihari/constants.rb +1 -1
  68. data/lib/mihari/database.rb +6 -0
  69. data/lib/mihari/emitters/base.rb +13 -11
  70. data/lib/mihari/emitters/database.rb +4 -1
  71. data/lib/mihari/emitters/misp.rb +7 -4
  72. data/lib/mihari/emitters/slack.rb +3 -3
  73. data/lib/mihari/emitters/the_hive.rb +3 -3
  74. data/lib/mihari/emitters/webhook.rb +4 -3
  75. data/lib/mihari/enrichers/base.rb +15 -9
  76. data/lib/mihari/enrichers/google_public_dns.rb +6 -5
  77. data/lib/mihari/enrichers/ipinfo.rb +10 -8
  78. data/lib/mihari/enrichers/shodan.rb +4 -6
  79. data/lib/mihari/enrichers/whois.rb +12 -9
  80. data/lib/mihari/errors.rb +6 -0
  81. data/lib/mihari/feed/parser.rb +3 -0
  82. data/lib/mihari/feed/reader.rb +3 -0
  83. data/lib/mihari/http.rb +6 -0
  84. data/lib/mihari/mixins/autonomous_system.rb +3 -0
  85. data/lib/mihari/mixins/configurable.rb +3 -0
  86. data/lib/mihari/mixins/error_notification.rb +3 -0
  87. data/lib/mihari/mixins/falsepositive.rb +3 -0
  88. data/lib/mihari/mixins/refang.rb +3 -0
  89. data/lib/mihari/mixins/retriable.rb +6 -2
  90. data/lib/mihari/models/alert.rb +7 -4
  91. data/lib/mihari/models/artifact.rb +6 -0
  92. data/lib/mihari/models/autonomous_system.rb +4 -1
  93. data/lib/mihari/models/cpe.rb +4 -1
  94. data/lib/mihari/models/dns.rb +4 -1
  95. data/lib/mihari/models/geolocation.rb +4 -1
  96. data/lib/mihari/models/port.rb +4 -1
  97. data/lib/mihari/models/reverse_dns.rb +4 -1
  98. data/lib/mihari/models/rule.rb +6 -3
  99. data/lib/mihari/models/tag.rb +3 -0
  100. data/lib/mihari/models/tagging.rb +3 -0
  101. data/lib/mihari/models/whois.rb +4 -3
  102. data/lib/mihari/rule.rb +17 -12
  103. data/lib/mihari/schemas/alert.rb +3 -0
  104. data/lib/mihari/schemas/analyzer.rb +11 -0
  105. data/lib/mihari/schemas/emitter.rb +3 -0
  106. data/lib/mihari/schemas/enricher.rb +3 -0
  107. data/lib/mihari/schemas/macros.rb +4 -0
  108. data/lib/mihari/schemas/mixins.rb +5 -0
  109. data/lib/mihari/schemas/rule.rb +3 -0
  110. data/lib/mihari/service.rb +16 -0
  111. data/lib/mihari/services/alert_builder.rb +8 -5
  112. data/lib/mihari/services/alert_proxy.rb +6 -1
  113. data/lib/mihari/services/alert_runner.rb +8 -12
  114. data/lib/mihari/services/rule_builder.rb +8 -5
  115. data/lib/mihari/services/rule_runner.rb +8 -10
  116. data/lib/mihari/structs/binaryedge.rb +13 -28
  117. data/lib/mihari/structs/censys.rb +48 -127
  118. data/lib/mihari/structs/config.rb +19 -30
  119. data/lib/mihari/structs/filters.rb +38 -0
  120. data/lib/mihari/structs/fofa.rb +44 -0
  121. data/lib/mihari/structs/google_public_dns.rb +10 -28
  122. data/lib/mihari/structs/greynoise.rb +33 -84
  123. data/lib/mihari/structs/hunterhow.rb +24 -22
  124. data/lib/mihari/structs/ipinfo.rb +14 -35
  125. data/lib/mihari/structs/onyphe.rb +31 -76
  126. data/lib/mihari/structs/shodan.rb +47 -112
  127. data/lib/mihari/structs/urlscan.rb +24 -63
  128. data/lib/mihari/structs/virustotal_intelligence.rb +20 -56
  129. data/lib/mihari/type_checker.rb +4 -0
  130. data/lib/mihari/types.rb +3 -0
  131. data/lib/mihari/version.rb +1 -1
  132. data/lib/mihari/web/api.rb +15 -10
  133. data/lib/mihari/web/app.rb +59 -54
  134. data/lib/mihari/web/endpoints/alerts.rb +94 -89
  135. data/lib/mihari/web/endpoints/artifacts.rb +115 -110
  136. data/lib/mihari/web/endpoints/configs.rb +18 -13
  137. data/lib/mihari/web/endpoints/ip_addresses.rb +21 -16
  138. data/lib/mihari/web/endpoints/rules.rb +203 -198
  139. data/lib/mihari/web/endpoints/tags.rb +41 -36
  140. data/lib/mihari/web/middleware/connection_adapter.rb +16 -9
  141. data/lib/mihari/web/middleware/error_notification_adapter.rb +17 -10
  142. data/lib/mihari/web/public/assets/{index-28d4c79d.js → index-821134e2.js} +30 -30
  143. data/lib/mihari/web/public/assets/mode-yaml-24faa242.js +8 -0
  144. data/lib/mihari/web/public/index.html +1 -1
  145. data/lib/mihari.rb +24 -5
  146. data/mihari.gemspec +8 -1
  147. data/mkdocs.yml +3 -2
  148. metadata +39 -7
  149. data/lib/mihari/templates/rule.yml.erb +0 -5
  150. data/lib/mihari/web/public/assets/mode-yaml-a21faa53.js +0 -8
@@ -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.commentBlock=function(e,t){var n=/\S/,r=e.getLine(t),i=r.search(n);if(i==-1||r[i]!="#")return;var o=r.length,u=e.getLength(),a=t,f=t;while(++t<u){r=e.getLine(t);var l=r.search(n);if(l==-1)continue;if(r[l]!="#")break;f=t}if(f>a){var c=e.getLine(f).length;return new s(a,o,f,c)}},this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;r=this.commentBlock(e,n);if(r)return r},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/folding/yaml",["require","exports","module","ace/lib/oop","ace/mode/folding/coffee","ace/range"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("./coffee").FoldMode,s=e("../../range").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=/\S/,i=e.getLine(n),o=i.search(r),u=i[o]==="#",a=i[o]==="-";if(o==-1)return;var f=i.length,l=e.getLength(),c=n,h=n;if(u){var p=this.commentBlock(e,n);if(p)return p}else if(a){var p=this.indentationBlock(e,n);if(p)return p}else while(++n<l){var i=e.getLine(n),d=i.search(r);if(d==-1)continue;if(d<=o&&i[o]!=="-"){var v=e.getTokenAt(n,0);if(!v||v.type!=="string")break}h=n}if(h>c){var m=e.getLine(h).length;return new s(c,f,h,m)}},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/),f=r[i]==="-";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":u!=-1&&u==i&&f?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/yaml","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/yaml").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,7 +6,7 @@
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-28d4c79d.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-821134e2.js"></script>
10
10
  <link rel="stylesheet" href="/assets/index-56fc2187.css">
11
11
  </head>
12
12
  <body>
data/lib/mihari.rb CHANGED
@@ -3,8 +3,6 @@
3
3
  # standard libs
4
4
  require "ipaddr"
5
5
  require "json"
6
- require "net/http"
7
- require "net/https"
8
6
  require "resolv"
9
7
  require "yaml"
10
8
 
@@ -59,17 +57,23 @@ require "mihari/mixins/error_notification"
59
57
  require "mihari/mixins/refang"
60
58
  require "mihari/mixins/retriable"
61
59
 
60
+ #
61
+ # Mihari module
62
+ #
62
63
  module Mihari
63
64
  class << self
64
65
  include Memist::Memoizable
65
66
 
67
+ #
68
+ # @return [Array<Mihari::Emitters::Base>]
69
+ #
66
70
  def emitters
67
71
  []
68
72
  end
69
73
  memoize :emitters
70
74
 
71
75
  #
72
- # @return [Hash<String, Mihari::Enrichers::Base>]
76
+ # @return [Hash{String => Mihari::Enrichers::Base}]
73
77
  #
74
78
  def emitter_to_class
75
79
  @emitter_to_class ||= emitters.flat_map do |klass|
@@ -77,13 +81,16 @@ module Mihari
77
81
  end.to_h
78
82
  end
79
83
 
84
+ #
85
+ # @return [Array<Mihari::Analyzers::Base>]
86
+ #
80
87
  def analyzers
81
88
  []
82
89
  end
83
90
  memoize :analyzers
84
91
 
85
92
  #
86
- # @return [Hash<String, Mihari::Analyzers::Base>]
93
+ # @return [Hash{String => Mihari::Analyzers::Base}]
87
94
  #
88
95
  def analyzer_to_class
89
96
  @analyzer_to_class ||= analyzers.flat_map do |klass|
@@ -91,13 +98,16 @@ module Mihari
91
98
  end.to_h
92
99
  end
93
100
 
101
+ #
102
+ # @return [Array<Mihari::Enrichers::Base>]
103
+ #
94
104
  def enrichers
95
105
  []
96
106
  end
97
107
  memoize :enrichers
98
108
 
99
109
  #
100
- # @return [Hash<String, Mihari::Enrichers::Base>]
110
+ # @return [Hash{String => Mihari::Enrichers::Base}]
101
111
  #
102
112
  def enricher_to_class
103
113
  @enricher_to_class ||= enrichers.flat_map do |klass|
@@ -105,6 +115,9 @@ module Mihari
105
115
  end.to_h
106
116
  end
107
117
 
118
+ #
119
+ # @return [Mihari::Config]
120
+ #
108
121
  def config
109
122
  @config ||= Config.new
110
123
  end
@@ -130,7 +143,10 @@ module Mihari
130
143
  end
131
144
 
132
145
  # Core classes
146
+ require "mihari/service"
147
+
133
148
  require "mihari/actor"
149
+
134
150
  require "mihari/database"
135
151
  require "mihari/http"
136
152
  require "mihari/type_checker"
@@ -174,6 +190,7 @@ require "mihari/clients/censys"
174
190
  require "mihari/clients/circl"
175
191
  require "mihari/clients/crtsh"
176
192
  require "mihari/clients/dnstwister"
193
+ require "mihari/clients/fofa"
177
194
  require "mihari/clients/greynoise"
178
195
  require "mihari/clients/hunterhow"
179
196
  require "mihari/clients/misp"
@@ -197,6 +214,7 @@ require "mihari/analyzers/circl"
197
214
  require "mihari/analyzers/crtsh"
198
215
  require "mihari/analyzers/dnstwister"
199
216
  require "mihari/analyzers/feed"
217
+ require "mihari/analyzers/fofa"
200
218
  require "mihari/analyzers/greynoise"
201
219
  require "mihari/analyzers/hunterhow"
202
220
  require "mihari/analyzers/onyphe"
@@ -221,6 +239,7 @@ require "mihari/structs/binaryedge"
221
239
  require "mihari/structs/censys"
222
240
  require "mihari/structs/config"
223
241
  require "mihari/structs/filters"
242
+ require "mihari/structs/fofa"
224
243
  require "mihari/structs/google_public_dns"
225
244
  require "mihari/structs/greynoise"
226
245
  require "mihari/structs/ipinfo"
data/mihari.gemspec CHANGED
@@ -10,6 +10,10 @@ def ci_env?
10
10
  ENV["CI"]
11
11
  end
12
12
 
13
+ def is_ruby2?
14
+ RUBY_VERSION.to_s.start_with?("2.")
15
+ end
16
+
13
17
  Gem::Specification.new do |spec|
14
18
  spec.name = "mihari"
15
19
  spec.version = Mihari::VERSION
@@ -56,6 +60,8 @@ Gem::Specification.new do |spec|
56
60
  spec.add_development_dependency "vcr", "~> 6.2"
57
61
  spec.add_development_dependency "webmock", "~> 3.19"
58
62
 
63
+ spec.add_development_dependency "rubocop-yard", "~> 0.7" unless is_ruby2?
64
+
59
65
  unless ci_env?
60
66
  spec.add_development_dependency "lefthook", "~> 1.5"
61
67
  spec.add_development_dependency "solargraph", "~> 0.49"
@@ -63,6 +69,7 @@ Gem::Specification.new do |spec|
63
69
 
64
70
  spec.add_dependency "activerecord", "7.1.1"
65
71
  spec.add_dependency "addressable", "2.8.5"
72
+ spec.add_dependency "anyway_config", "2.5.4"
66
73
  spec.add_dependency "awrence", "2.0.1"
67
74
  spec.add_dependency "dotenv", "2.8.1"
68
75
  spec.add_dependency "dry-container", "0.11.0"
@@ -91,7 +98,7 @@ Gem::Specification.new do |spec|
91
98
  spec.add_dependency "semantic_logger", "4.14.0"
92
99
  spec.add_dependency "sentry-ruby", "5.12.0"
93
100
  spec.add_dependency "slack-notifier", "2.4.0"
94
- spec.add_dependency "sqlite3", "1.6.7"
101
+ spec.add_dependency "sqlite3", "1.6.8"
95
102
  spec.add_dependency "thor", "1.3.0"
96
103
  spec.add_dependency "thor-hollaback", "0.2.1"
97
104
  spec.add_dependency "uuidtools", "2.2.0"
data/mkdocs.yml CHANGED
@@ -29,6 +29,7 @@ markdown_extensions:
29
29
  permalink: true
30
30
  - admonition
31
31
  - pymdownx.details
32
- - pymdownx.superfences
33
- - pymdownx.highlight
34
32
  - pymdownx.extra
33
+ - pymdownx.highlight
34
+ - pymdownx.magiclink
35
+ - pymdownx.superfences
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.6.2
4
+ version: 5.7.0
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-10-28 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -276,6 +276,20 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: '3.19'
279
+ - !ruby/object:Gem::Dependency
280
+ name: rubocop-yard
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '0.7'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '0.7'
279
293
  - !ruby/object:Gem::Dependency
280
294
  name: lefthook
281
295
  requirement: !ruby/object:Gem::Requirement
@@ -332,6 +346,20 @@ dependencies:
332
346
  - - '='
333
347
  - !ruby/object:Gem::Version
334
348
  version: 2.8.5
349
+ - !ruby/object:Gem::Dependency
350
+ name: anyway_config
351
+ requirement: !ruby/object:Gem::Requirement
352
+ requirements:
353
+ - - '='
354
+ - !ruby/object:Gem::Version
355
+ version: 2.5.4
356
+ type: :runtime
357
+ prerelease: false
358
+ version_requirements: !ruby/object:Gem::Requirement
359
+ requirements:
360
+ - - '='
361
+ - !ruby/object:Gem::Version
362
+ version: 2.5.4
335
363
  - !ruby/object:Gem::Dependency
336
364
  name: awrence
337
365
  requirement: !ruby/object:Gem::Requirement
@@ -730,14 +758,14 @@ dependencies:
730
758
  requirements:
731
759
  - - '='
732
760
  - !ruby/object:Gem::Version
733
- version: 1.6.7
761
+ version: 1.6.8
734
762
  type: :runtime
735
763
  prerelease: false
736
764
  version_requirements: !ruby/object:Gem::Requirement
737
765
  requirements:
738
766
  - - '='
739
767
  - !ruby/object:Gem::Version
740
- version: 1.6.7
768
+ version: 1.6.8
741
769
  - !ruby/object:Gem::Dependency
742
770
  name: thor
743
771
  requirement: !ruby/object:Gem::Requirement
@@ -835,6 +863,7 @@ files:
835
863
  - docs/analyzers/crtsh.md
836
864
  - docs/analyzers/dnstwister.md
837
865
  - docs/analyzers/feed.md
866
+ - docs/analyzers/fofa.md
838
867
  - docs/analyzers/greynoise.md
839
868
  - docs/analyzers/hunterhow.md
840
869
  - docs/analyzers/index.md
@@ -964,6 +993,7 @@ files:
964
993
  - lib/mihari/analyzers/crtsh.rb
965
994
  - lib/mihari/analyzers/dnstwister.rb
966
995
  - lib/mihari/analyzers/feed.rb
996
+ - lib/mihari/analyzers/fofa.rb
967
997
  - lib/mihari/analyzers/greynoise.rb
968
998
  - lib/mihari/analyzers/hunterhow.rb
969
999
  - lib/mihari/analyzers/onyphe.rb
@@ -987,6 +1017,7 @@ files:
987
1017
  - lib/mihari/clients/circl.rb
988
1018
  - lib/mihari/clients/crtsh.rb
989
1019
  - lib/mihari/clients/dnstwister.rb
1020
+ - lib/mihari/clients/fofa.rb
990
1021
  - lib/mihari/clients/greynoise.rb
991
1022
  - lib/mihari/clients/hunterhow.rb
992
1023
  - lib/mihari/clients/misp.rb
@@ -1065,6 +1096,7 @@ files:
1065
1096
  - lib/mihari/schemas/mixins.rb
1066
1097
  - lib/mihari/schemas/options.rb
1067
1098
  - lib/mihari/schemas/rule.rb
1099
+ - lib/mihari/service.rb
1068
1100
  - lib/mihari/services/alert_builder.rb
1069
1101
  - lib/mihari/services/alert_proxy.rb
1070
1102
  - lib/mihari/services/alert_runner.rb
@@ -1074,6 +1106,7 @@ files:
1074
1106
  - lib/mihari/structs/censys.rb
1075
1107
  - lib/mihari/structs/config.rb
1076
1108
  - lib/mihari/structs/filters.rb
1109
+ - lib/mihari/structs/fofa.rb
1077
1110
  - lib/mihari/structs/google_public_dns.rb
1078
1111
  - lib/mihari/structs/greynoise.rb
1079
1112
  - lib/mihari/structs/hunterhow.rb
@@ -1082,7 +1115,6 @@ files:
1082
1115
  - lib/mihari/structs/shodan.rb
1083
1116
  - lib/mihari/structs/urlscan.rb
1084
1117
  - lib/mihari/structs/virustotal_intelligence.rb
1085
- - lib/mihari/templates/rule.yml.erb
1086
1118
  - lib/mihari/type_checker.rb
1087
1119
  - lib/mihari/types.rb
1088
1120
  - lib/mihari/version.rb
@@ -1096,9 +1128,9 @@ files:
1096
1128
  - lib/mihari/web/endpoints/tags.rb
1097
1129
  - lib/mihari/web/middleware/connection_adapter.rb
1098
1130
  - lib/mihari/web/middleware/error_notification_adapter.rb
1099
- - lib/mihari/web/public/assets/index-28d4c79d.js
1100
1131
  - lib/mihari/web/public/assets/index-56fc2187.css
1101
- - lib/mihari/web/public/assets/mode-yaml-a21faa53.js
1132
+ - lib/mihari/web/public/assets/index-821134e2.js
1133
+ - lib/mihari/web/public/assets/mode-yaml-24faa242.js
1102
1134
  - lib/mihari/web/public/favicon.ico
1103
1135
  - lib/mihari/web/public/index.html
1104
1136
  - lib/mihari/web/public/redoc-static.html
@@ -1,5 +0,0 @@
1
- id: <%= SecureRandom.uuid %>
2
- title: Title goes here
3
- description: Description goes here
4
- created_on: <%= Date.today %>
5
- queries: []
@@ -1,8 +0,0 @@
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
-