Sha256: 00cc3c1fe1c6e4192e9027004200b16ba52669fded88dfb11323d6ebf44df4ce

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

# original author: Kent 'picat' Gruber

module Shodan
  module Clients
    # 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)
    class Exploits < Base
      HOST = "exploits.shodan.io"
      BASE_URL = "https://#{HOST}/api"

      # Search across a variety of data sources for exploits and
      # use facets to get summary information.
      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

      # This method behaves identical to the "/search" method with
      # the difference that it doesn't return any results.
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shodanx-0.2.0 lib/shodan/clients/exploits.rb
shodanx-0.1.0 lib/shodan/clients/exploits.rb