Class: Shodan::ExploitDB
- Inherits:
-
Object
- Object
- Shodan::ExploitDB
- Defined in:
- lib/shodan/api.rb
Overview
The ExploitDB class shouldn’t be used independently, as it depends on the WebAPI class.
- Author
-
achillean (jmath at surtri.com)
:title:Shodan::ExploitDB
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
Instance Method Summary collapse
-
#download(id) ⇒ Object
Download the exploit code from the ExploitDB archive.
-
#initialize(api) ⇒ ExploitDB
constructor
A new instance of ExploitDB.
-
#search(query, params = {}) ⇒ Object
Search the ExploitDB archive.
Constructor Details
#initialize(api) ⇒ ExploitDB
Returns a new instance of ExploitDB.
148 149 150 |
# File 'lib/shodan/api.rb', line 148 def initialize(api) @api = api end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
146 147 148 |
# File 'lib/shodan/api.rb', line 146 def api @api end |
Instance Method Details
#download(id) ⇒ Object
Download the exploit code from the ExploitDB archive.
Arguments: id – ID of the ExploitDB entry
Returns: A hash with the following fields: filename – Name of the file content-type – Mimetype data – Contents of the file
162 163 164 |
# File 'lib/shodan/api.rb', line 162 def download(id) return @api.request('exploitdb/download', {:id => "#{id}"}) end |
#search(query, params = {}) ⇒ Object
Search the ExploitDB archive.
Arguments: query – Search terms
Optional arguments: author – Name of the exploit submitter platform – Target platform (e.g. windows, linux, hardware etc.) port – Service port number type – Any, dos, local, papers, remote, shellcode and webapps
Returns: A dictionary with 2 main items: matches (list) and total (int). Each item in ‘matches’ is a dictionary with the following elements:
id author date description platform port type
188 189 190 191 |
# File 'lib/shodan/api.rb', line 188 def search(query, params={}) params[:q] = query return @api.request('exploitdb/search', params) end |