Class: Mihari::Structs::Censys::Hit
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::Censys::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)
108 |
# File 'lib/mihari/structs/censys.rb', line 108 attribute :autonomous_system, AutonomousSystem.optional |
#ip ⇒ String (readonly)
100 |
# File 'lib/mihari/structs/censys.rb', line 100 attribute :ip, Types::String |
#location ⇒ Location (readonly)
104 |
# File 'lib/mihari/structs/censys.rb', line 104 attribute :location, Location |
Class Method Details
.from_dynamic!(d) ⇒ Object
142 143 144 145 146 147 148 149 150 151 |
# File 'lib/mihari/structs/censys.rb', line 142 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
128 129 130 131 132 133 134 135 136 |
# File 'lib/mihari/structs/censys.rb', line 128 def artifact Models::Artifact.new( data: ip, metadata:, autonomous_system: autonomous_system&.as, geolocation: location.geolocation, ports: ) end |
#ports ⇒ Array<Mihari::Port>
121 122 123 |
# File 'lib/mihari/structs/censys.rb', line 121 def ports services.map(&:_port) end |