Class: Shodan::Clients::Host
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#count(query = "", facets: {}, **params) ⇒ Object
This method behaves identical to “/shodan/host/search” with the only difference that this method does not return any host results, it only returns the total number of results that matched the query and any facet information that was requested.
-
#get_by_ip(ip, **params) ⇒ Hash
Returns all services that have been found on the given host IP.
-
#search(query = "", facets: {}, page: 1, minify: true, **params) ⇒ Object
Search Shodan using the same query syntax as the website and use facets to get summary information for different properties.
-
#tokens(query = "", **params) ⇒ Object
This method lets you determine which filters are being used by the query string and what parameters were provided to the filters.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Shodan::Clients::Base
Instance Method Details
#count(query = "", facets: {}, **params) ⇒ Object
This method behaves identical to “/shodan/host/search” with the only difference that this method does not return any host results, it only returns the total number of results that matched the query and any facet information that was requested. As a result this method does not consume query credits.
21 22 23 24 25 26 |
# File 'lib/shodan/clients/host.rb', line 21 def count(query = "", facets: {}, **params) params[:query] = query converted_params = turn_into_query(params) facets = turn_into_facets(facets) get("/shodan/host/count", **converted_params.merge(facets)) end |
#get_by_ip(ip, **params) ⇒ Hash
Returns all services that have been found on the given host IP.
12 13 14 |
# File 'lib/shodan/clients/host.rb', line 12 def get_by_ip(ip, **params) get("/shodan/host/#{ip}", **params) end |
#search(query = "", facets: {}, page: 1, minify: true, **params) ⇒ Object
Search Shodan using the same query syntax as the website and use facets to get summary information for different properties.
30 31 32 33 34 35 36 37 |
# File 'lib/shodan/clients/host.rb', line 30 def search(query = "", facets: {}, page: 1, minify: true, **params) params[:query] = query params = turn_into_query(params) facets = turn_into_facets(facets) params[:page] = page params[:minify] = minify get("/shodan/host/search", **params.merge(facets)) end |
#tokens(query = "", **params) ⇒ Object
This method lets you determine which filters are being used by the query string and what parameters were provided to the filters.
41 42 43 44 45 |
# File 'lib/shodan/clients/host.rb', line 41 def tokens(query = "", **params) params[:query] = query params = turn_into_query(params) get("/shodan/host/search/tokens", **params) end |