mihari 5.4.9 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/analyzers/binaryedge.md +2 -2
- data/docs/analyzers/censys.md +3 -3
- data/docs/analyzers/circl.md +3 -3
- data/docs/analyzers/crtsh.md +2 -2
- data/docs/analyzers/dnstwister.md +1 -1
- data/docs/analyzers/feed.md +7 -7
- data/docs/analyzers/greynoise.md +2 -2
- data/docs/analyzers/hunterhow.md +4 -4
- data/docs/analyzers/index.md +13 -8
- data/docs/analyzers/onyphe.md +2 -2
- data/docs/analyzers/otx.md +2 -2
- data/docs/analyzers/passivetotal.md +7 -3
- data/docs/analyzers/pulsedive.md +2 -2
- data/docs/analyzers/securitytrails.md +6 -2
- data/docs/analyzers/shodan.md +2 -2
- data/docs/analyzers/urlscan.md +2 -2
- data/docs/analyzers/virustotal.md +6 -2
- data/docs/analyzers/virustotal_intelligence.md +6 -2
- data/docs/analyzers/zoomeye.md +3 -3
- data/docs/emitters/hive.md +4 -4
- data/docs/emitters/index.md +29 -0
- data/docs/emitters/misp.md +2 -2
- data/docs/emitters/slack.md +2 -7
- data/docs/emitters/webhook.md +4 -4
- data/docs/enrichers/index.md +29 -0
- data/docs/enrichers/ipinfo.md +7 -0
- data/docs/index.md +0 -2
- data/docs/installation.md +1 -1
- data/docs/rule.md +12 -15
- data/docs/usage.md +5 -2
- data/frontend/package-lock.json +294 -2772
- data/frontend/package.json +10 -10
- data/frontend/src/components/ErrorMessage.vue +0 -1
- data/frontend/src/components/alert/Alerts.vue +0 -1
- data/frontend/src/components/alert/AlertsWithPagination.vue +0 -1
- data/frontend/src/components/alert/AlertsWrapper.vue +0 -6
- data/frontend/src/components/alert/Form.vue +1 -3
- data/frontend/src/components/artifact/Artifact.vue +0 -17
- data/frontend/src/components/artifact/ArtifactWrapper.vue +0 -2
- data/frontend/src/components/artifact/WhoisRecord.vue +0 -3
- data/frontend/src/components/config/ConfigsWrapper.vue +0 -2
- data/frontend/src/components/rule/EditRule.vue +0 -3
- data/frontend/src/components/rule/EditRuleWrapper.vue +0 -2
- data/frontend/src/components/rule/Form.vue +1 -3
- data/frontend/src/components/rule/NewRule.vue +0 -3
- data/frontend/src/components/rule/Rule.vue +1 -7
- data/frontend/src/components/rule/RuleWrapper.vue +0 -2
- data/frontend/src/components/rule/RulesWrapper.vue +0 -6
- data/frontend/src/swagger.yaml +254 -254
- data/lib/mihari/analyzers/base.rb +7 -37
- data/lib/mihari/analyzers/binaryedge.rb +5 -1
- data/lib/mihari/analyzers/censys.rb +6 -1
- data/lib/mihari/analyzers/greynoise.rb +5 -1
- data/lib/mihari/analyzers/hunterhow.rb +5 -1
- data/lib/mihari/analyzers/onyphe.rb +5 -1
- data/lib/mihari/analyzers/passivetotal.rb +9 -0
- data/lib/mihari/analyzers/pulsedive.rb +1 -1
- data/lib/mihari/analyzers/rule.rb +55 -54
- data/lib/mihari/analyzers/securitytrails.rb +9 -0
- data/lib/mihari/analyzers/shodan.rb +5 -1
- data/lib/mihari/analyzers/urlscan.rb +5 -1
- data/lib/mihari/analyzers/virustotal.rb +11 -2
- data/lib/mihari/analyzers/virustotal_intelligence.rb +21 -1
- data/lib/mihari/analyzers/zoomeye.rb +7 -3
- data/lib/mihari/base.rb +69 -0
- data/lib/mihari/cli/main.rb +36 -0
- data/lib/mihari/clients/base.rb +7 -7
- data/lib/mihari/clients/binaryedge.rb +10 -4
- data/lib/mihari/clients/censys.rb +11 -4
- data/lib/mihari/clients/greynoise.rb +10 -4
- data/lib/mihari/clients/hunterhow.rb +10 -4
- data/lib/mihari/clients/misp.rb +3 -2
- data/lib/mihari/clients/onyphe.rb +10 -4
- data/lib/mihari/clients/shodan.rb +10 -4
- data/lib/mihari/clients/the_hive.rb +3 -2
- data/lib/mihari/clients/urlscan.rb +9 -3
- data/lib/mihari/clients/virustotal.rb +10 -4
- data/lib/mihari/clients/zoomeye.rb +11 -5
- data/lib/mihari/commands/alert.rb +6 -33
- data/lib/mihari/commands/rule.rb +7 -12
- data/lib/mihari/commands/search.rb +10 -38
- data/lib/mihari/config.rb +8 -0
- data/lib/mihari/constants.rb +3 -3
- data/lib/mihari/emitters/base.rb +22 -15
- data/lib/mihari/emitters/database.rb +1 -1
- data/lib/mihari/emitters/misp.rb +7 -6
- data/lib/mihari/emitters/slack.rb +24 -6
- data/lib/mihari/emitters/the_hive.rb +8 -7
- data/lib/mihari/emitters/webhook.rb +31 -29
- data/lib/mihari/enrichers/base.rb +25 -19
- data/lib/mihari/enrichers/google_public_dns.rb +38 -38
- data/lib/mihari/enrichers/ipinfo.rb +32 -34
- data/lib/mihari/enrichers/shodan.rb +18 -26
- data/lib/mihari/enrichers/whois.rb +121 -111
- data/lib/mihari/mixins/retriable.rb +4 -2
- data/lib/mihari/models/artifact.rb +37 -23
- data/lib/mihari/models/autonomous_system.rb +3 -2
- data/lib/mihari/models/cpe.rb +3 -2
- data/lib/mihari/models/dns.rb +3 -2
- data/lib/mihari/models/geolocation.rb +3 -2
- data/lib/mihari/models/port.rb +3 -2
- data/lib/mihari/models/reverse_dns.rb +3 -2
- data/lib/mihari/models/whois.rb +4 -3
- data/lib/mihari/schemas/analyzer.rb +24 -23
- data/lib/mihari/schemas/emitter.rb +32 -25
- data/lib/mihari/schemas/enricher.rb +21 -2
- data/lib/mihari/schemas/options.rb +27 -0
- data/lib/mihari/schemas/rule.rb +8 -4
- data/lib/mihari/services/alert_runner.rb +1 -1
- data/lib/mihari/services/rule_runner.rb +1 -11
- data/lib/mihari/types.rb +1 -14
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/endpoints/ip_addresses.rb +1 -1
- data/lib/mihari/web/public/assets/{index-33165282.css → index-56fc2187.css} +1 -1
- data/lib/mihari/web/public/assets/index-9cc489e6.js +1749 -0
- data/lib/mihari/web/public/index.html +2 -2
- data/lib/mihari/web/public/redoc-static.html +400 -400
- data/lib/mihari.rb +67 -37
- data/mihari.gemspec +3 -2
- data/mkdocs.yml +8 -6
- data/requirements.txt +1 -1
- metadata +24 -8
- data/lib/mihari/web/public/assets/index-a92abd57.js +0 -1740
@@ -2,8 +2,27 @@
|
|
2
2
|
|
3
3
|
module Mihari
|
4
4
|
module Schemas
|
5
|
-
|
6
|
-
|
5
|
+
module Enrichers
|
6
|
+
IPInfo = Dry::Schema.Params do
|
7
|
+
required(:enricher).value(Types::String.enum("ipinfo"))
|
8
|
+
optional(:api_key).value(:string)
|
9
|
+
optional(:options).hash(Options)
|
10
|
+
end
|
11
|
+
|
12
|
+
Whois = Dry::Schema.Params do
|
13
|
+
required(:enricher).value(Types::String.enum("whois"))
|
14
|
+
optional(:options).hash(Options)
|
15
|
+
end
|
16
|
+
|
17
|
+
Shodan = Dry::Schema.Params do
|
18
|
+
required(:enricher).value(Types::String.enum("shodan"))
|
19
|
+
optional(:options).hash(Options)
|
20
|
+
end
|
21
|
+
|
22
|
+
GooglePublicDNS = Dry::Schema.Params do
|
23
|
+
required(:enricher).value(Types::String.enum("google_public_dns"))
|
24
|
+
optional(:options).hash(Options)
|
25
|
+
end
|
7
26
|
end
|
8
27
|
end
|
9
28
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dry/schema"
|
4
|
+
|
5
|
+
module Mihari
|
6
|
+
module Schemas
|
7
|
+
Options = Dry::Schema.Params do
|
8
|
+
optional(:retry_times).value(:integer).default(Mihari.config.retry_times)
|
9
|
+
optional(:retry_interval).value(:integer).default(Mihari.config.retry_interval)
|
10
|
+
optional(:retry_exponential_backoff).value(:bool).default(Mihari.config.retry_exponential_backoff)
|
11
|
+
optional(:timeout).value(:integer)
|
12
|
+
end
|
13
|
+
|
14
|
+
IgnoreErrorOptions = Dry::Schema.Params do
|
15
|
+
optional(:ignore_error).value(:bool).default(Mihari.config.ignore_error)
|
16
|
+
end
|
17
|
+
|
18
|
+
AnalyzerOptions = Options | IgnoreErrorOptions
|
19
|
+
|
20
|
+
PaginationOptions = Dry::Schema.Params do
|
21
|
+
optional(:pagination_interval).value(:integer).default(Mihari.config.pagination_interval)
|
22
|
+
optional(:pagination_limit).value(:integer).default(Mihari.config.pagination_limit)
|
23
|
+
end
|
24
|
+
|
25
|
+
AnalyzerPaginationOptions = AnalyzerOptions | PaginationOptions
|
26
|
+
end
|
27
|
+
end
|
data/lib/mihari/schemas/rule.rb
CHANGED
@@ -22,14 +22,18 @@ module Mihari
|
|
22
22
|
optional(:updated_on).value(:date)
|
23
23
|
|
24
24
|
required(:queries).value(:array).each do
|
25
|
-
|
25
|
+
AnalyzerAPIKey | AnalyzerAPIKeyPagination | Censys | CIRCL | PassiveTotal | ZoomEye | Crtsh | Feed | HunterHow | DNSTwister
|
26
26
|
end
|
27
27
|
|
28
|
-
optional(:emitters).value(:array).each
|
28
|
+
optional(:emitters).value(:array).each do
|
29
|
+
Emitters::Database | Emitters::MISP | Emitters::TheHive | Emitters::Slack | Emitters::Webhook
|
30
|
+
end.default(DEFAULT_EMITTERS)
|
29
31
|
|
30
|
-
optional(:enrichers).value(:array).each
|
32
|
+
optional(:enrichers).value(:array).each do
|
33
|
+
Enrichers::Whois | Enrichers::IPInfo | Enrichers::Shodan | Enrichers::GooglePublicDNS
|
34
|
+
end.default(DEFAULT_ENRICHERS)
|
31
35
|
|
32
|
-
optional(:data_types).value(array[Types::DataTypes]).default(
|
36
|
+
optional(:data_types).value(array[Types::DataTypes]).default(Mihari::Types::DataTypes.values)
|
33
37
|
optional(:falsepositives).value(array[:string]).default([])
|
34
38
|
|
35
39
|
optional(:artifact_lifetime).value(:integer)
|
@@ -5,21 +5,11 @@ module Mihari
|
|
5
5
|
class RuleRunner
|
6
6
|
include Dry::Monads[:result, :try]
|
7
7
|
|
8
|
-
include Mixins::ErrorNotification
|
9
|
-
|
10
8
|
# @return [Mihari::Services::RuleProxy]
|
11
9
|
attr_reader :rule
|
12
10
|
|
13
|
-
|
14
|
-
attr_reader :force_overwrite
|
15
|
-
|
16
|
-
def initialize(rule, force_overwrite:)
|
11
|
+
def initialize(rule)
|
17
12
|
@rule = rule
|
18
|
-
@force_overwrite = force_overwrite
|
19
|
-
end
|
20
|
-
|
21
|
-
def force_overwrite?
|
22
|
-
force_overwrite
|
23
13
|
end
|
24
14
|
|
25
15
|
#
|
data/lib/mihari/types.rb
CHANGED
@@ -12,21 +12,8 @@ module Mihari
|
|
12
12
|
Double = Strict::Float | Strict::Integer
|
13
13
|
DateTime = Strict::DateTime
|
14
14
|
|
15
|
-
DataTypes = Types::String.enum(
|
15
|
+
DataTypes = Types::String.enum("hash", "ip", "domain", "url", "mail")
|
16
16
|
|
17
17
|
HTTPRequestMethods = Types::String.enum("GET", "POST")
|
18
|
-
HTTPRequestPayloadTypes = Types::String.enum("application/json", "application/x-www-form-urlencoded")
|
19
|
-
|
20
|
-
EmitterTypes = Types::String.enum(
|
21
|
-
"database",
|
22
|
-
"webhook"
|
23
|
-
)
|
24
|
-
|
25
|
-
EnricherTypes = Types::String.enum(
|
26
|
-
"whois",
|
27
|
-
"ipinfo",
|
28
|
-
"shodan",
|
29
|
-
"google_public_dns"
|
30
|
-
)
|
31
18
|
end
|
32
19
|
end
|
data/lib/mihari/version.rb
CHANGED
@@ -15,7 +15,7 @@ module Mihari
|
|
15
15
|
get "/:ip", requirements: { ip: %r{[^/]+} } do
|
16
16
|
ip = params[:ip].to_s
|
17
17
|
|
18
|
-
data = Enrichers::IPInfo.query(ip)
|
18
|
+
data = Enrichers::IPInfo.new.query(ip)
|
19
19
|
error!({ message: "IP:#{ip} is not found" }, 404) if data.nil?
|
20
20
|
|
21
21
|
present data, with: Entities::IPAddress
|