Class: Mihari::Structs::Shodan::InternetDBResponse
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Mihari::Structs::Shodan::InternetDBResponse
- Defined in:
- lib/mihari/structs/shodan.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cpes ⇒ Array<String>
- #hostnames ⇒ Array<String>
- #ip ⇒ String
- #ports ⇒ Array<Integer>
- #tags ⇒ Array<String>
- #vulns ⇒ Array<String>
Class Method Details
.from_dynamic!(d) ⇒ InternetDBResponse
290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/mihari/structs/shodan.rb', line 290 def 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) ⇒ InternetDBResponse
307 308 309 |
# File 'lib/mihari/structs/shodan.rb', line 307 def from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#cpes ⇒ Array<String>
259 260 261 |
# File 'lib/mihari/structs/shodan.rb', line 259 def cpes attributes[:cpes] end |
#hostnames ⇒ Array<String>
266 267 268 |
# File 'lib/mihari/structs/shodan.rb', line 266 def hostnames attributes[:hostnames] end |
#ip ⇒ String
245 246 247 |
# File 'lib/mihari/structs/shodan.rb', line 245 def ip attributes[:ip] end |
#ports ⇒ Array<Integer>
252 253 254 |
# File 'lib/mihari/structs/shodan.rb', line 252 def ports attributes[:ports] end |
#tags ⇒ Array<String>
273 274 275 |
# File 'lib/mihari/structs/shodan.rb', line 273 def attributes[:tags] end |
#vulns ⇒ Array<String>
280 281 282 |
# File 'lib/mihari/structs/shodan.rb', line 280 def vulns attributes[:vulns] end |