Class: Mihari::Structs::Censys::V2::Hit
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::Censys::V2::Hit
- Defined in:
- lib/mihari/structs/censys.rb
Instance Attribute Summary collapse
- #autonomous_system ⇒ AutonomousSystem? readonly
- #ip ⇒ String readonly
- #location ⇒ Location readonly
- #metadata ⇒ Hash readonly
- #services ⇒ Array<Service> readonly
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#autonomous_system ⇒ AutonomousSystem? (readonly)
109 |
# File 'lib/mihari/structs/censys.rb', line 109 attribute :autonomous_system, AutonomousSystem.optional |
#ip ⇒ String (readonly)
101 |
# File 'lib/mihari/structs/censys.rb', line 101 attribute :ip, Types::String |
#location ⇒ Location (readonly)
105 |
# File 'lib/mihari/structs/censys.rb', line 105 attribute :location, Location |
Class Method Details
.from_dynamic!(d) ⇒ Object
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/mihari/structs/censys.rb', line 143 def from_dynamic!(d) d = Types::Hash[d] new( ip: d.fetch("ip"), location: Location.from_dynamic!(d.fetch("location")), autonomous_system: AutonomousSystem.from_dynamic!(d["autonomous_system"]), metadata: d, services: d.fetch("services", []).map { |x| Service.from_dynamic!(x) } ) end |
Instance Method Details
#artifact ⇒ Mihari::Models::Artifact
129 130 131 132 133 134 135 136 137 |
# File 'lib/mihari/structs/censys.rb', line 129 def artifact Models::Artifact.new( data: ip, metadata:, autonomous_system: autonomous_system&.as, geolocation: location.geolocation, ports: ) end |
#ports ⇒ Array<Mihari::Port>
122 123 124 |
# File 'lib/mihari/structs/censys.rb', line 122 def ports services.map(&:_port) end |