mihari 5.4.2 → 5.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mihari/analyzers/base.rb +0 -4
- data/lib/mihari/analyzers/binaryedge.rb +4 -44
- data/lib/mihari/analyzers/censys.rb +4 -20
- data/lib/mihari/analyzers/circl.rb +2 -26
- data/lib/mihari/analyzers/crtsh.rb +2 -17
- data/lib/mihari/analyzers/dnstwister.rb +1 -3
- data/lib/mihari/analyzers/greynoise.rb +5 -4
- data/lib/mihari/analyzers/hunterhow.rb +8 -23
- data/lib/mihari/analyzers/onyphe.rb +5 -39
- data/lib/mihari/analyzers/otx.rb +2 -38
- data/lib/mihari/analyzers/passivetotal.rb +3 -41
- data/lib/mihari/analyzers/securitytrails.rb +3 -41
- data/lib/mihari/analyzers/shodan.rb +7 -39
- data/lib/mihari/analyzers/urlscan.rb +2 -38
- data/lib/mihari/analyzers/virustotal_intelligence.rb +2 -25
- data/lib/mihari/analyzers/zoomeye.rb +17 -83
- data/lib/mihari/clients/base.rb +9 -1
- data/lib/mihari/clients/binaryedge.rb +27 -2
- data/lib/mihari/clients/censys.rb +32 -2
- data/lib/mihari/clients/circl.rb +28 -1
- data/lib/mihari/clients/crtsh.rb +9 -2
- data/lib/mihari/clients/dnstwister.rb +4 -2
- data/lib/mihari/clients/greynoise.rb +31 -4
- data/lib/mihari/clients/hunterhow.rb +41 -3
- data/lib/mihari/clients/onyphe.rb +25 -3
- data/lib/mihari/clients/otx.rb +40 -0
- data/lib/mihari/clients/passivetotal.rb +33 -15
- data/lib/mihari/clients/securitytrails.rb +44 -0
- data/lib/mihari/clients/shodan.rb +30 -2
- data/lib/mihari/clients/urlscan.rb +32 -6
- data/lib/mihari/clients/virustotal.rb +29 -4
- data/lib/mihari/clients/zoomeye.rb +53 -2
- data/lib/mihari/commands/web.rb +1 -1
- data/lib/mihari/config.rb +1 -1
- data/lib/mihari/structs/censys.rb +11 -11
- data/lib/mihari/structs/greynoise.rb +17 -8
- data/lib/mihari/structs/onyphe.rb +7 -7
- data/lib/mihari/structs/shodan.rb +5 -5
- data/lib/mihari/structs/urlscan.rb +3 -3
- data/lib/mihari/structs/virustotal_intelligence.rb +3 -3
- data/lib/mihari/version.rb +1 -1
- data/mihari.gemspec +7 -7
- metadata +16 -16
@@ -15,6 +15,50 @@ module Mihari
|
|
15
15
|
super(base_url, headers: headers)
|
16
16
|
end
|
17
17
|
|
18
|
+
#
|
19
|
+
# Domain search
|
20
|
+
#
|
21
|
+
# @param [String] query
|
22
|
+
#
|
23
|
+
# @return [Array<String>]
|
24
|
+
#
|
25
|
+
def domain_search(query)
|
26
|
+
records = get_all_dns_history(query, type: "a")
|
27
|
+
records.map do |record|
|
28
|
+
(record["values"] || []).map { |value| value["ip"] }
|
29
|
+
end.flatten.compact.uniq
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# IP search
|
34
|
+
#
|
35
|
+
# @param [String] query
|
36
|
+
#
|
37
|
+
# @return [Array<Mihari::Artifact>]
|
38
|
+
#
|
39
|
+
def ip_search(query)
|
40
|
+
records = search_by_ip(query)
|
41
|
+
records.filter_map do |record|
|
42
|
+
data = record["hostname"]
|
43
|
+
Artifact.new(data: data, metadata: record)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Mail search
|
49
|
+
#
|
50
|
+
# @param [String] query
|
51
|
+
#
|
52
|
+
# @return [Array<String>]
|
53
|
+
#
|
54
|
+
def mail_search(query)
|
55
|
+
records = search_by_mail(query)
|
56
|
+
records.filter_map do |record|
|
57
|
+
data = record["hostname"]
|
58
|
+
Artifact.new(data: data, metadata: record)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
18
62
|
#
|
19
63
|
# @param [String] mail
|
20
64
|
#
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Mihari
|
4
4
|
module Clients
|
5
5
|
class Shodan < Base
|
6
|
+
PAGE_SIZE = 100
|
7
|
+
|
6
8
|
# @return [String]
|
7
9
|
attr_reader :api_key
|
8
10
|
|
@@ -10,11 +12,12 @@ module Mihari
|
|
10
12
|
# @param [String] base_url
|
11
13
|
# @param [String, nil] api_key
|
12
14
|
# @param [Hash] headers
|
15
|
+
# @param [Integer, nil] interval
|
13
16
|
#
|
14
|
-
def initialize(base_url = "https://api.shodan.io", api_key:, headers: {})
|
17
|
+
def initialize(base_url = "https://api.shodan.io", api_key:, headers: {}, interval: nil)
|
15
18
|
raise(ArgumentError, "'api_key' argument is required") unless api_key
|
16
19
|
|
17
|
-
super(base_url, headers: headers)
|
20
|
+
super(base_url, headers: headers, interval: interval)
|
18
21
|
|
19
22
|
@api_key = api_key
|
20
23
|
end
|
@@ -36,6 +39,31 @@ module Mihari
|
|
36
39
|
res = get("/shodan/host/search", params: params)
|
37
40
|
Structs::Shodan::Result.from_dynamic! JSON.parse(res.body.to_s)
|
38
41
|
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# @param [String] query
|
45
|
+
# @param [Boolean] minify
|
46
|
+
# @param [Integer] pagination_limit
|
47
|
+
#
|
48
|
+
# @return [Enumerable<Structs::Shodan::Result>]
|
49
|
+
#
|
50
|
+
def search_with_pagination(query, minify: true, pagination_limit: Mihari.config.pagination_limit)
|
51
|
+
Enumerator.new do |y|
|
52
|
+
(1..pagination_limit).each do |page|
|
53
|
+
res = search(query, page: page, minify: minify)
|
54
|
+
|
55
|
+
y.yield res
|
56
|
+
|
57
|
+
break if res.total <= page * PAGE_SIZE
|
58
|
+
|
59
|
+
sleep_interval
|
60
|
+
rescue JSON::ParserError
|
61
|
+
# ignore JSON::ParserError
|
62
|
+
# ref. https://github.com/ninoseki/mihari/issues/197
|
63
|
+
next
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
39
67
|
end
|
40
68
|
end
|
41
69
|
end
|
@@ -7,26 +7,52 @@ module Mihari
|
|
7
7
|
# @param [String] base_url
|
8
8
|
# @param [String, nil] api_key
|
9
9
|
# @param [Hash] headers
|
10
|
+
# @param [Interval, nil] interval
|
10
11
|
#
|
11
|
-
def initialize(base_url = "https://urlscan.io", api_key:, headers: {})
|
12
|
+
def initialize(base_url = "https://urlscan.io", api_key:, headers: {}, interval: nil)
|
12
13
|
raise(ArgumentError, "'api_key' argument is required") if api_key.nil?
|
13
14
|
|
14
15
|
headers["api-key"] = api_key
|
15
16
|
|
16
|
-
super(base_url, headers: headers)
|
17
|
+
super(base_url, headers: headers, interval: interval)
|
17
18
|
end
|
18
19
|
|
19
20
|
#
|
20
21
|
# @param [String] q
|
21
|
-
# @param [Integer] size
|
22
|
+
# @param [Integer, nil] size
|
22
23
|
# @param [String, nil] search_after
|
23
24
|
#
|
24
|
-
# @return [
|
25
|
+
# @return [Structs::Urlscan::Response]
|
25
26
|
#
|
26
|
-
def search(q, size:
|
27
|
+
def search(q, size: nil, search_after: nil)
|
27
28
|
params = { q: q, size: size, search_after: search_after }.compact
|
28
29
|
res = get("/api/v1/search/", params: params)
|
29
|
-
JSON.parse
|
30
|
+
Structs::Urlscan::Response.from_dynamic! JSON.parse(res.body.to_s)
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# @param [String] q
|
35
|
+
# @param [Integer, nil] size
|
36
|
+
# @param [Integer] pagination_limit
|
37
|
+
#
|
38
|
+
# @return [Enumerable<Structs::Urlscan::Response>]
|
39
|
+
#
|
40
|
+
def search_with_pagination(q, size: nil, pagination_limit: Mihari.config.pagination_limit)
|
41
|
+
search_after = nil
|
42
|
+
|
43
|
+
Enumerator.new do |y|
|
44
|
+
pagination_limit.times do
|
45
|
+
res = search(q, size: size, search_after: search_after)
|
46
|
+
|
47
|
+
y.yield res
|
48
|
+
|
49
|
+
break unless res.has_more
|
50
|
+
|
51
|
+
search_after = res.results.last.sort.join(",")
|
52
|
+
|
53
|
+
sleep_interval
|
54
|
+
end
|
55
|
+
end
|
30
56
|
end
|
31
57
|
end
|
32
58
|
end
|
@@ -7,13 +7,14 @@ module Mihari
|
|
7
7
|
# @param [String] base_url
|
8
8
|
# @param [String, nil] api_key
|
9
9
|
# @param [Hash] headers
|
10
|
+
# @param [Integer, nil] interval
|
10
11
|
#
|
11
|
-
def initialize(base_url = "https://www.virustotal.com", api_key:, headers: {})
|
12
|
+
def initialize(base_url = "https://www.virustotal.com", api_key:, headers: {}, interval: nil)
|
12
13
|
raise(ArgumentError, "'api_key' argument is required") if api_key.nil?
|
13
14
|
|
14
15
|
headers["x-apikey"] = api_key
|
15
16
|
|
16
|
-
super(base_url, headers: headers)
|
17
|
+
super(base_url, headers: headers, interval: interval)
|
17
18
|
end
|
18
19
|
|
19
20
|
#
|
@@ -38,11 +39,35 @@ module Mihari
|
|
38
39
|
# @param [String] query
|
39
40
|
# @param [String, nil] cursor
|
40
41
|
#
|
41
|
-
# @return [
|
42
|
+
# @return [Structs::VirusTotalIntelligence::Response]
|
42
43
|
#
|
43
44
|
def intel_search(query, cursor: nil)
|
44
45
|
params = { query: query, cursor: cursor }.compact
|
45
|
-
_get("/api/v3/intelligence/search", params: params)
|
46
|
+
res = _get("/api/v3/intelligence/search", params: params)
|
47
|
+
Structs::VirusTotalIntelligence::Response.from_dynamic! res
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# @param [String] query
|
52
|
+
# @param [Integer] pagination_limit
|
53
|
+
#
|
54
|
+
# @return [Enumerable<Structs::VirusTotalIntelligence::Response>]
|
55
|
+
#
|
56
|
+
def intel_search_with_pagination(query, pagination_limit: Mihari.config.pagination_limit)
|
57
|
+
cursor = nil
|
58
|
+
|
59
|
+
Enumerator.new do |y|
|
60
|
+
pagination_limit.times do
|
61
|
+
res = intel_search(query, cursor: cursor)
|
62
|
+
|
63
|
+
y.yield res
|
64
|
+
|
65
|
+
cursor = res.meta.cursor
|
66
|
+
break if cursor.nil?
|
67
|
+
|
68
|
+
sleep_interval
|
69
|
+
end
|
70
|
+
end
|
46
71
|
end
|
47
72
|
|
48
73
|
private
|
@@ -3,18 +3,21 @@
|
|
3
3
|
module Mihari
|
4
4
|
module Clients
|
5
5
|
class ZoomEye < Base
|
6
|
+
PAGE_SIZE = 10
|
7
|
+
|
6
8
|
attr_reader :api_key
|
7
9
|
|
8
10
|
#
|
9
11
|
# @param [String] base_url
|
10
12
|
# @param [String, nil] api_key
|
11
13
|
# @param [Hash] headers
|
14
|
+
# @param [Integer, nil] interval
|
12
15
|
#
|
13
|
-
def initialize(base_url = "https://api.zoomeye.org", api_key:, headers: {})
|
16
|
+
def initialize(base_url = "https://api.zoomeye.org", api_key:, headers: {}, interval: nil)
|
14
17
|
raise(ArgumentError, "'api_key' argument is required") unless api_key
|
15
18
|
|
16
19
|
headers["api-key"] = api_key
|
17
|
-
super(base_url, headers: headers)
|
20
|
+
super(base_url, headers: headers, interval: interval)
|
18
21
|
end
|
19
22
|
|
20
23
|
#
|
@@ -36,6 +39,30 @@ module Mihari
|
|
36
39
|
_get("/host/search", params: params)
|
37
40
|
end
|
38
41
|
|
42
|
+
#
|
43
|
+
# @param [String] query
|
44
|
+
# @param [String, nil] facets
|
45
|
+
# @param [Integer] pagination_limit
|
46
|
+
#
|
47
|
+
# @return [Enumerable<Hash>]
|
48
|
+
#
|
49
|
+
def host_search_with_pagination(query, facets: nil, pagination_limit: Mihari.config.pagination_limit)
|
50
|
+
Enumerator.new do |y|
|
51
|
+
(1..pagination_limit).each do |page|
|
52
|
+
res = host_search(query, facets: facets, page: page)
|
53
|
+
|
54
|
+
break if res.nil?
|
55
|
+
|
56
|
+
y.yield res
|
57
|
+
|
58
|
+
total = res["total"].to_i
|
59
|
+
break if total <= page * PAGE_SIZE
|
60
|
+
|
61
|
+
sleep_interval
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
39
66
|
#
|
40
67
|
# Search the Web technologies
|
41
68
|
#
|
@@ -55,6 +82,30 @@ module Mihari
|
|
55
82
|
_get("/web/search", params: params)
|
56
83
|
end
|
57
84
|
|
85
|
+
#
|
86
|
+
# @param [String] query
|
87
|
+
# @param [String, nil] facets
|
88
|
+
# @param [Integer] pagination_limit
|
89
|
+
#
|
90
|
+
# @return [Enumerable<Hash>]
|
91
|
+
#
|
92
|
+
def web_search_with_pagination(query, facets: nil, pagination_limit: Mihari.config.pagination_limit)
|
93
|
+
Enumerator.new do |y|
|
94
|
+
(1..pagination_limit).each do |page|
|
95
|
+
res = web_search(query, facets: facets, page: page)
|
96
|
+
|
97
|
+
break if res.nil?
|
98
|
+
|
99
|
+
y.yield res
|
100
|
+
|
101
|
+
total = res["total"].to_i
|
102
|
+
break if total <= page * PAGE_SIZE
|
103
|
+
|
104
|
+
sleep_interval
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
58
109
|
private
|
59
110
|
|
60
111
|
#
|
data/lib/mihari/commands/web.rb
CHANGED
@@ -12,7 +12,7 @@ module Mihari
|
|
12
12
|
method_option :threads, type: :string, default: "0:5", desc: "min:max threads to use"
|
13
13
|
method_option :verbose, type: :boolean, default: true, desc: "Report each request"
|
14
14
|
method_option :worker_timeout, type: :numeric, default: 60, desc: "Worker timeout value (in seconds)"
|
15
|
-
method_option :hide_config_values, type: :boolean, default:
|
15
|
+
method_option :hide_config_values, type: :boolean, default: true,
|
16
16
|
desc: "Whether to hide config values or not"
|
17
17
|
method_option :open, type: :boolean, default: true, desc: "Whether to open the app in browser or not"
|
18
18
|
method_option :rack_env, type: :string, default: "production", desc: "Rack environment"
|
data/lib/mihari/config.rb
CHANGED
@@ -141,7 +141,7 @@ module Mihari
|
|
141
141
|
|
142
142
|
@sentry_dsn = ENV.fetch("SENTRY_DSN", nil)
|
143
143
|
|
144
|
-
@hide_config_values = ENV.fetch("HIDE_CONFIG_VALUES",
|
144
|
+
@hide_config_values = ENV.fetch("HIDE_CONFIG_VALUES", true)
|
145
145
|
|
146
146
|
@retry_times = ENV.fetch("RETRY_TIMES", 3).to_i
|
147
147
|
@retry_interval = ENV.fetch("RETRY_INTERVAL", 5).to_i
|
@@ -18,7 +18,7 @@ module Mihari
|
|
18
18
|
#
|
19
19
|
# @return [Mihari::AutonomousSystem]
|
20
20
|
#
|
21
|
-
def
|
21
|
+
def as
|
22
22
|
Mihari::AutonomousSystem.new(asn: normalize_asn(asn))
|
23
23
|
end
|
24
24
|
|
@@ -58,7 +58,7 @@ module Mihari
|
|
58
58
|
#
|
59
59
|
# @return [Mihari::Geolocation] <description>
|
60
60
|
#
|
61
|
-
def
|
61
|
+
def geolocation
|
62
62
|
# sometimes Censys overlooks country
|
63
63
|
# then set geolocation as nil
|
64
64
|
return nil if country.nil?
|
@@ -98,7 +98,7 @@ module Mihari
|
|
98
98
|
#
|
99
99
|
# @return [Mihari::Port]
|
100
100
|
#
|
101
|
-
def
|
101
|
+
def _port
|
102
102
|
Port.new(port: port)
|
103
103
|
end
|
104
104
|
|
@@ -162,20 +162,20 @@ module Mihari
|
|
162
162
|
#
|
163
163
|
# @return [Array<Mihari::Port>]
|
164
164
|
#
|
165
|
-
def
|
166
|
-
services.map(&:
|
165
|
+
def ports
|
166
|
+
services.map(&:_port)
|
167
167
|
end
|
168
168
|
|
169
169
|
#
|
170
170
|
# @return [Mihari::Artifact]
|
171
171
|
#
|
172
|
-
def
|
172
|
+
def artifact
|
173
173
|
Artifact.new(
|
174
174
|
data: ip,
|
175
175
|
metadata: metadata,
|
176
|
-
autonomous_system: autonomous_system.
|
177
|
-
geolocation: location.
|
178
|
-
ports:
|
176
|
+
autonomous_system: autonomous_system.as,
|
177
|
+
geolocation: location.geolocation,
|
178
|
+
ports: ports
|
179
179
|
)
|
180
180
|
end
|
181
181
|
|
@@ -269,8 +269,8 @@ module Mihari
|
|
269
269
|
#
|
270
270
|
# @return [Array<Mihari::Artifact>]
|
271
271
|
#
|
272
|
-
def
|
273
|
-
hits.map(&:
|
272
|
+
def artifacts
|
273
|
+
hits.map(&:artifact)
|
274
274
|
end
|
275
275
|
|
276
276
|
class << self
|
@@ -34,14 +34,14 @@ module Mihari
|
|
34
34
|
#
|
35
35
|
# @return [Mihari::AutonomousSystem]
|
36
36
|
#
|
37
|
-
def
|
37
|
+
def as
|
38
38
|
Mihari::AutonomousSystem.new(asn: normalize_asn(asn))
|
39
39
|
end
|
40
40
|
|
41
41
|
#
|
42
42
|
# @return [Mihari::Geolocation]
|
43
43
|
#
|
44
|
-
def
|
44
|
+
def geolocation
|
45
45
|
Mihari::Geolocation.new(
|
46
46
|
country: country,
|
47
47
|
country_code: country_code
|
@@ -94,12 +94,12 @@ module Mihari
|
|
94
94
|
#
|
95
95
|
# @return [Mihari::Artifact]
|
96
96
|
#
|
97
|
-
def
|
97
|
+
def artifact
|
98
98
|
Mihari::Artifact.new(
|
99
99
|
data: ip,
|
100
100
|
metadata: metadata_,
|
101
|
-
autonomous_system: metadata.
|
102
|
-
geolocation: metadata.
|
101
|
+
autonomous_system: metadata.as,
|
102
|
+
geolocation: metadata.geolocation
|
103
103
|
)
|
104
104
|
end
|
105
105
|
|
@@ -126,6 +126,7 @@ module Mihari
|
|
126
126
|
attribute :data, Types.Array(Datum)
|
127
127
|
attribute :message, Types::String
|
128
128
|
attribute :query, Types::String
|
129
|
+
attribute :scroll, Types::String.optional
|
129
130
|
|
130
131
|
#
|
131
132
|
# @return [Boolean]
|
@@ -162,11 +163,18 @@ module Mihari
|
|
162
163
|
attributes[:query]
|
163
164
|
end
|
164
165
|
|
166
|
+
#
|
167
|
+
# @return [String, nil]
|
168
|
+
#
|
169
|
+
def scroll
|
170
|
+
attributes[:scroll]
|
171
|
+
end
|
172
|
+
|
165
173
|
#
|
166
174
|
# @return [Array<Mihari::Artifact>]
|
167
175
|
#
|
168
|
-
def
|
169
|
-
data.map
|
176
|
+
def artifacts
|
177
|
+
data.map(&:artifact)
|
170
178
|
end
|
171
179
|
|
172
180
|
class << self
|
@@ -182,7 +190,8 @@ module Mihari
|
|
182
190
|
count: d.fetch("count"),
|
183
191
|
data: d.fetch("data").map { |x| Datum.from_dynamic!(x) },
|
184
192
|
message: d.fetch("message"),
|
185
|
-
query: d.fetch("query")
|
193
|
+
query: d.fetch("query"),
|
194
|
+
scroll: d["scroll"]
|
186
195
|
)
|
187
196
|
end
|
188
197
|
end
|
@@ -42,19 +42,19 @@ module Mihari
|
|
42
42
|
#
|
43
43
|
# @return [Mihari::Artifact]
|
44
44
|
#
|
45
|
-
def
|
45
|
+
def artifact
|
46
46
|
Mihari::Artifact.new(
|
47
47
|
data: ip,
|
48
48
|
metadata: metadata,
|
49
|
-
autonomous_system:
|
50
|
-
geolocation:
|
49
|
+
autonomous_system: as,
|
50
|
+
geolocation: geolocation
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
54
54
|
#
|
55
55
|
# @return [Mihari::Geolocation, nil]
|
56
56
|
#
|
57
|
-
def
|
57
|
+
def geolocation
|
58
58
|
return nil if country_code.nil?
|
59
59
|
|
60
60
|
Mihari::Geolocation.new(
|
@@ -66,7 +66,7 @@ module Mihari
|
|
66
66
|
#
|
67
67
|
# @return [Mihari::AutonomousSystem]
|
68
68
|
#
|
69
|
-
def
|
69
|
+
def as
|
70
70
|
Mihari::AutonomousSystem.new(asn: normalize_asn(asn))
|
71
71
|
end
|
72
72
|
|
@@ -150,8 +150,8 @@ module Mihari
|
|
150
150
|
#
|
151
151
|
# @return [Array<Mihari::Artifact>]
|
152
152
|
#
|
153
|
-
def
|
154
|
-
results.map(&:
|
153
|
+
def artifacts
|
154
|
+
results.map(&:artifact)
|
155
155
|
end
|
156
156
|
|
157
157
|
class << self
|
@@ -24,7 +24,7 @@ module Mihari
|
|
24
24
|
#
|
25
25
|
# @return [Mihari::Geolocation, nil]
|
26
26
|
#
|
27
|
-
def
|
27
|
+
def geolocation
|
28
28
|
return nil if country_name.nil? && country_code.nil?
|
29
29
|
|
30
30
|
Mihari::Geolocation.new(
|
@@ -105,7 +105,7 @@ module Mihari
|
|
105
105
|
#
|
106
106
|
# @return [Mihari::AutonomousSystem, nil]
|
107
107
|
#
|
108
|
-
def
|
108
|
+
def _asn
|
109
109
|
return nil if asn.nil?
|
110
110
|
|
111
111
|
Mihari::AutonomousSystem.new(asn: normalize_asn(asn))
|
@@ -194,7 +194,7 @@ module Mihari
|
|
194
194
|
#
|
195
195
|
# @return [Array<Mihari::Artifact>]
|
196
196
|
#
|
197
|
-
def
|
197
|
+
def artifacts
|
198
198
|
matches.map do |match|
|
199
199
|
metadata = collect_metadata_by_ip(match.ip_str)
|
200
200
|
ports = collect_ports_by_ip(match.ip_str).map do |port|
|
@@ -207,8 +207,8 @@ module Mihari
|
|
207
207
|
Mihari::Artifact.new(
|
208
208
|
data: match.ip_str,
|
209
209
|
metadata: metadata,
|
210
|
-
autonomous_system: match.
|
211
|
-
geolocation: match.location.
|
210
|
+
autonomous_system: match._asn,
|
211
|
+
geolocation: match.location.geolocation,
|
212
212
|
ports: ports,
|
213
213
|
reverse_dns_names: reverse_dns_names
|
214
214
|
)
|
@@ -83,7 +83,7 @@ module Mihari
|
|
83
83
|
#
|
84
84
|
# @return [Array<Mihari::Artifact>]
|
85
85
|
#
|
86
|
-
def
|
86
|
+
def artifacts
|
87
87
|
values = [page.url, page.domain, page.ip].compact
|
88
88
|
values.map do |value|
|
89
89
|
Mihari::Artifact.new(data: value, metadata: metadata)
|
@@ -129,8 +129,8 @@ module Mihari
|
|
129
129
|
#
|
130
130
|
# @return [Array<Mihari::Artifact>]
|
131
131
|
#
|
132
|
-
def
|
133
|
-
results.map(&:
|
132
|
+
def artifacts
|
133
|
+
results.map(&:artifacts).flatten
|
134
134
|
end
|
135
135
|
|
136
136
|
class << self
|
@@ -81,7 +81,7 @@ module Mihari
|
|
81
81
|
#
|
82
82
|
# @return [Mihari::Artifact]
|
83
83
|
#
|
84
|
-
def
|
84
|
+
def artifact
|
85
85
|
Artifact.new(data: value, metadata: metadata)
|
86
86
|
end
|
87
87
|
|
@@ -155,8 +155,8 @@ module Mihari
|
|
155
155
|
#
|
156
156
|
# @return [Array<Mihari::Artifact>]
|
157
157
|
#
|
158
|
-
def
|
159
|
-
data.map(&:
|
158
|
+
def artifacts
|
159
|
+
data.map(&:artifact)
|
160
160
|
end
|
161
161
|
|
162
162
|
class << self
|
data/lib/mihari/version.rb
CHANGED
data/mihari.gemspec
CHANGED
@@ -47,28 +47,28 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency "rb-fsevent", "~> 0.11"
|
48
48
|
spec.add_development_dependency "rerun", "~> 0.14"
|
49
49
|
spec.add_development_dependency "rspec", "~> 3.12"
|
50
|
-
spec.add_development_dependency "simplecov-lcov", "~> 0.8
|
50
|
+
spec.add_development_dependency "simplecov-lcov", "~> 0.8"
|
51
51
|
spec.add_development_dependency "standard", "~> 1.31"
|
52
52
|
spec.add_development_dependency "timecop", "~> 0.9"
|
53
53
|
spec.add_development_dependency "vcr", "~> 6.2"
|
54
|
-
spec.add_development_dependency "webmock", "~> 3.
|
54
|
+
spec.add_development_dependency "webmock", "~> 3.19"
|
55
55
|
|
56
56
|
unless ci_env?
|
57
57
|
spec.add_development_dependency "lefthook", "~> 1.4"
|
58
58
|
spec.add_development_dependency "solargraph", "~> 0.49"
|
59
59
|
end
|
60
60
|
|
61
|
-
spec.add_dependency "activerecord", "7.0.7"
|
61
|
+
spec.add_dependency "activerecord", "7.0.7.2"
|
62
62
|
spec.add_dependency "addressable", "2.8.5"
|
63
63
|
spec.add_dependency "awrence", "2.0.1"
|
64
64
|
spec.add_dependency "dotenv", "2.8.1"
|
65
65
|
spec.add_dependency "dry-container", "0.11.0"
|
66
66
|
spec.add_dependency "dry-files", "1.0.1"
|
67
|
-
spec.add_dependency "dry-schema", "1.13.
|
67
|
+
spec.add_dependency "dry-schema", "1.13.3"
|
68
68
|
spec.add_dependency "dry-struct", "1.6.0"
|
69
69
|
spec.add_dependency "dry-validation", "1.10.0"
|
70
70
|
spec.add_dependency "email_address", "0.2.4"
|
71
|
-
spec.add_dependency "grape", "1.
|
71
|
+
spec.add_dependency "grape", "1.8.0"
|
72
72
|
spec.add_dependency "grape-entity", "1.0.0"
|
73
73
|
spec.add_dependency "grape-swagger", "1.6.1"
|
74
74
|
spec.add_dependency "grape-swagger-entity", "0.5.2"
|
@@ -86,9 +86,9 @@ Gem::Specification.new do |spec|
|
|
86
86
|
spec.add_dependency "rack-cors", "2.0.1"
|
87
87
|
spec.add_dependency "rackup", "2.1.0"
|
88
88
|
spec.add_dependency "semantic_logger", "4.14.0"
|
89
|
-
spec.add_dependency "sentry-ruby", "5.
|
89
|
+
spec.add_dependency "sentry-ruby", "5.11.0"
|
90
90
|
spec.add_dependency "slack-notifier", "2.4.0"
|
91
|
-
spec.add_dependency "sqlite3", "1.6.
|
91
|
+
spec.add_dependency "sqlite3", "1.6.4"
|
92
92
|
spec.add_dependency "thor", "1.2.2"
|
93
93
|
spec.add_dependency "uuidtools", "2.2.0"
|
94
94
|
spec.add_dependency "whois", "5.1.0"
|