mihari 7.2.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,158 +20,5 @@ module Mihari
20
20
  Rule.from_yaml ERB.new(File.read(path_or_id)).result
21
21
  end
22
22
  end
23
-
24
- #
25
- # Autonomous system builder
26
- #
27
- class AutonomousSystemBuilder < Service
28
- #
29
- # @param [String] ip
30
- # @param [Mihari::Enrichers::MMDB] enricher
31
- #
32
- # @return [Mihari::Models::AutonomousSystem, nil]
33
- #
34
- def call(ip, enricher: Enrichers::MMDB.new)
35
- enricher.result(ip).fmap do |res|
36
- Models::AutonomousSystem.new(number: res.asn) if res.asn
37
- end.value_or nil
38
- end
39
- end
40
-
41
- #
42
- # CPE builder
43
- #
44
- class CPEBuilder < Service
45
- #
46
- # Build CPEs
47
- #
48
- # @param [String] ip
49
- # @param [Mihari::Enrichers::Shodan] enricher
50
- #
51
- # @return [Array<Mihari::Models::CPE>]
52
- #
53
- def call(ip, enricher: Enrichers::Shodan.new)
54
- enricher.result(ip).fmap do |res|
55
- (res&.cpes || []).map { |cpe| Models::CPE.new(name: cpe) }
56
- end.value_or []
57
- end
58
- end
59
-
60
- #
61
- # DNS record builder
62
- #
63
- class DnsRecordBuilder < Service
64
- #
65
- # Build DNS records
66
- #
67
- # @param [String] domain
68
- # @param [Mihari::Enrichers::Shodan] enricher
69
- #
70
- # @return [Array<Mihari::Models::DnsRecord>]
71
- #
72
- def call(domain, enricher: Enrichers::GooglePublicDNS.new)
73
- enricher.result(domain).fmap do |res|
74
- res.answers.map { |answer| Models::DnsRecord.new(resource: answer.resource_type, value: answer.data) }
75
- end.value_or []
76
- end
77
- end
78
-
79
- #
80
- # Geolocation builder
81
- #
82
- class GeolocationBuilder < Service
83
- #
84
- # Build Geolocation
85
- #
86
- # @param [String] ip
87
- # @param [Mihari::Enrichers::MMDB] enricher
88
- #
89
- # @return [Mihari::Models::Geolocation, nil]
90
- #
91
- def call(ip, enricher: Enrichers::MMDB.new)
92
- enricher.result(ip).fmap do |res|
93
- if res.country_code
94
- Models::Geolocation.new(
95
- country: NormalizeCountry(res.country_code, to: :short),
96
- country_code: res.country_code
97
- )
98
- end
99
- end.value_or nil
100
- end
101
- end
102
-
103
- #
104
- # Port builder
105
- #
106
- class PortBuilder < Service
107
- #
108
- # Build ports
109
- #
110
- # @param [String] ip
111
- # @param [Mihari::Enrichers::Shodan] enricher
112
- #
113
- # @return [Array<Mihari::Models::Port>]
114
- #
115
- def call(ip, enricher: Enrichers::Shodan.new)
116
- enricher.result(ip).fmap do |res|
117
- (res&.ports || []).map { |port| Models::Port.new(number: port) }
118
- end.value_or []
119
- end
120
- end
121
-
122
- #
123
- # Reverse DNS name builder
124
- #
125
- class ReverseDnsNameBuilder < Service
126
- #
127
- # Build reverse DNS names
128
- #
129
- # @param [String] ip
130
- # @param [Mihari::Enrichers::Shodan] enricher
131
- #
132
- # @return [Array<Mihari::Models::ReverseDnsName>]
133
- #
134
- def call(ip, enricher: Enrichers::Shodan.new)
135
- enricher.result(ip).fmap do |res|
136
- (res&.hostnames || []).map { |name| Models::ReverseDnsName.new(name: name) }
137
- end.value_or []
138
- end
139
- end
140
-
141
- #
142
- # Vulnerability builder
143
- #
144
- class VulnerabilityBuilder < Service
145
- #
146
- # Build vulnerabilities
147
- #
148
- # @param [String] ip
149
- # @param [Mihari::Enrichers::Shodan] enricher
150
- #
151
- # @return [Array<Mihari::Models::Vulnerability>]
152
- #
153
- def call(ip, enricher: Enrichers::Shodan.new)
154
- enricher.result(ip).fmap do |res|
155
- (res&.vulns || []).map { |name| Models::Vulnerability.new(name: name) }
156
- end.value_or []
157
- end
158
- end
159
-
160
- #
161
- # Whois record builder
162
- #
163
- class WhoisRecordBuilder < Service
164
- #
165
- # Build whois record
166
- #
167
- # @param [String] domain
168
- # @param [Mihari::Enrichers::Whois] enricher
169
- #
170
- # @return [Mihari::Models::WhoisRecord, nil]
171
- #
172
- def call(domain, enricher: Enrichers::Whois.new)
173
- enricher.result(domain).value_or nil
174
- end
175
- end
176
23
  end
177
24
  end
@@ -19,7 +19,7 @@ module Mihari
19
19
 
20
20
  raise UnenrichableError.new, "#{artifact.id} is already enriched or unenrichable" unless artifact.enrichable?
21
21
 
22
- artifact.enrich_all
22
+ artifact.enrich
23
23
  artifact.save
24
24
  end
25
25
  end
@@ -51,7 +51,7 @@ module Mihari
51
51
  # @return [Mihari::Structs::MMDB::Response]
52
52
  #
53
53
  def call(ip)
54
- Mihari::Enrichers::MMDB.new.call ip
54
+ Clients::MMDB.new.query ip
55
55
  end
56
56
  end
57
57
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mihari
4
- VERSION = "7.2.0"
4
+ VERSION = "7.3.0"
5
5
  end