Learn R Programming

virustotal: R Client for the VirusTotal API v3

Use VirusTotal, a Google service that analyzes files and URLs for viruses, worms, trojans and other malware, categorizes the content hosted by a domain using a variety of prominent services, and provides passive DNS information, among other things.

The package covers the VirusTotal API v3: file, URL, domain and IP reports; scanning and rescanning; IoC relationships; sandbox behaviour artifacts; comments and votes. Requests are paced to the public API’s 4-per-minute allowance automatically, transient failures are retried honoring the server’s Retry-After, and API failures surface as typed R conditions you can tryCatch on. Files larger than 32 MiB use a single-use upload URL; these uploads are not automatically retried.

Installation

From CRAN:

install.packages("virustotal")

Development version from GitHub:

# install.packages("pak")
pak::pak("themains/virustotal")

Quick start

Get a key from your VirusTotal API key page, then:

library(virustotal)
set_key("your_api_key") # or set VIRUSTOTAL_API_KEY in .Renviron

# What does VirusTotal know about a domain, an IP, a file hash, a URL?
domain_report("google.com")
ip_report("8.8.8.8")
file_report("99017f6eebbac24f351415dd410d522d")
url_report("http://www.google.com")

# Submit new things for analysis
scan_url("https://example.org")
scan_file("suspicious.exe")

# Errors are typed conditions
tryCatch(
  file_report("0123456789abcdef0123456789abcdef"),
  virustotal_error = function(e) message("VT said: ", conditionMessage(e))
)
#> VT said: Resource not found.

The package defaults to 4 requests per minute. Daily quotas are enforced by VirusTotal. Premium keys can raise the request rate:

options(virustotal.requests_per_minute = 1000)

The vignette walks through the full surface:

vignette("using_virustotal", package = "virustotal")

License

Released under the MIT License.

Copy Link

Version

Install

install.packages('virustotal')

Monthly Downloads

345

Version

0.7.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Gaurav Sood

Last Published

November 6th, 2026

Functions in virustotal (0.7.1)

download_file

Download a file from VirusTotal
file_report

Get File Scan Report
get_behaviour_evtx

Get Behaviour EVTX File
get_analysis

Get Analysis Results
get_behaviour_pcap

Get Behaviour PCAP File
get_file_comments

Retrieve comments for a file
get_file_behaviours

Get File Behaviours
format_file_size

Convert file size to human readable format
get_behaviour_report

Get Behaviour Report
create_safe_temp_dir

Create a safe temporary directory for file operations
cleanup_temp_files

Clean up temporary files and directories
get_file_behaviour_mitre_trees

Get File Behaviour MITRE ATT&CK Trees
init_rate_limit

Initialize the request log
get_domain_relationship

Retrieve related objects to an Internet domain
ip_report

Get IP Address Report
get_file_upload_url

Get file upload URL for large files
is_safe_environment

Check if running in a safe environment
get_file_votes

Retrieve votes for a file
post_domain_comments

Add a comment to an Internet domain
get_file_behaviour_summary

Get File Behaviour Summary
get_ip_comments

Retrieve comments for an IP address
get_ip_info

Retrieve information about an IP address
post_ip_votes

Add a vote for an IP address
post_file_comments

Add a comment to a file
get_url_relationships

Retrieve relationships for a URL
get_url_comments

Retrieve comments for a URL
post_domain_votes

Add a vote for a hostname or domain
post_url_comments

Add a comment to a URL
is_api_key_configured

Check if API key is properly configured
print.virustotal_response

Print method for VirusTotal responses
is_rate_limit_initialized

Is the request log initialized?
rate-limiting

Rate Limiting for VirusTotal API
post_file_votes

Add a vote to a file
sanitize_url

Sanitize URL input
get_domain_votes

Retrieve votes for an Internet domain
validate_input

Simple input validation
sanitize_hash

Sanitize hash input
scan_file

Submit a file for scanning
sanitize_ip

Sanitize IP address input
validate_vt_response

Validate VirusTotal response structure
virustotal-classes

S3 Classes for VirusTotal Responses
virustotal-errors

VirusTotal API Error Classes
virustotal-package

virustotal: Access Virustotal API
set_key

Set VirusTotal API Key
virustotal_info

Print package information and configuration status
get_behaviour_html

Get Behaviour HTML Report
rescan_domain

Request rescan of a domain
get_domain_info

Retrieve information about an Internet domain
get_domain_comments

Retrieve comments for an Internet domain
get_behaviour_memdump

Get Behaviour Memory Dump
get_file_download_url

Get download URL for a file
virustotal_file_scan

Create a VirusTotal file scan result
summary.virustotal_response

Summary method for VirusTotal responses
virustotal_file_report

Create a VirusTotal file report
virustotal_GET

GET for the Current V3 API
record_request

Record a performed request
get_ip_votes

Retrieve votes for an IP address
get_file_relationships

Retrieve relationships for a file
print.virustotal_error

Print method for VirusTotal errors
virustotal_ip_report

Create a VirusTotal IP report
sanitize_file_path

Sanitize file path input
print.virustotal_file_report

Print method for file reports
sanitize_domain

Sanitize domain input
post_ip_comments

Add a comment to an IP address
rescan_url

Request rescan of a URL
url_report

Get URL Report
virustotal_POST

POST for the Current V3 API
vt_request

Build the shared request object
vt_key

Resolve the VirusTotal API key
virustotal_GET_raw

GET a binary body from the V3 API
reset_rate_limit

Reset the request log
utilities

Utility Functions for VirusTotal Package
scan_url

Submit URL for scanning
security-utilities

Security Utilities for VirusTotal Package
virustotal_domain_report

Create a VirusTotal domain report
virustotal_error

Create a VirusTotal API error
virustotal_validation_error

Create a validation error
virustotal_rate_limit_error

Create a rate limit error
virustotal_url_scan

Create a VirusTotal URL scan result
vt_url_id

Encode a URL as a VirusTotal v3 URL identifier
virustotal_version

Get package version information
get_url_votes

Retrieve votes for a URL
post_url_votes

Add a vote to a URL
get_rate_limit_status

Get current rate limit status
has_vt_key

Is an API key set in either environment variable?
rescan_ip

Request rescan of an IP address
print.virustotal_domain_report

Print method for domain reports
rescan_file

Request rescan of a file
virustotal_check

Request Response Verification
virustotal_auth_error

Create an authentication error
domain_report

Get Domain Report