Sha256: 3873c58958fb88a13e0d4b53bf7b920c043ec2f9bd5ecb16159132648a5265f2

Contents?: true

Size: 1.19 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
shodanx-0.2.1 lib/shodan/clients/exploits.rb