# 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