Class: Mihari::Enrichers::Shodan

Inherits:
Base
  • Object
show all
Extended by:
Memist::Memoizable
Defined in:
lib/mihari/enrichers/shodan.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited

Methods included from Mixins::Configurable

#configuration_keys, #configuration_values, #configured?

Class Method Details

.query(ip) ⇒ Mihari::Structs::Shodan::InternetDBResponse?

Query Shodan Internet DB

Parameters:

  • ip (String)

Returns:



23
24
25
26
27
28
29
30
31
# File 'lib/mihari/enrichers/shodan.rb', line 23

def query(ip)
  url = "https://internetdb.shodan.io/#{ip}"
  res = HTTP.get(url)
  data = JSON.parse(res.body.to_s)

  Structs::Shodan::InternetDBResponse.from_dynamic! data
rescue HTTPError
  nil
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/mihari/enrichers/shodan.rb', line 9

def valid?
  true
end