Class: Mihari::Structs::Shodan::InternetDBResponse

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/mihari/structs/shodan.rb

Class Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/mihari/structs/shodan.rb', line 71

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    ip: d.fetch("ip"),
    ports: d.fetch("ports"),
    cpes: d.fetch("cpes"),
    hostnames: d.fetch("hostnames"),
    tags: d.fetch("tags"),
    vulns: d.fetch("vulns")
  )
end

.from_json!(json) ⇒ Object



83
84
85
# File 'lib/mihari/structs/shodan.rb', line 83

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end