Class: Shodan::Exploits
- Inherits:
-
Object
- Object
- Shodan::Exploits
- Defined in:
- lib/shodan/shodan.rb
Overview
The Exploits class shouldn’t be used independently, as it depends on the Shodan class.
- Author
-
achillean ([email protected])
:title:Shodan::Exploits
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
-
#count(query, params = {}) ⇒ Object
Search the Shodan Exploits archive for exploits but don’t return results, only the number of matches.
-
#initialize(api) ⇒ Exploits
constructor
A new instance of Exploits.
-
#search(query, params = {}) ⇒ Object
Search the Shodan Exploits archive for exploits.
Constructor Details
#initialize(api) ⇒ Exploits
Returns a new instance of Exploits.
109 110 111 |
# File 'lib/shodan/shodan.rb', line 109 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
107 108 109 |
# File 'lib/shodan/shodan.rb', line 107 def api @api end |
Instance Method Details
#count(query, params = {}) ⇒ Object
Search the Shodan Exploits archive for exploits but don’t return results, only the number of matches.
Arguments: query – Search terms
Optional arguments: facets – A comma-separated list of properties to get summary information on.
Returns: A dictionary with 1 main item: total (int).
140 141 142 143 |
# File 'lib/shodan/shodan.rb', line 140 def count(query, params={}) params[:query] = query return @api.request('exploits', 'count', params) end |
#search(query, params = {}) ⇒ Object
Search the Shodan Exploits archive for exploits.
Arguments: query – Search terms
Optional arguments: facets – A comma-separated list of properties to get summary information on. page – The page number to page through results 100 exploits at a time.
Returns: A dictionary with 2 main items: matches (list) and total (int). Please visit developer.shodan.io/api/exploit-specification for up-to-date information on what an Exploit result contains.
125 126 127 128 |
# File 'lib/shodan/shodan.rb', line 125 def search(query, params={}) params[:query] = query return @api.request('exploits', 'search', params) end |