mihari 3.10.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docker/Dockerfile +1 -1
- data/lib/mihari/analyzers/base.rb +7 -7
- data/lib/mihari/analyzers/binaryedge.rb +8 -5
- data/lib/mihari/analyzers/censys.rb +6 -3
- data/lib/mihari/analyzers/circl.rb +0 -3
- data/lib/mihari/analyzers/crtsh.rb +7 -5
- data/lib/mihari/analyzers/dnpedia.rb +4 -4
- data/lib/mihari/analyzers/dnstwister.rb +1 -4
- data/lib/mihari/analyzers/feed.rb +36 -0
- data/lib/mihari/analyzers/greynoise.rb +1 -3
- data/lib/mihari/analyzers/onyphe.rb +6 -3
- data/lib/mihari/analyzers/otx.rb +0 -3
- data/lib/mihari/analyzers/passivetotal.rb +8 -9
- data/lib/mihari/analyzers/pulsedive.rb +7 -5
- data/lib/mihari/analyzers/rule.rb +11 -5
- data/lib/mihari/analyzers/securitytrails.rb +10 -7
- data/lib/mihari/analyzers/shodan.rb +15 -8
- data/lib/mihari/analyzers/spyse.rb +10 -11
- data/lib/mihari/analyzers/urlscan.rb +39 -16
- data/lib/mihari/analyzers/virustotal.rb +8 -9
- data/lib/mihari/analyzers/virustotal_intelligence.rb +9 -5
- data/lib/mihari/analyzers/zoomeye.rb +12 -5
- data/lib/mihari/cli/base.rb +0 -5
- data/lib/mihari/cli/init.rb +0 -2
- data/lib/mihari/cli/main.rb +4 -6
- data/lib/mihari/cli/mixins/utils.rb +2 -18
- data/lib/mihari/commands/init.rb +0 -18
- data/lib/mihari/commands/search.rb +20 -15
- data/lib/mihari/commands/validator.rb +7 -19
- data/lib/mihari/commands/web.rb +0 -3
- data/lib/mihari/database.rb +71 -19
- data/lib/mihari/emitters/misp.rb +0 -1
- data/lib/mihari/emitters/slack.rb +3 -4
- data/lib/mihari/emitters/stdout.rb +0 -2
- data/lib/mihari/emitters/the_hive.rb +0 -1
- data/lib/mihari/emitters/webhook.rb +1 -5
- data/lib/mihari/enrichers/ipinfo.rb +2 -2
- data/lib/mihari/errors.rb +6 -0
- data/lib/mihari/feed/parser.rb +34 -0
- data/lib/mihari/feed/reader.rb +127 -0
- data/lib/mihari/mixins/autonomous_system.rb +2 -0
- data/lib/mihari/mixins/database.rb +14 -0
- data/lib/mihari/mixins/disallowed_data_value.rb +2 -3
- data/lib/mihari/mixins/rule.rb +36 -31
- data/lib/mihari/models/alert.rb +7 -8
- data/lib/mihari/models/artifact.rb +1 -7
- data/lib/mihari/models/autonomous_system.rb +0 -2
- data/lib/mihari/models/dns.rb +2 -5
- data/lib/mihari/models/geolocation.rb +0 -1
- data/lib/mihari/models/reverse_dns.rb +0 -3
- data/lib/mihari/models/rule.rb +73 -0
- data/lib/mihari/models/tag.rb +0 -2
- data/lib/mihari/models/tagging.rb +0 -2
- data/lib/mihari/models/whois.rb +0 -2
- data/lib/mihari/notifiers/exception_notifier.rb +0 -2
- data/lib/mihari/schemas/analyzer.rb +0 -5
- data/lib/mihari/schemas/macros.rb +0 -2
- data/lib/mihari/schemas/rule.rb +21 -7
- data/lib/mihari/status.rb +2 -2
- data/lib/mihari/structs/alert.rb +2 -3
- data/lib/mihari/structs/censys.rb +4 -3
- data/lib/mihari/structs/greynoise.rb +4 -3
- data/lib/mihari/structs/ipinfo.rb +1 -2
- data/lib/mihari/structs/onyphe.rb +6 -5
- data/lib/mihari/structs/rule.rb +121 -0
- data/lib/mihari/structs/shodan.rb +8 -7
- data/lib/mihari/structs/urlscan.rb +50 -0
- data/lib/mihari/structs/virustotal_intelligence.rb +4 -3
- data/lib/mihari/type_checker.rb +2 -6
- data/lib/mihari/types.rb +8 -1
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/api.rb +6 -0
- data/lib/mihari/web/app.rb +5 -7
- data/lib/mihari/web/endpoints/alerts.rb +7 -3
- data/lib/mihari/web/endpoints/artifacts.rb +6 -3
- data/lib/mihari/web/endpoints/command.rb +2 -1
- data/lib/mihari/web/endpoints/configs.rb +2 -1
- data/lib/mihari/web/endpoints/ip_addresses.rb +2 -1
- data/lib/mihari/web/endpoints/rules.rb +140 -0
- data/lib/mihari/web/endpoints/sources.rb +2 -1
- data/lib/mihari/web/endpoints/tags.rb +4 -2
- data/lib/mihari/web/entities/artifact.rb +4 -2
- data/lib/mihari/web/entities/rule.rb +35 -0
- data/lib/mihari/web/entities/whois.rb +1 -1
- data/lib/mihari/web/middleware/connection_adapter.rb +19 -0
- data/lib/mihari/web/public/index.html +1 -1
- data/lib/mihari/web/public/redoc-static.html +196 -184
- data/lib/mihari/web/public/static/js/app.49ab738a.js +21 -0
- data/lib/mihari/web/public/static/js/app.49ab738a.js.map +1 -0
- data/lib/mihari/web/public/static/js/app.5dc97aae.js +21 -0
- data/lib/mihari/web/public/static/js/app.5dc97aae.js.map +1 -0
- data/lib/mihari/web/public/static/js/app.f2b8890f.js +21 -0
- data/lib/mihari/web/public/static/js/app.f2b8890f.js.map +1 -0
- data/lib/mihari/web/public/static/js/app.fbc19869.js +21 -0
- data/lib/mihari/web/public/static/js/app.fbc19869.js.map +1 -0
- data/lib/mihari.rb +42 -34
- data/mihari.gemspec +21 -23
- data/sig/lib/mihari/analyzers/binaryedge.rbs +2 -3
- data/sig/lib/mihari/analyzers/censys.rbs +2 -3
- data/sig/lib/mihari/analyzers/circl.rbs +1 -3
- data/sig/lib/mihari/analyzers/crtsh.rbs +1 -3
- data/sig/lib/mihari/analyzers/dnpedia.rbs +1 -4
- data/sig/lib/mihari/analyzers/dnstwister.rbs +1 -3
- data/sig/lib/mihari/analyzers/feed.rbs +20 -0
- data/sig/lib/mihari/analyzers/onyphe.rbs +2 -3
- data/sig/lib/mihari/analyzers/otx.rbs +1 -3
- data/sig/lib/mihari/analyzers/passivetotal.rbs +3 -5
- data/sig/lib/mihari/analyzers/pulsedive.rbs +2 -4
- data/sig/lib/mihari/analyzers/securitytrails.rbs +3 -5
- data/sig/lib/mihari/analyzers/shodan.rbs +2 -3
- data/sig/lib/mihari/analyzers/spyse.rbs +4 -6
- data/sig/lib/mihari/analyzers/urlscan.rbs +6 -5
- data/sig/lib/mihari/analyzers/virustotal.rbs +4 -6
- data/sig/lib/mihari/analyzers/virustotal_intelligence.rbs +2 -3
- data/sig/lib/mihari/analyzers/zoomeye.rbs +4 -4
- data/sig/lib/mihari/commands/init.rbs +0 -2
- data/sig/lib/mihari/commands/validator.rbs +0 -2
- data/sig/lib/mihari/emitters/slack.rbs +0 -1
- data/sig/lib/mihari/feed/parser.rbs +11 -0
- data/sig/lib/mihari/feed/reader.rbs +56 -0
- data/sig/lib/mihari/mixins/disallowed_data_value.rbs +0 -2
- data/sig/lib/mihari/mixins/rule.rbs +5 -12
- data/sig/lib/mihari/models/alert.rbs +1 -1
- data/sig/lib/mihari/models/artifact.rbs +2 -0
- data/sig/lib/mihari/models/rule.rbs +14 -0
- data/sig/lib/mihari/structs/alert.rbs +1 -1
- data/sig/lib/mihari/structs/greynoise.rbs +3 -3
- data/sig/lib/mihari/structs/rule.rbs +56 -0
- data/sig/lib/mihari/structs/shodan.rbs +2 -2
- data/sig/lib/mihari/structs/urlscan.rbs +28 -0
- data/sig/lib/mihari/types.rbs +4 -0
- data/sig/lib/mihari.rbs +0 -2
- metadata +102 -147
- data/lib/mihari/cli/analyzer.rb +0 -52
- data/lib/mihari/commands/binaryedge.rb +0 -21
- data/lib/mihari/commands/censys.rb +0 -22
- data/lib/mihari/commands/circl.rb +0 -21
- data/lib/mihari/commands/crtsh.rb +0 -22
- data/lib/mihari/commands/dnpedia.rb +0 -21
- data/lib/mihari/commands/dnstwister.rb +0 -21
- data/lib/mihari/commands/greynoise.rb +0 -21
- data/lib/mihari/commands/json.rb +0 -42
- data/lib/mihari/commands/onyphe.rb +0 -21
- data/lib/mihari/commands/otx.rb +0 -21
- data/lib/mihari/commands/passivetotal.rb +0 -22
- data/lib/mihari/commands/pulsedive.rb +0 -21
- data/lib/mihari/commands/securitytrails.rb +0 -22
- data/lib/mihari/commands/shodan.rb +0 -21
- data/lib/mihari/commands/spyse.rb +0 -22
- data/lib/mihari/commands/urlscan.rb +0 -23
- data/lib/mihari/commands/virustotal.rb +0 -22
- data/lib/mihari/commands/virustotal_intelligence.rb +0 -22
- data/lib/mihari/commands/zoomeye.rb +0 -22
- data/lib/mihari/mixins/configuration.rb +0 -100
- data/lib/mihari/mixins/hash.rb +0 -20
- data/lib/mihari/schemas/configuration.rb +0 -44
- data/lib/mihari/web/public/grape.rb +0 -73
- data/sig/lib/mihari/cli/analyzer.rbs +0 -39
- data/sig/lib/mihari/commands/binaryedge.rbs +0 -7
- data/sig/lib/mihari/commands/censys.rbs +0 -7
- data/sig/lib/mihari/commands/circl.rbs +0 -7
- data/sig/lib/mihari/commands/crtsh.rbs +0 -7
- data/sig/lib/mihari/commands/dnpedia.rbs +0 -7
- data/sig/lib/mihari/commands/dnstwister.rbs +0 -7
- data/sig/lib/mihari/commands/onyphe.rbs +0 -7
- data/sig/lib/mihari/commands/otx.rbs +0 -7
- data/sig/lib/mihari/commands/passivetotal.rbs +0 -7
- data/sig/lib/mihari/commands/pulsedive.rbs +0 -7
- data/sig/lib/mihari/commands/securitytrails.rbs +0 -7
- data/sig/lib/mihari/commands/shodan.rbs +0 -7
- data/sig/lib/mihari/commands/spyse.rbs +0 -7
- data/sig/lib/mihari/commands/urlscan.rbs +0 -7
- data/sig/lib/mihari/commands/virustotal.rbs +0 -7
- data/sig/lib/mihari/commands/zoomeye.rbs +0 -7
@@ -4,20 +4,11 @@ module Mihari
|
|
4
4
|
#
|
5
5
|
# Load rule into hash
|
6
6
|
#
|
7
|
-
# @param [String]
|
7
|
+
# @param [String] path_or_id
|
8
8
|
#
|
9
|
-
# @return [
|
9
|
+
# @return [Mihari::Structs::Rule::Rule]
|
10
10
|
#
|
11
|
-
def load_rule: (String
|
12
|
-
|
13
|
-
#
|
14
|
-
# Validate rule schema and return a normalized rule
|
15
|
-
#
|
16
|
-
# @param [Hash] rule
|
17
|
-
#
|
18
|
-
# @return [Hash]
|
19
|
-
#
|
20
|
-
def validate_rule: (Hash rule) -> Hash
|
11
|
+
def load_rule: (String path_or_id) -> Mihari::Structs::Rule::Rule
|
21
12
|
|
22
13
|
#
|
23
14
|
# Returns a template for rule
|
@@ -26,6 +17,8 @@ module Mihari
|
|
26
17
|
#
|
27
18
|
def rule_template: () -> String
|
28
19
|
|
20
|
+
def validate_rule!: (Mihari::Structs::Rule::Rule rule) -> nil
|
21
|
+
|
29
22
|
#
|
30
23
|
# Create (blank) rule file
|
31
24
|
#
|
@@ -7,7 +7,7 @@ module Mihari
|
|
7
7
|
attr_accessor artifacts(): Array[Mihari::Artifact]
|
8
8
|
attr_accessor Tags(): Array[Mihari::Tag]
|
9
9
|
|
10
|
-
def self.search: (Mihari::Structs::Alert::SearchFilterWithPagination filter) -> Array[
|
10
|
+
def self.search: (Mihari::Structs::Alert::SearchFilterWithPagination filter) -> Array[Mihari::Alert]
|
11
11
|
|
12
12
|
def self.count: (Mihari::Structs::Alert::SearchFilter filter) -> Integer
|
13
13
|
|
@@ -7,6 +7,8 @@ module Mihari
|
|
7
7
|
attr_accessor data (): String
|
8
8
|
attr_accessor data_type (): String
|
9
9
|
|
10
|
+
attr_accessor metadata(): Hash?
|
11
|
+
|
10
12
|
attr_accessor autonomous_system(): Mihari::AutonomousSystem
|
11
13
|
attr_accessor geolocation (): Mihari::Geolocation
|
12
14
|
attr_accessor whois_record(): Mihari::WhoisRecord
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Mihari
|
2
|
+
class Rule < ActiveRecord::Base
|
3
|
+
attr_accessor id(): String
|
4
|
+
attr_accessor title(): String
|
5
|
+
attr_accessor description(): String
|
6
|
+
attr_accessor data(): Hash
|
7
|
+
|
8
|
+
def to_h: () -> Hash
|
9
|
+
|
10
|
+
def self.search: (Mihari::Structs::Rule::SearchFilterWithPagination filter) -> Array[Mihari::Rule]
|
11
|
+
|
12
|
+
def self.count: (Mihari::Structs::Rule::SearchFilter filter) -> Integer
|
13
|
+
end
|
14
|
+
end
|
@@ -6,14 +6,14 @@ module Mihari
|
|
6
6
|
attr_reader country_code: String
|
7
7
|
attr_reader asn: String
|
8
8
|
|
9
|
-
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) ->
|
9
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Metadata
|
10
10
|
end
|
11
11
|
|
12
12
|
class Datum < Dry::Struct
|
13
13
|
attr_reader ip: String
|
14
14
|
attr_reader metadata: Mihari::Structs::GreyNoise::Metadata
|
15
15
|
|
16
|
-
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) ->
|
16
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Datum
|
17
17
|
end
|
18
18
|
|
19
19
|
class Response < Dry::Struct
|
@@ -23,7 +23,7 @@ module Mihari
|
|
23
23
|
attr_reader message: String
|
24
24
|
attr_reader query: String
|
25
25
|
|
26
|
-
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) ->
|
26
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::GreyNoise::Response
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Mihari
|
2
|
+
module Structs
|
3
|
+
module Rule
|
4
|
+
class SearchFilter < Dry::Struct
|
5
|
+
end
|
6
|
+
|
7
|
+
class SearchFilterWithPagination < SearchFilter
|
8
|
+
def without_pagination: () -> SearchFilter
|
9
|
+
end
|
10
|
+
|
11
|
+
class Rule
|
12
|
+
attr_reader data: Hash
|
13
|
+
|
14
|
+
attr_reader errors: Array[untypes]
|
15
|
+
|
16
|
+
def initialize: (Hash data) -> void
|
17
|
+
|
18
|
+
#
|
19
|
+
# @return [Boolean]
|
20
|
+
#
|
21
|
+
def errors?: () -> (bool)
|
22
|
+
|
23
|
+
#
|
24
|
+
# @return [Array[String]]
|
25
|
+
#
|
26
|
+
def error_messages: () -> (Array[String])
|
27
|
+
|
28
|
+
def validate: () -> void
|
29
|
+
|
30
|
+
def validate!: () -> void
|
31
|
+
|
32
|
+
def []: (untyped key) -> untyped
|
33
|
+
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
def id: () -> String
|
38
|
+
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
#
|
42
|
+
def title: () -> String
|
43
|
+
|
44
|
+
#
|
45
|
+
# @return [String]
|
46
|
+
#
|
47
|
+
def description: () -> String
|
48
|
+
|
49
|
+
#
|
50
|
+
# @return [Mihari::Rule]
|
51
|
+
#
|
52
|
+
def to_model: () -> Mihari::Rule
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -2,8 +2,8 @@ module Mihari
|
|
2
2
|
module Structs
|
3
3
|
module Shodan
|
4
4
|
class Location
|
5
|
-
attr_reader country_code: String
|
6
|
-
attr_reader country_name: String
|
5
|
+
attr_reader country_code: String?
|
6
|
+
attr_reader country_name: String?
|
7
7
|
|
8
8
|
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Shodan::Location
|
9
9
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Mihari
|
2
|
+
module Structs
|
3
|
+
module Urlscan
|
4
|
+
class Page < Dry::Struct
|
5
|
+
attr_reader domain: String?
|
6
|
+
attr_reader ip: String?
|
7
|
+
attr_reader url: String
|
8
|
+
|
9
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Page
|
10
|
+
end
|
11
|
+
|
12
|
+
class Result < Dry::Struct
|
13
|
+
attr_reader page: Mihari::Structs::Urlscan::Page
|
14
|
+
attr_reader id: String
|
15
|
+
attr_reader sort: Array[Integer | String]
|
16
|
+
|
17
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Result
|
18
|
+
end
|
19
|
+
|
20
|
+
class Response < Dry::Struct
|
21
|
+
attr_reader results: Array[Mihari::Structs::Urlscan::Result]
|
22
|
+
attr_reader has_more: Boolean
|
23
|
+
|
24
|
+
def self.from_dynamic!: (Hash[(String | Symbol), untyped] d) -> Mihari::Structs::Urlscan::Response
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/sig/lib/mihari/types.rbs
CHANGED