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)
106 |
# File 'lib/mihari/structs/censys.rb', line 106 attribute :autonomous_system, AutonomousSystem |
#ip ⇒ String (readonly)
98 |
# File 'lib/mihari/structs/censys.rb', line 98 attribute :ip, Types::String |
#location ⇒ Location (readonly)
102 |
# File 'lib/mihari/structs/censys.rb', line 102 attribute :location, Location |
#metadata ⇒ Hash (readonly)
110 |
# File 'lib/mihari/structs/censys.rb', line 110 attribute :metadata, Types::Hash |
#services ⇒ Array<Service> (readonly)
114 |
# File 'lib/mihari/structs/censys.rb', line 114 attribute :services, Types.Array(Service) |
Class Method Details
.from_dynamic!(d) ⇒ Object
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/mihari/structs/censys.rb', line 140 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.fetch("autonomous_system")), metadata: d, services: d.fetch("services", []).map { |x| Service.from_dynamic!(x) } ) end |
Instance Method Details
#artifact ⇒ Mihari::Models::Artifact
126 127 128 129 130 131 132 133 134 |
# File 'lib/mihari/structs/censys.rb', line 126 def artifact Models::Artifact.new( data: ip, metadata:, autonomous_system: autonomous_system.as, geolocation: location.geolocation, ports: ) end |
#ports ⇒ Array<Mihari::Port>
119 120 121 |
# File 'lib/mihari/structs/censys.rb', line 119 def ports services.map(&:_port) end |