#' Search for Exploits
#'
#' Search across a variety of data sources for exploits and use facets to
#' get summary information.
#'
#' @param query Search query used to search the database of known exploits. See
#' \url{https://developer.shodan.io/api/exploits/rest} for all supported
#' search filters.
#' @param facets A comma-separated list of properties to get summary information on.
#' The following facets are currently supported: "\code{author}",
#' "\code{platform}", "\code{port}", "\code{source}" and "\code{type}.
#' If \code{length(facets) > 1)} this function will
#' concatenate the vector with commas to send to Shodan.
#' @param page The page number to page through results \code{100} at a time
#' (default: \code{1})
#' @export
#' @references \url{https://developer.shodan.io/api/exploits/rest}
shodan_exploit_search <- function(query=NULL, facets=NULL, page=1) {
facets <- paste(facets, collapse = ",")
res <- httr::GET(
shodan_base_url,
path = "api/search",
query = list(
query = query,
facets = facets,
page = page,
key = shodan_api_key()
)
)
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as = "text"))
}
#' Search for Exploits without Results
#'
#' This method behaves identical to \link{shodan_exploit_search} with the
#' difference that it doesn't return any results.
#'
#' @param query Search query used to search the database of known exploits. See
#' \url{https://developer.shodan.io/api/exploits/rest} for all supported
#' search filters.
#' @param facets A comma-separated list of properties to get summary information on.
#' The following facets are currently supported: "\code{author}",
#' "\code{platform}", "\code{port}", "\code{source}" and "\code{type}.
#' If \code{length(facets) > 1)} this function will
#' concatenate the vector with commas to send to Shodan.
#' @param page The page number to page through results \code{100} at a time
#' (default: \code{1})
#' @export
#' @references \url{https://developer.shodan.io/api/exploits/rest}
shodan_exploit_search_count <- function(query=NULL, facets=NULL, page=1) {
facets <- paste(facets, collapse = ",")
res <- httr::GET(
shodan_base_url,
path = "api/count",
query = list(
query = query,
facets = facets,
page = page,
key = shodan_api_key()
)
)
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as = "text"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.