mihari 5.6.2 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/README.md +1 -0
- data/config.ru +1 -1
- data/docs/analyzers/fofa.md +31 -0
- data/docs/analyzers/index.md +1 -0
- data/frontend/package-lock.json +73 -73
- data/frontend/package.json +5 -5
- data/frontend/src/components/alert/Form.vue +1 -14
- data/frontend/src/components/artifact/AS.vue +2 -8
- data/frontend/src/components/artifact/DnsRecords.vue +2 -8
- data/frontend/src/components/artifact/ReverseDnsNames.vue +2 -10
- data/frontend/src/components/artifact/WhoisRecord.vue +1 -1
- data/lib/mihari/actor.rb +14 -4
- data/lib/mihari/analyzers/base.rb +13 -12
- data/lib/mihari/analyzers/binaryedge.rb +4 -1
- data/lib/mihari/analyzers/censys.rb +4 -2
- data/lib/mihari/analyzers/circl.rb +4 -1
- data/lib/mihari/analyzers/crtsh.rb +4 -1
- data/lib/mihari/analyzers/dnstwister.rb +4 -1
- data/lib/mihari/analyzers/feed.rb +3 -0
- data/lib/mihari/analyzers/fofa.rb +65 -0
- data/lib/mihari/analyzers/greynoise.rb +4 -1
- data/lib/mihari/analyzers/hunterhow.rb +6 -1
- data/lib/mihari/analyzers/onyphe.rb +4 -1
- data/lib/mihari/analyzers/otx.rb +4 -1
- data/lib/mihari/analyzers/passivetotal.rb +4 -1
- data/lib/mihari/analyzers/pulsedive.rb +3 -0
- data/lib/mihari/analyzers/securitytrails.rb +4 -1
- data/lib/mihari/analyzers/shodan.rb +4 -1
- data/lib/mihari/analyzers/urlscan.rb +4 -1
- data/lib/mihari/analyzers/virustotal.rb +4 -1
- data/lib/mihari/analyzers/virustotal_intelligence.rb +4 -1
- data/lib/mihari/analyzers/zoomeye.rb +5 -2
- data/lib/mihari/cli/alert.rb +3 -0
- data/lib/mihari/cli/base.rb +3 -0
- data/lib/mihari/cli/database.rb +3 -0
- data/lib/mihari/cli/main.rb +3 -0
- data/lib/mihari/cli/rule.rb +3 -0
- data/lib/mihari/clients/base.rb +3 -0
- data/lib/mihari/clients/binaryedge.rb +5 -2
- data/lib/mihari/clients/censys.rb +7 -4
- data/lib/mihari/clients/circl.rb +3 -0
- data/lib/mihari/clients/crtsh.rb +3 -0
- data/lib/mihari/clients/dnstwister.rb +3 -0
- data/lib/mihari/clients/fofa.rb +83 -0
- data/lib/mihari/clients/greynoise.rb +5 -2
- data/lib/mihari/clients/hunterhow.rb +5 -2
- data/lib/mihari/clients/misp.rb +3 -0
- data/lib/mihari/clients/onyphe.rb +5 -2
- data/lib/mihari/clients/otx.rb +3 -0
- data/lib/mihari/clients/passivetotal.rb +3 -0
- data/lib/mihari/clients/publsedive.rb +4 -1
- data/lib/mihari/clients/securitytrails.rb +3 -0
- data/lib/mihari/clients/shodan.rb +5 -2
- data/lib/mihari/clients/the_hive.rb +3 -0
- data/lib/mihari/clients/urlscan.rb +7 -4
- data/lib/mihari/clients/virustotal.rb +5 -2
- data/lib/mihari/clients/zoomeye.rb +3 -0
- data/lib/mihari/commands/alert.rb +5 -14
- data/lib/mihari/commands/database.rb +3 -0
- data/lib/mihari/commands/rule.rb +10 -1
- data/lib/mihari/commands/search.rb +9 -6
- data/lib/mihari/commands/version.rb +3 -0
- data/lib/mihari/commands/web.rb +4 -1
- data/lib/mihari/config.rb +139 -150
- data/lib/mihari/constants.rb +1 -1
- data/lib/mihari/database.rb +6 -0
- data/lib/mihari/emitters/base.rb +13 -11
- data/lib/mihari/emitters/database.rb +4 -1
- data/lib/mihari/emitters/misp.rb +7 -4
- data/lib/mihari/emitters/slack.rb +3 -3
- data/lib/mihari/emitters/the_hive.rb +3 -3
- data/lib/mihari/emitters/webhook.rb +4 -3
- data/lib/mihari/enrichers/base.rb +15 -9
- data/lib/mihari/enrichers/google_public_dns.rb +6 -5
- data/lib/mihari/enrichers/ipinfo.rb +10 -8
- data/lib/mihari/enrichers/shodan.rb +4 -6
- data/lib/mihari/enrichers/whois.rb +12 -9
- data/lib/mihari/errors.rb +6 -0
- data/lib/mihari/feed/parser.rb +3 -0
- data/lib/mihari/feed/reader.rb +3 -0
- data/lib/mihari/http.rb +6 -0
- data/lib/mihari/mixins/autonomous_system.rb +3 -0
- data/lib/mihari/mixins/configurable.rb +3 -0
- data/lib/mihari/mixins/error_notification.rb +3 -0
- data/lib/mihari/mixins/falsepositive.rb +3 -0
- data/lib/mihari/mixins/refang.rb +3 -0
- data/lib/mihari/mixins/retriable.rb +6 -2
- data/lib/mihari/models/alert.rb +7 -4
- data/lib/mihari/models/artifact.rb +6 -0
- data/lib/mihari/models/autonomous_system.rb +4 -1
- data/lib/mihari/models/cpe.rb +4 -1
- data/lib/mihari/models/dns.rb +4 -1
- data/lib/mihari/models/geolocation.rb +4 -1
- data/lib/mihari/models/port.rb +4 -1
- data/lib/mihari/models/reverse_dns.rb +4 -1
- data/lib/mihari/models/rule.rb +6 -3
- data/lib/mihari/models/tag.rb +3 -0
- data/lib/mihari/models/tagging.rb +3 -0
- data/lib/mihari/models/whois.rb +4 -3
- data/lib/mihari/rule.rb +17 -12
- data/lib/mihari/schemas/alert.rb +3 -0
- data/lib/mihari/schemas/analyzer.rb +11 -0
- data/lib/mihari/schemas/emitter.rb +3 -0
- data/lib/mihari/schemas/enricher.rb +3 -0
- data/lib/mihari/schemas/macros.rb +4 -0
- data/lib/mihari/schemas/mixins.rb +5 -0
- data/lib/mihari/schemas/rule.rb +3 -0
- data/lib/mihari/service.rb +16 -0
- data/lib/mihari/services/alert_builder.rb +8 -5
- data/lib/mihari/services/alert_proxy.rb +6 -1
- data/lib/mihari/services/alert_runner.rb +8 -12
- data/lib/mihari/services/rule_builder.rb +8 -5
- data/lib/mihari/services/rule_runner.rb +8 -10
- data/lib/mihari/structs/binaryedge.rb +13 -28
- data/lib/mihari/structs/censys.rb +48 -127
- data/lib/mihari/structs/config.rb +19 -30
- data/lib/mihari/structs/filters.rb +38 -0
- data/lib/mihari/structs/fofa.rb +44 -0
- data/lib/mihari/structs/google_public_dns.rb +10 -28
- data/lib/mihari/structs/greynoise.rb +33 -84
- data/lib/mihari/structs/hunterhow.rb +24 -22
- data/lib/mihari/structs/ipinfo.rb +14 -35
- data/lib/mihari/structs/onyphe.rb +31 -76
- data/lib/mihari/structs/shodan.rb +47 -112
- data/lib/mihari/structs/urlscan.rb +24 -63
- data/lib/mihari/structs/virustotal_intelligence.rb +20 -56
- data/lib/mihari/type_checker.rb +4 -0
- data/lib/mihari/types.rb +3 -0
- data/lib/mihari/version.rb +1 -1
- data/lib/mihari/web/api.rb +15 -10
- data/lib/mihari/web/app.rb +59 -54
- data/lib/mihari/web/endpoints/alerts.rb +94 -89
- data/lib/mihari/web/endpoints/artifacts.rb +115 -110
- data/lib/mihari/web/endpoints/configs.rb +18 -13
- data/lib/mihari/web/endpoints/ip_addresses.rb +21 -16
- data/lib/mihari/web/endpoints/rules.rb +203 -198
- data/lib/mihari/web/endpoints/tags.rb +41 -36
- data/lib/mihari/web/middleware/connection_adapter.rb +16 -9
- data/lib/mihari/web/middleware/error_notification_adapter.rb +17 -10
- data/lib/mihari/web/public/assets/{index-28d4c79d.js → index-821134e2.js} +30 -30
- data/lib/mihari/web/public/assets/mode-yaml-24faa242.js +8 -0
- data/lib/mihari/web/public/index.html +1 -1
- data/lib/mihari.rb +24 -5
- data/mihari.gemspec +8 -1
- data/mkdocs.yml +3 -2
- metadata +39 -7
- data/lib/mihari/templates/rule.yml.erb +0 -5
- data/lib/mihari/web/public/assets/mode-yaml-a21faa53.js +0 -8
@@ -6,15 +6,10 @@ module Mihari
|
|
6
6
|
class AutonomousSystem < Dry::Struct
|
7
7
|
include Mixins::AutonomousSystem
|
8
8
|
|
9
|
+
# @!attribute [r] asn
|
10
|
+
# @return [Integer]
|
9
11
|
attribute :asn, Types::Int
|
10
12
|
|
11
|
-
#
|
12
|
-
# @return [Integer]
|
13
|
-
#
|
14
|
-
def asn
|
15
|
-
attributes[:asn]
|
16
|
-
end
|
17
|
-
|
18
13
|
#
|
19
14
|
# @return [Mihari::AutonomousSystem]
|
20
15
|
#
|
@@ -38,22 +33,13 @@ module Mihari
|
|
38
33
|
end
|
39
34
|
|
40
35
|
class Location < Dry::Struct
|
36
|
+
# @!attribute [r] country
|
37
|
+
# @return [String, nil]
|
41
38
|
attribute :country, Types::String.optional
|
42
|
-
attribute :country_code, Types::String.optional
|
43
39
|
|
44
|
-
#
|
45
|
-
#
|
46
|
-
|
47
|
-
def country
|
48
|
-
attributes[:country]
|
49
|
-
end
|
50
|
-
|
51
|
-
#
|
52
|
-
# @return [String, nil]
|
53
|
-
#
|
54
|
-
def country_code
|
55
|
-
attributes[:country_code]
|
56
|
-
end
|
40
|
+
# @!attribute [r] country_code
|
41
|
+
# @return [String, nil]
|
42
|
+
attribute :country_code, Types::String.optional
|
57
43
|
|
58
44
|
#
|
59
45
|
# @return [Mihari::Geolocation] <description>
|
@@ -86,14 +72,9 @@ module Mihari
|
|
86
72
|
end
|
87
73
|
|
88
74
|
class Service < Dry::Struct
|
89
|
-
attribute
|
90
|
-
|
91
|
-
|
92
|
-
# @return [Integer]
|
93
|
-
#
|
94
|
-
def port
|
95
|
-
attributes[:port]
|
96
|
-
end
|
75
|
+
# @!attribute [r] port
|
76
|
+
# @return [Integer, nil]
|
77
|
+
attribute :port, Types::Int
|
97
78
|
|
98
79
|
#
|
99
80
|
# @return [Mihari::Port]
|
@@ -118,46 +99,25 @@ module Mihari
|
|
118
99
|
end
|
119
100
|
|
120
101
|
class Hit < Dry::Struct
|
102
|
+
# @!attribute [r] ip
|
103
|
+
# @return [String]
|
121
104
|
attribute :ip, Types::String
|
122
|
-
attribute :location, Location
|
123
|
-
attribute :autonomous_system, AutonomousSystem
|
124
|
-
attribute :metadata, Types::Hash
|
125
|
-
attribute :services, Types.Array(Service)
|
126
105
|
|
127
|
-
#
|
128
|
-
#
|
129
|
-
|
130
|
-
def ip
|
131
|
-
attributes[:ip]
|
132
|
-
end
|
133
|
-
|
134
|
-
#
|
135
|
-
# @return [Location]
|
136
|
-
#
|
137
|
-
def location
|
138
|
-
attributes[:location]
|
139
|
-
end
|
106
|
+
# @!attribute [r] location
|
107
|
+
# @return [Location]
|
108
|
+
attribute :location, Location
|
140
109
|
|
141
|
-
#
|
142
|
-
#
|
143
|
-
|
144
|
-
def autonomous_system
|
145
|
-
attributes[:autonomous_system]
|
146
|
-
end
|
110
|
+
# @!attribute [r] autonomous_system
|
111
|
+
# @return [AutonomousSystem]
|
112
|
+
attribute :autonomous_system, AutonomousSystem
|
147
113
|
|
148
|
-
#
|
149
|
-
#
|
150
|
-
|
151
|
-
def metadata
|
152
|
-
attributes[:metadata]
|
153
|
-
end
|
114
|
+
# @!attribute [r] metadata
|
115
|
+
# @return [Hash]
|
116
|
+
attribute :metadata, Types::Hash
|
154
117
|
|
155
|
-
#
|
156
|
-
#
|
157
|
-
|
158
|
-
def services
|
159
|
-
attributes[:services]
|
160
|
-
end
|
118
|
+
# @!attribute [r] services
|
119
|
+
# @return [Array<Service>]
|
120
|
+
attribute :services, Types.Array(Service)
|
161
121
|
|
162
122
|
#
|
163
123
|
# @return [Array<Mihari::Port>]
|
@@ -199,22 +159,13 @@ module Mihari
|
|
199
159
|
end
|
200
160
|
|
201
161
|
class Links < Dry::Struct
|
162
|
+
# @!attribute [r] next
|
163
|
+
# @return [String, nil]
|
202
164
|
attribute :next, Types::String.optional
|
203
|
-
attribute :prev, Types::String.optional
|
204
165
|
|
205
|
-
#
|
206
|
-
#
|
207
|
-
|
208
|
-
def next
|
209
|
-
attributes[:next]
|
210
|
-
end
|
211
|
-
|
212
|
-
#
|
213
|
-
# @return [String, nil]
|
214
|
-
#
|
215
|
-
def prev
|
216
|
-
attributes[:prev]
|
217
|
-
end
|
166
|
+
# @!attribute [r] prev
|
167
|
+
# @return [String, nil]
|
168
|
+
attribute :prev, Types::String.optional
|
218
169
|
|
219
170
|
class << self
|
220
171
|
#
|
@@ -233,38 +184,21 @@ module Mihari
|
|
233
184
|
end
|
234
185
|
|
235
186
|
class Result < Dry::Struct
|
187
|
+
# @!attribute [r] query
|
188
|
+
# @return [String]
|
236
189
|
attribute :query, Types::String
|
237
|
-
attribute :total, Types::Int
|
238
|
-
attribute :hits, Types.Array(Hit)
|
239
|
-
attribute :links, Links
|
240
190
|
|
241
|
-
#
|
242
|
-
#
|
243
|
-
|
244
|
-
def query
|
245
|
-
attributes[:query]
|
246
|
-
end
|
247
|
-
|
248
|
-
#
|
249
|
-
# @return [Integer]
|
250
|
-
#
|
251
|
-
def total
|
252
|
-
attributes[:total]
|
253
|
-
end
|
191
|
+
# @!attribute [r] total
|
192
|
+
# @return [Integer]
|
193
|
+
attribute :total, Types::Int
|
254
194
|
|
255
|
-
#
|
256
|
-
#
|
257
|
-
|
258
|
-
def hits
|
259
|
-
attributes[:hits]
|
260
|
-
end
|
195
|
+
# @!attribute [r] hits
|
196
|
+
# @return [Array<Hit>]
|
197
|
+
attribute :hits, Types.Array(Hit)
|
261
198
|
|
262
|
-
#
|
263
|
-
#
|
264
|
-
|
265
|
-
def links
|
266
|
-
attributes[:links]
|
267
|
-
end
|
199
|
+
# @!attribute [r] links
|
200
|
+
# @return [Links]
|
201
|
+
attribute :links, Links
|
268
202
|
|
269
203
|
#
|
270
204
|
# @return [Array<Mihari::Models::Artifact>]
|
@@ -292,30 +226,17 @@ module Mihari
|
|
292
226
|
end
|
293
227
|
|
294
228
|
class Response < Dry::Struct
|
229
|
+
# @!attribute [r] code
|
230
|
+
# @return [Integer]
|
295
231
|
attribute :code, Types::Int
|
296
|
-
attribute :status, Types::String
|
297
|
-
attribute :result, Result
|
298
|
-
|
299
|
-
#
|
300
|
-
# @return [Integer]
|
301
|
-
#
|
302
|
-
def code
|
303
|
-
attributes[:code]
|
304
|
-
end
|
305
232
|
|
306
|
-
#
|
307
|
-
#
|
308
|
-
|
309
|
-
def status
|
310
|
-
attributes[:status]
|
311
|
-
end
|
233
|
+
# @!attribute [r] status
|
234
|
+
# @return [String]
|
235
|
+
attribute :status, Types::String
|
312
236
|
|
313
|
-
#
|
314
|
-
#
|
315
|
-
|
316
|
-
def result
|
317
|
-
attributes[:result]
|
318
|
-
end
|
237
|
+
# @!attribute [r] result
|
238
|
+
# @return [Result]
|
239
|
+
attribute :result, Result
|
319
240
|
|
320
241
|
class << self
|
321
242
|
#
|
@@ -3,38 +3,21 @@
|
|
3
3
|
module Mihari
|
4
4
|
module Structs
|
5
5
|
class Config < Dry::Struct
|
6
|
+
# @!attribute [r] name
|
7
|
+
# @return [String]
|
6
8
|
attribute :name, Types::String
|
7
|
-
attribute :type, Types::String
|
8
|
-
attribute :is_configured, Types::Bool
|
9
|
-
attribute :values, Types.Array(Types::Hash).optional
|
10
9
|
|
11
|
-
#
|
12
|
-
#
|
13
|
-
|
14
|
-
def name
|
15
|
-
attributes[:name]
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# @return [String]
|
20
|
-
#
|
21
|
-
def type
|
22
|
-
attributes[:type]
|
23
|
-
end
|
10
|
+
# @!attribute [r] type
|
11
|
+
# @return [String]
|
12
|
+
attribute :type, Types::String
|
24
13
|
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
def is_configured
|
29
|
-
attributes[:is_configured]
|
30
|
-
end
|
14
|
+
# @!attribute [r] is_configured
|
15
|
+
# @return [Boolean]
|
16
|
+
attribute :is_configured, Types::Bool
|
31
17
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
35
|
-
def values
|
36
|
-
attributes[:values]
|
37
|
-
end
|
18
|
+
# @!attribute [r] values
|
19
|
+
# @return [Array<Hash>, nil]
|
20
|
+
attribute :values, Types.Array(Types::Hash).optional
|
38
21
|
|
39
22
|
class << self
|
40
23
|
#
|
@@ -61,8 +44,14 @@ module Mihari
|
|
61
44
|
#
|
62
45
|
def get_dummy(klass)
|
63
46
|
type = get_type(klass)
|
64
|
-
|
65
|
-
|
47
|
+
case type
|
48
|
+
when "Analyzer"
|
49
|
+
klass.new("dummy")
|
50
|
+
when "Emitter"
|
51
|
+
klass.new(rule: nil)
|
52
|
+
else
|
53
|
+
klass.new
|
54
|
+
end
|
66
55
|
end
|
67
56
|
|
68
57
|
#
|
@@ -5,15 +5,34 @@ module Mihari
|
|
5
5
|
module Filters
|
6
6
|
module Alert
|
7
7
|
class SearchFilter < Dry::Struct
|
8
|
+
# @!attribute [r] artifact_data
|
9
|
+
# @return [String, nil]
|
8
10
|
attribute? :artifact_data, Types::String.optional
|
11
|
+
|
12
|
+
# @!attribute [r] rule_id
|
13
|
+
# @return [String, nil]
|
9
14
|
attribute? :rule_id, Types::String.optional
|
15
|
+
|
16
|
+
# @!attribute [r] tag_name
|
17
|
+
# @return [String, nil]
|
10
18
|
attribute? :tag_name, Types::String.optional
|
19
|
+
|
20
|
+
# @!attribute [r] from_at
|
21
|
+
# @return [DateTime, nil]
|
11
22
|
attribute? :from_at, Types::DateTime.optional
|
23
|
+
|
24
|
+
# @!attribute [r] to_at
|
25
|
+
# @return [DateTime, nil]
|
12
26
|
attribute? :to_at, Types::DateTime.optional
|
13
27
|
end
|
14
28
|
|
15
29
|
class SearchFilterWithPagination < SearchFilter
|
30
|
+
# @!attribute [r] page
|
31
|
+
# @return [Integer, nil]
|
16
32
|
attribute? :page, Types::Int.default(1)
|
33
|
+
|
34
|
+
# @!attribute [r] limit
|
35
|
+
# @return [Integer, nil]
|
17
36
|
attribute? :limit, Types::Int.default(10)
|
18
37
|
|
19
38
|
def without_pagination
|
@@ -30,15 +49,34 @@ module Mihari
|
|
30
49
|
|
31
50
|
module Rule
|
32
51
|
class SearchFilter < Dry::Struct
|
52
|
+
# @!attribute [r] description
|
53
|
+
# @return [String, nil]
|
33
54
|
attribute? :description, Types::String.optional
|
55
|
+
|
56
|
+
# @!attribute [r] tag_name
|
57
|
+
# @return [String, nil]
|
34
58
|
attribute? :tag_name, Types::String.optional
|
59
|
+
|
60
|
+
# @!attribute [r] title
|
61
|
+
# @return [String, nil]
|
35
62
|
attribute? :title, Types::String.optional
|
63
|
+
|
64
|
+
# @!attribute [r] from_at
|
65
|
+
# @return [DateTime, nil]
|
36
66
|
attribute? :from_at, Types::DateTime.optional
|
67
|
+
|
68
|
+
# @!attribute [r] to_at
|
69
|
+
# @return [DateTime, nil]
|
37
70
|
attribute? :to_at, Types::DateTime.optional
|
38
71
|
end
|
39
72
|
|
40
73
|
class SearchFilterWithPagination < SearchFilter
|
74
|
+
# @!attribute [r] page
|
75
|
+
# @return [Integer, nil]
|
41
76
|
attribute? :page, Types::Int.default(1)
|
77
|
+
|
78
|
+
# @!attribute [r] limit
|
79
|
+
# @return [Integer, nil]
|
42
80
|
attribute? :limit, Types::Int.default(10)
|
43
81
|
|
44
82
|
def without_pagination
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Mihari
|
2
|
+
module Structs
|
3
|
+
module Fofa
|
4
|
+
class Response < Dry::Struct
|
5
|
+
# @!attribute [r] error
|
6
|
+
# @return [Boolean]
|
7
|
+
attribute :error, Types::Bool
|
8
|
+
|
9
|
+
# @!attribute [r] size
|
10
|
+
# @return [Integer, nil]
|
11
|
+
attribute? :size, Types::Int.optional
|
12
|
+
|
13
|
+
# @!attribute [r] page
|
14
|
+
# @return [Integer, nil]
|
15
|
+
attribute? :page, Types::Int.optional
|
16
|
+
|
17
|
+
# @!attribute [r] mode
|
18
|
+
# @return [String, nil]
|
19
|
+
attribute? :mode, Types::String.optional
|
20
|
+
|
21
|
+
# @!attribute [r] query
|
22
|
+
# @return [String, nil]
|
23
|
+
attribute? :query, Types::String.optional
|
24
|
+
|
25
|
+
# @!attribute [r] results
|
26
|
+
# @return [Array<String>, nil]
|
27
|
+
attribute? :results, Types.Array(Types.Array(Types::String)).optional
|
28
|
+
|
29
|
+
class << self
|
30
|
+
def from_dynamic!(d)
|
31
|
+
new(
|
32
|
+
error: d.fetch("error"),
|
33
|
+
size: d["size"],
|
34
|
+
page: d["page"],
|
35
|
+
mode: d["mode"],
|
36
|
+
query: d["query"],
|
37
|
+
results: d["results"]
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -12,30 +12,17 @@ module Mihari
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
class Answer < Dry::Struct
|
15
|
+
# @!attribute [r] name
|
16
|
+
# @return [String]
|
15
17
|
attribute :name, Types::String
|
16
|
-
attribute :data, Types::String
|
17
|
-
attribute :resource_type, Types::String
|
18
18
|
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
22
|
-
def name
|
23
|
-
attributes[:name]
|
24
|
-
end
|
25
|
-
|
26
|
-
#
|
27
|
-
# @return [String]
|
28
|
-
#
|
29
|
-
def data
|
30
|
-
attributes[:data]
|
31
|
-
end
|
19
|
+
# @!attribute [r] data
|
20
|
+
# @return [String]
|
21
|
+
attribute :data, Types::String
|
32
22
|
|
33
|
-
#
|
34
|
-
#
|
35
|
-
|
36
|
-
def resource_type
|
37
|
-
attributes[:resource_type]
|
38
|
-
end
|
23
|
+
# @!attribute [r] resource_type
|
24
|
+
# @return [String]
|
25
|
+
attribute :resource_type, Types::String
|
39
26
|
|
40
27
|
class << self
|
41
28
|
#
|
@@ -56,15 +43,10 @@ module Mihari
|
|
56
43
|
end
|
57
44
|
|
58
45
|
class Response < Dry::Struct
|
46
|
+
# @!attribute [r] answers
|
47
|
+
# @return [Array<Answer>]
|
59
48
|
attribute :answers, Types.Array(Answer)
|
60
49
|
|
61
|
-
#
|
62
|
-
# @return [Array<Answer>]
|
63
|
-
#
|
64
|
-
def answers
|
65
|
-
attributes[:answers]
|
66
|
-
end
|
67
|
-
|
68
50
|
class << self
|
69
51
|
#
|
70
52
|
# @param [Hash] d
|
@@ -6,30 +6,17 @@ module Mihari
|
|
6
6
|
class Metadata < Dry::Struct
|
7
7
|
include Mixins::AutonomousSystem
|
8
8
|
|
9
|
+
# @!attribute [r] country
|
10
|
+
# @return [String]
|
9
11
|
attribute :country, Types::String
|
10
|
-
attribute :country_code, Types::String
|
11
|
-
attribute :asn, Types::String
|
12
|
-
|
13
|
-
#
|
14
|
-
# @return [String]
|
15
|
-
#
|
16
|
-
def country
|
17
|
-
attributes[:country]
|
18
|
-
end
|
19
12
|
|
20
|
-
#
|
21
|
-
#
|
22
|
-
|
23
|
-
def country_code
|
24
|
-
attributes[:country_code]
|
25
|
-
end
|
13
|
+
# @!attribute [r] country_code
|
14
|
+
# @return [String]
|
15
|
+
attribute :country_code, Types::String
|
26
16
|
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
-
def asn
|
31
|
-
attributes[:asn]
|
32
|
-
end
|
17
|
+
# @!attribute [r] asn
|
18
|
+
# @return [String]
|
19
|
+
attribute :asn, Types::String
|
33
20
|
|
34
21
|
#
|
35
22
|
# @return [Mihari::AutonomousSystem]
|
@@ -66,30 +53,17 @@ module Mihari
|
|
66
53
|
end
|
67
54
|
|
68
55
|
class Datum < Dry::Struct
|
56
|
+
# @!attribute [r] ip
|
57
|
+
# @return [String]
|
69
58
|
attribute :ip, Types::String
|
70
|
-
attribute :metadata, Metadata
|
71
|
-
attribute :metadata_, Types::Hash
|
72
59
|
|
73
|
-
#
|
74
|
-
#
|
75
|
-
|
76
|
-
def ip
|
77
|
-
attributes[:ip]
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# @return [Metadata]
|
82
|
-
#
|
83
|
-
def metadata
|
84
|
-
attributes[:metadata]
|
85
|
-
end
|
60
|
+
# @!attribute [r] metadata
|
61
|
+
# @return [Metadata]
|
62
|
+
attribute :metadata, Metadata
|
86
63
|
|
87
|
-
#
|
88
|
-
#
|
89
|
-
|
90
|
-
def metadata_
|
91
|
-
attributes[:metadata_]
|
92
|
-
end
|
64
|
+
# @!attribute [r] metadata_
|
65
|
+
# @return [Hash]
|
66
|
+
attribute :metadata_, Types::Hash
|
93
67
|
|
94
68
|
#
|
95
69
|
# @return [Mihari::Models::Artifact]
|
@@ -121,54 +95,29 @@ module Mihari
|
|
121
95
|
end
|
122
96
|
|
123
97
|
class Response < Dry::Struct
|
98
|
+
# @!attribute [r] complete
|
99
|
+
# @return [Boolean]
|
124
100
|
attribute :complete, Types::Bool
|
125
|
-
attribute :count, Types::Int
|
126
|
-
attribute :data, Types.Array(Datum)
|
127
|
-
attribute :message, Types::String
|
128
|
-
attribute :query, Types::String
|
129
|
-
attribute :scroll, Types::String.optional
|
130
|
-
|
131
|
-
#
|
132
|
-
# @return [Boolean]
|
133
|
-
#
|
134
|
-
def complete
|
135
|
-
attributes[:complete]
|
136
|
-
end
|
137
101
|
|
138
|
-
#
|
139
|
-
#
|
140
|
-
|
141
|
-
def count
|
142
|
-
attributes[:count]
|
143
|
-
end
|
102
|
+
# @!attribute [r] count
|
103
|
+
# @return [Integer]
|
104
|
+
attribute :count, Types::Int
|
144
105
|
|
145
|
-
#
|
146
|
-
#
|
147
|
-
|
148
|
-
def data
|
149
|
-
attributes[:data]
|
150
|
-
end
|
106
|
+
# @!attribute [r] data
|
107
|
+
# @return [Array<Datnum>]
|
108
|
+
attribute :data, Types.Array(Datum)
|
151
109
|
|
152
|
-
#
|
153
|
-
#
|
154
|
-
|
155
|
-
def message
|
156
|
-
attributes[:message]
|
157
|
-
end
|
110
|
+
# @!attribute [r] message
|
111
|
+
# @return [String]
|
112
|
+
attribute :message, Types::String
|
158
113
|
|
159
|
-
#
|
160
|
-
#
|
161
|
-
|
162
|
-
def query
|
163
|
-
attributes[:query]
|
164
|
-
end
|
114
|
+
# @!attribute [r] query
|
115
|
+
# @return [String]
|
116
|
+
attribute :query, Types::String
|
165
117
|
|
166
|
-
#
|
167
|
-
#
|
168
|
-
|
169
|
-
def scroll
|
170
|
-
attributes[:scroll]
|
171
|
-
end
|
118
|
+
# @!attribute [r] scroll
|
119
|
+
# @return [String, nil]
|
120
|
+
attribute :scroll, Types::String.optional
|
172
121
|
|
173
122
|
#
|
174
123
|
# @return [Array<Mihari::Models::Artifact>]
|
@@ -1,17 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Mihari
|
2
4
|
module Structs
|
3
5
|
module HunterHow
|
4
6
|
class ListItem < Dry::Struct
|
7
|
+
# @!attribute [r] domain
|
8
|
+
# @return [String]
|
5
9
|
attribute :domain, Types::String
|
10
|
+
|
11
|
+
# @!attribute [r] ip
|
12
|
+
# @return [String]
|
6
13
|
attribute :ip, Types::String
|
7
|
-
attribute :port, Types::Integer
|
8
14
|
|
9
|
-
#
|
10
|
-
#
|
11
|
-
|
12
|
-
def ip
|
13
|
-
attributes[:ip]
|
14
|
-
end
|
15
|
+
# @!attribute [r] port
|
16
|
+
# @return [Integer]
|
17
|
+
attribute :port, Types::Int
|
15
18
|
|
16
19
|
#
|
17
20
|
# @return [Mihari::Models::Artifact]
|
@@ -38,15 +41,13 @@ module Mihari
|
|
38
41
|
end
|
39
42
|
|
40
43
|
class DataClass < Dry::Struct
|
44
|
+
# @!attribute [r] list
|
45
|
+
# @return [Array<ListItem>]
|
41
46
|
attribute :list, Types.Array(ListItem)
|
42
|
-
attribute :total, Types::Integer
|
43
47
|
|
44
|
-
#
|
45
|
-
#
|
46
|
-
|
47
|
-
def list
|
48
|
-
attributes[:list]
|
49
|
-
end
|
48
|
+
# @!attribute [r] total
|
49
|
+
# @return [Integer]
|
50
|
+
attribute :total, Types::Int
|
50
51
|
|
51
52
|
#
|
52
53
|
# @return [Array<Mihari::Models::Artifact>]
|
@@ -72,16 +73,17 @@ module Mihari
|
|
72
73
|
end
|
73
74
|
|
74
75
|
class Response < Dry::Struct
|
75
|
-
attribute
|
76
|
+
# @!attribute [r] code
|
77
|
+
# @return [Integer]
|
78
|
+
attribute :code, Types::Int
|
79
|
+
|
80
|
+
# @!attribute [r] data
|
81
|
+
# @return [DataClass]
|
76
82
|
attribute :data, DataClass
|
77
|
-
attribute :message, Types::String
|
78
83
|
|
79
|
-
#
|
80
|
-
#
|
81
|
-
|
82
|
-
def data
|
83
|
-
attributes[:data]
|
84
|
-
end
|
84
|
+
# @!attribute [r] message
|
85
|
+
# @return [String]
|
86
|
+
attribute :message, Types::String
|
85
87
|
|
86
88
|
class << self
|
87
89
|
#
|