R/ip_report.R

Defines functions ip_report

Documented in ip_report

#' Get IP Address Report
#'
#' Retrieves comprehensive analysis report for an IP address, including
#' geolocation, ASN information, DNS resolutions, and detected URLs.
#'
#' @param ip a valid IPv4 or IPv6 address. Required.
#' @param \dots Additional arguments passed to \code{\link{virustotal_GET}}.
#'
#' @return list containing IP analysis results including geolocation,
#' ASN information, DNS resolutions, detected URLs, and threat intelligence
#'
#' @export
#'
#' @references \url{https://docs.virustotal.com/reference}
#'
#' @seealso \code{\link{set_key}} for setting the API key
#'
#' @examples \dontrun{
#'
#' # Before calling the function, set the API key using set_key('api_key_here')
#'
#' ip_report(ip = "8.8.8.8")
#' ip_report(ip = "2001:4860:4860::8888")
#' }
ip_report <- function(ip = NULL, ...) {
  assert_character(ip, len = 1, any.missing = FALSE, min.chars = 1)

  if (!has_vt_key()) {
    stop(virustotal_auth_error(
      message = "Authentication failed. Please check your API key."
    ))
  }

  res <- virustotal_GET(path = paste0("ip_addresses/", ip), ...)

  res
}

Try the virustotal package in your browser

Any scripts or data that you put into this service are public.

virustotal documentation built on Aug. 20, 2026, 5:07 p.m.