Class: Shodan::Clients::Exploits

Inherits:
Base
  • Object
show all
Defined in:
lib/shodan/clients/exploits.rb

Overview

The Exploits API provides access to several exploit and vulnerability data sources. At the moment, it searches across the following:

- Exploit DB
- Metasploit
- Common Vulnerabilities and Exposures (CVE)

Constant Summary collapse

HOST =
"exploits.shodan.io"
BASE_URL =
"https://#{HOST}/api"

Instance Attribute Summary

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods inherited from Base

#initialize, #key?

Constructor Details

This class inherits a constructor from Shodan::Clients::Base

Instance Method Details

#count(query = "", facets: {}, page: 1, **params) ⇒ Object

This method behaves identical to the “/search” method with the difference that it doesn’t return any results.



29
30
31
32
33
34
35
# File 'lib/shodan/clients/exploits.rb', line 29

def count(query = "", facets: {}, page: 1, **params)
  params[:query] = query
  params = turn_into_query(params)
  facets = turn_into_facets(facets)
  params[:page] = page
  get("/count", **params.merge(facets))
end

#search(query = "", facets: {}, page: 1, **params) ⇒ Object

Search across a variety of data sources for exploits and use facets to get summary information.



19
20
21
22
23
24
25
# File 'lib/shodan/clients/exploits.rb', line 19

def search(query = "", facets: {}, page: 1, **params)
  params[:query] = query
  params = turn_into_query(params)
  facets = turn_into_facets(facets)
  params[:page] = page
  get("/search", **params.merge(facets))
end