PromptHub
Back to Blog
Developer Tools Cybersecurity

Stop Wasting Hours in Browser Tabs—vt-cli Is the Secret Weapon

B

Bright Coding

Author

15 min read 58 views
Stop Wasting Hours in Browser Tabs—vt-cli Is the Secret Weapon

Stop Wasting Hours in Browser Tabs—vt-cli Is the Secret Weapon

Every security researcher, malware analyst, and SOC engineer knows the pain. You've got twenty browser tabs open to VirusTotal. You're copy-pasting hashes, waiting for pages to load, clicking through endless analysis reports, and manually downloading samples one by one. Your workflow is broken. Your context is shattered. And somewhere in that chaos, a critical IOC slips through the cracks.

What if everything you do in VirusTotal could happen in your terminal? No context switching. No mouse dependency. Pure, scriptable, blazing-fast threat intelligence at your fingertips.

Enter vt-cli—the official VirusTotal Command Line Interface that turns your terminal into a threat hunting powerhouse. Built by VirusTotal themselves, this tool doesn't just wrap their API in a clumsy script. It's a precision-engineered interface that brings the entire VirusTotal ecosystem—file analysis, URL scanning, YARA rule management, Retrohunt jobs, and Intelligence searches—directly to where developers and analysts already live: the command line.

If you're still doing threat intelligence work through a web browser, you're fighting with one hand tied behind your back. Let's fix that.

What Is vt-cli?

vt-cli is the official command-line interface for VirusTotal, developed and maintained by VirusTotal (now part of Google Cloud). Released as an open-source project on GitHub, it represents a fundamental shift in how security professionals interact with one of the world's largest threat intelligence platforms.

The tool is written in Go, chosen specifically for its cross-platform compilation capabilities, static binary distribution, and exceptional performance characteristics. This isn't a hastily thrown-together Python↗ Bright Coding Blog wrapper with dependency hell—it's a compiled, statically-linked binary that runs identically on Windows, Linux, and macOS without requiring runtime environments.

What makes vt-cli genuinely transformative is its design philosophy: everything you can do through VirusTotal's web interface, you can now do programmatically through clean, composable shell commands. The project leverages VirusTotal's REST API v3 under the hood, abstracting away the complexity of HTTP requests, authentication, pagination, and response parsing into intuitive CLI semantics.

The tool has gained significant traction in the security community for several reasons. First, automation is non-negotiable in modern SOCs—manual browser-based analysis doesn't scale. Second, piping and redirection are fundamental to Unix philosophy; vt-cli embraces this by producing structured output (YAML by default, with JSON and CSV options) that feeds seamlessly into jq, grep, awk, and custom analysis pipelines. Third, the rise of DevSecOps has created demand for security tools that integrate into CI/CD workflows, infrastructure-as-code deployments, and automated incident response playbooks.

VirusTotal's own engineering team uses this tool internally. That alone should tell you something about its reliability and feature completeness.

Key Features That Make vt-cli Irreplaceable

The feature set of vt-cli goes far beyond simple hash lookups. Here's what separates it from amateur API wrappers:

Comprehensive Object Analysis — Retrieve detailed intelligence on files (by hash), URLs, domain names, IP addresses, and analysis reports. The tool understands VirusTotal's object model natively, returning rich structured data including submission history, detection ratios, metadata extraction, and behavioral analysis summaries.

VirusTotal Intelligence Search — Execute complex search queries using VT Intelligence syntax directly from your terminal. Searches like positives:5+ type:pdf size:10MB+ become one-liners, with results exportable to CSV or JSON for downstream processing. This is a premium feature requiring an API key with Intelligence access.

File Acquisition Pipeline — Download malware samples and benign files programmatically given a list of hashes. The tool supports bulk operations via stdin, enabling workflows like cat suspicious_hashes.txt | vt download - to retrieve entire datasets for sandbox analysis or offline reverse engineering.

YARA LiveHunt Management — Create, update, enable, disable, and delete YARA rulesets for LiveHunt monitoring. This transforms rule lifecycle management from a web-based chore into a version-controlled, auditable, scriptable process. Your YARA rules can live in Git, deploy via CI/CD, and activate across VirusTotal's entire incoming sample stream.

Retrohunt Execution — Launch historical hunting jobs against VirusTotal's corpus and retrieve match results. This enables retrospective threat discovery—identify when newly-discovered malware families or IOCs appeared in historical data, even before you knew to look for them.

Granular Output Filtering — The --include and --exclude options with glob-style path patterns (*, **) let you extract precisely the fields you need. No more parsing massive JSON blobs for a single value. The hierarchical path syntax (last_analysis_results.*.result) mirrors familiar filesystem navigation.

Multiple Authentication Methods — Support for interactive vt init configuration, VTCLI_APIKEY environment variable, and per-command --apikey flag, with sensible precedence rules for multi-tenant or shared-environment scenarios.

Shell Completion — Native bash, zsh, and Cygwin completion support that dynamically adapts to your API key's available features. Commands you don't have permissions for simply don't appear in completion suggestions.

Real-World Use Cases Where vt-cli Dominates

1. Automated SOC Triage and Enrichment

When your SIEM fires an alert with file hashes, URLs, or IP addresses, every second counts. Instead of manually pivoting to VirusTotal in a browser, your SOAR platform calls vt file <hash> --format json | jq '.data.attributes.last_analysis_stats'. Detection ratios, threat labels, and behavioral summaries feed directly into incident severity scoring and automated response decisions.

2. Bulk Malware Research and Dataset Building

You're researching a new malware campaign and have 500 hashes from threat intel feeds. With vt-cli, cat hashes.txt | xargs -I {} vt download {} retrieves the entire corpus. Or use vt search "tags:ransomware positives:10+ fs:2024-01-01+" -i sha256 --format csv to discover and export new samples matching your criteria. Browser-based workflows are impossible at this scale.

3. YARA Rule CI/CD Pipeline

Your team maintains YARA rules in Git. On push to main, your pipeline validates syntax, then uses vt hunting ruleset add or vt hunting ruleset update to deploy to VirusTotal LiveHunt. New matches trigger webhooks back to your system. The entire rule lifecycle—from development to production monitoring—is automated and auditable.

4. Threat Hunting and Retroactive Investigation

A new APT indicator emerges in the community. You immediately launch vt retrohunt start <yara_file> to search VirusTotal's historical corpus, then poll vt retrohunt matches <job_id> for results. Meanwhile, vt search with Intelligence queries identifies related samples by behavioral similarity. What would take hours of manual browsing becomes a scripted investigation reproducible by any team member.

Step-by-Step Installation & Setup Guide

Prerequisites

You'll need a VirusTotal API key. Free keys support basic lookups with rate limits; premium features (search, download, Retrohunt) require an Intelligence or Enterprise subscription. Sign up here if you haven't already.

Method 1: Pre-compiled Binaries (Recommended)

The fastest path to running vt-cli:

# Download the latest release for your platform from:
# https://github.com/VirusTotal/vt-cli/releases

# Linux/macOS example:
$ wget https://github.com/VirusTotal/vt-cli/releases/download/latest/vt-cli_latest_linux_amd64.tar.gz
$ tar -xzf vt-cli_latest_linux_amd64.tar.gz
$ sudo mv vt /usr/local/bin/
$ vt --version

Method 2: Build from Source

Requires Go 1.14 or higher:

# Clone the repository
$ git clone https://github.com/VirusTotal/vt-cli

# Enter the project directory
$ cd vt-cli

# Compile and install to $GOBIN
$ make install

# Ensure GOBIN is in your PATH
$ export GOBIN=`go env GOPATH`/bin
$ export PATH=$PATH:$GOBIN

Platform-Specific Installations

macOS (Homebrew — community maintained):

$ brew install virustotal-cli

macOS (manual with quarantine fix):

$ unzip MacOSX.zip
$ mkdir -p $HOME/bin
$ mv vt $HOME/bin
$ export PATH=$PATH:$HOME/bin
$ xattr -d com.apple.quarantine $HOME/bin/vt  # Remove Gatekeeper restriction

Windows (Winget — community maintained):

PS> winget install VirusTotal.vt-cli

Windows (Chocolatey — community maintained):

PS> choco install vt-cli

Pro Tip for Windows Users: The standard Windows console is notoriously slow with large text output. Install Cygwin with the bash-completion package for dramatically better performance and tab completion support.

Configure Your API Key

# Interactive setup — creates ~/.vt.toml
$ vt init
Enter your API key: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

Authentication precedence (highest to lowest):

  1. --apikey / -k flag on individual commands
  2. VTCLI_APIKEY environment variable
  3. Key stored in ~/.vt.toml configuration file

Proxy Configuration

Corporate environment? No problem:

# Per-command
$ vt --proxy http://proxy.company.com:8080 file <hash>

# Environment variable (persistent)
$ export VTCLI_PROXY=http://proxy.company.com:8080

# Config file entry
$ echo 'proxy="http://proxy.company.com:8080"' >> ~/.vt.toml

Enable Shell Completion

Bash (Linux):

$ vt completion bash > /etc/bash_completion.d/vt

Bash (macOS with Homebrew):

$ brew install bash-completion
$ vt completion bash > $(brew --prefix)/etc/bash_completion.d/vt
# Add to ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
  . $(brew --prefix)/etc/bash_completion
fi

Zsh (with oh-my-zsh):

$ mkdir -p /Users/$USERNAME/.oh-my-zsh/completions
$ vt completion zsh > /Users/$USERNAME/.oh-my-zsh/completions/_vt

Restart your shell after completion setup. Note: completion requires configured API key to dynamically show available commands based on your permissions.

REAL Code Examples from the Repository

Let's examine actual usage patterns from the official documentation, with detailed explanations of how to leverage each capability.

Example 1: File Analysis and Report Retrieval

# Basic file lookup by SHA256 hash — returns comprehensive metadata
$ vt file 8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85

This command queries VirusTotal's file object endpoint. The response includes submission history, static analysis results, PE metadata (for executables), packer identification, and detection statistics across 70+ antivirus engines. By default, output is human-readable YAML.

For programmatic consumption, add --format json:

# Machine-parseable output for pipeline integration
$ vt file 8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85 --format json

The JSON output feeds directly into jq for extraction: | jq '.data.attributes.last_analysis_stats.malicious' gives you the detection count in milliseconds.

Example 2: Analysis Report Tracking

# File analysis IDs follow the pattern: f-<SHA256>-<UNIX timestamp>
$ vt analysis f-8739c76e681f900923b900c9df0ef75cf421d39cabb54650c4b9ad19b6a76d85-1546309359

# Or use Base64-encoded analysis ID from scan submission:
$ vt scan file test.txt
test.txt MDJiY2FiZmZmZmQxNmZlMGZjMjUwZjA4Y2FkOTVlMGM6MTU0NjQ1NDUyMA==

# Retrieve that specific analysis job's results
$ vt analysis MDJiY2FiZmZmZmQxNmZlMGZjMjUwZjA4Y2FkOTVlMGM6MTU0NjQ1NDUyMA==
- _id: "MDJiY2FiZmZmZmQxNmZlMGZjMjUwZjA4Y2FkOTVlMGM6MTU0NjQ1NDUyMA=="
  _type: "analysis"
  date: 1546454520  # 2019-01-02 13:42:00 -0500 EST
  stats:
    failure: 0
    harmless: 0
    malicious: 0
    suspicious: 0
    timeout: 0
    type-unsupported: 0
    undetected: 0
  status: "queued"

This pattern is critical for asynchronous workflows. File submissions don't return immediate results—they queue for analysis. The vt scan file command returns an analysis ID that you poll with vt analysis until status transitions from "queued" to "completed". This mirrors how production systems handle VirusTotal integration: submit, store the ID, poll periodically, and act on completion.

Example 3: Bulk File Download Pipeline

# Download all files whose hashes are listed, one per line
$ cat /path/list_of_hashes.txt | vt download -

The hyphen (-) tells vt-cli to read hashes from stdin, enabling Unix pipeline composition. This single command replaces hours of manual browser downloads. Security researchers use this to build labeled datasets for machine learning, malware analysts retrieve sample corpora for reverse engineering, and incident responders collect evidence for forensic examination.

Advanced pattern with progress tracking:

$ cat hashes.txt | while read hash; do
    echo "Downloading: $hash"
    vt download "$hash" --output-dir ./samples/
done

Example 4: Intelligence Search with Structured Export

# Find PDFs with 5+ detections, export key fields as CSV
$ vt search "positives:5+ type:pdf" -i sha256,last_analysis_stats.malicious,tags --format csv

# Same query, JSON output for API consumption
$ vt search "positives:5+ type:pdf" -i sha256,last_analysis_stats.malicious,tags --format json

The -i (include) flag demonstrates vt-cli's field filtering capability. Instead of receiving megabytes of full object data, you get precisely the columns you specified. The CSV output drops directly into Excel, pandas, or SQL databases. The JSON variant feeds into document stores or streaming analytics platforms.

Example 5: URL Intelligence with Nested Field Extraction

# Get the specific IP address currently serving a URL
$ vt url last_serving_ip_address http://www.virustotal.com

This showcases relationship traversal—VirusTotal tracks URLs, the IPs that serve them, the domains they resolve to, and the files they distribute. The CLI exposes these relationships as subcommands, letting you pivot through infrastructure without writing custom API code.

Example 6: Precision Field Filtering with Glob Patterns

# Include only the server header from HTTP response metadata
$ vt url http://www.virustotal.com --include=last_http_response_headers.server
- last_http_response_headers:
    server: "Google Frontend"

# Include all direct children of response headers
$ vt url http://www.virustotal.com --include=last_http_response_headers.*

# Deep wildcard: any 'result' field at any depth
$ vt url http://www.virustotal.com --include=**.result
- last_analysis_results:
    ADMINUSLabs:
      result: "clean"
    AegisLab WebGuard:
      result: "clean"
    AlienVault:
      result: "clean"

The glob syntax (*, **) is extraordinarily powerful. * matches one path level; ** matches recursively. This lets you craft precise extraction patterns without knowing the exact schema depth—essential when dealing with VirusTotal's evolving data model where new vendors and analysis fields appear regularly.

Advanced Usage & Best Practices

Rate Limit Management — Free API keys are limited to 4 requests/minute. Use sleep 15 between commands in loops, or implement exponential backoff in scripts. Premium keys offer higher throughput—know your tier and design accordingly.

Output Format Strategy — Use YAML for human inspection (default), JSON for API integration (--format json), and CSV for spreadsheet analysis (--format csv). The -i flag is your friend: always filter to required fields to reduce payload size and parsing overhead.

Environment Isolation — For multi-tenant or client-separated workflows, use VTCLI_APIKEY environment variables in isolated shell sessions rather than ~/.vt.toml. This prevents cross-contamination and enables clean automation credential rotation.

Version Control Your Queries — Store complex vt search queries and vt hunting ruleset definitions in Git. Your threat hunting logic becomes reproducible, reviewable, and deployable through standard DevOps↗ Bright Coding Blog practices.

Combine with jq for Power Processing — The JSON output paired with jq enables transformations that would require hundreds of lines of Python:

$ vt file <hash> --format json | jq '.data.attributes | {hash: .sha256, detections: .last_analysis_stats.malicious, names: .names[0:5]}'

Windows Cygwin Optimization — Seriously, don't use standard Windows console. The performance difference on large result sets is 10x or more. Cygwin also gives you proper pipe handling and the full Unix tool ecosystem.

Comparison with Alternatives

Feature vt-cli (Official) Python API Wrappers Browser Manual Custom curl Scripts
Official Support ✅ Direct from VirusTotal ❌ Community-maintained ❌ Self-supported
Cross-Platform Binary ✅ Single static binary ❌ Requires Python runtime N/A ❌ Requires curl + jq
Shell Completion ✅ Dynamic, permission-aware ❌ Rarely implemented N/A
Field Filtering ✅ Native glob patterns ❌ Manual JSON parsing ❌ Manual visual scanning ⚠️ jq required
YARA/Retrohunt Management ✅ First-class commands ⚠️ Partial or missing ⚠️ Web UI only ❌ Complex API calls
Output Formats YAML, JSON, CSV Usually JSON only HTML only Raw JSON
Performance ✅ Compiled Go, optimized ⚠️ Interpreter overhead ❌ Browser rendering ⚠️ Network overhead
Piping/Redirection ✅ Native Unix philosophy ⚠️ Possible, not designed ❌ Impossible
Proxy Support ✅ Multiple methods ⚠️ Usually basic ✅ Browser settings ⚠️ Manual configuration

The verdict is clear: unofficial wrappers break when APIs change, browser workflows don't scale, and raw curl scripts accumulate technical debt. vt-cli is the only solution that combines official maintenance, performance, and ergonomic design for production security operations.

FAQ

Q: Is vt-cli free to use? A: The tool itself is free and open-source. However, it requires a VirusTotal API key. Free keys support basic lookups with rate limits; premium features like Intelligence search, file downloads, and Retrohunt require paid VirusTotal subscriptions.

Q: Can I use vt-cli in CI/CD pipelines? A: Absolutely. The static binary, environment variable authentication (VTCLI_APIKEY), and JSON output make it ideal for automated security scanning in build pipelines. Many teams integrate vt scan file for artifact verification.

Q: How do I handle API rate limits in scripts? A: Free tier: 4 requests/minute. Implement sleep 15 between calls, or use xargs -P 1 to serialize requests. Premium tiers offer substantially higher limits—contact VirusTotal for Enterprise pricing.

Q: Does vt-cli work on Apple Silicon (M1/M2/M3)? A: Yes. Download the darwin_arm64 binary from releases, or build from source with Go 1.16+ which natively supports Apple Silicon. The Homebrew formula also provides universal binaries.

Q: Can I export search results directly to a database? A: Use --format csv or --format json with shell redirection: vt search "..." --format csv > results.csv then import. For real-time streaming, pipe JSON output to tools like jq or custom scripts that write to your database.

Q: What's the difference between LiveHunt and Retrohunt? A: LiveHunt monitors incoming samples in real-time against your YARA rules, alerting on matches. Retrohunt searches historical VirusTotal data (years of samples) for matches—useful for discovering when threats first appeared.

Q: Is my API key secure in ~/.vt.toml? A: The file is created with user-only read permissions (0600). For enhanced security in shared environments, use VTCLI_APIKEY environment variables with secret management systems like HashiCorp Vault or cloud-native secret stores.

Conclusion

The browser was never designed for security operations at scale. Every tab switch, every manual copy-paste, every paginated result set is friction that compounds into missed threats and burned-out analysts.

vt-cli eliminates that friction. It brings VirusTotal's immense threat intelligence corpus into the environment where security professionals are most productive: the command line. With native support for file analysis, URL investigation, YARA rule management, Retrohunt execution, and granular output filtering, it transforms threat hunting from a manual chore into a repeatable, automatable, scalable discipline.

The tool is actively maintained by VirusTotal's own engineering team, distributed as zero-dependency binaries, and designed with the Unix philosophy that tools should compose cleanly and do one thing well.

If you're serious about threat intelligence, malware analysis, or security automation, stop wrestling with browser tabs and start using vt-cli today.

👉 Get started now: https://github.com/VirusTotal/vt-cli

Clone it. Install it. Configure your API key with vt init. Run your first vt search. Feel the difference when threat intelligence flows at the speed of your terminal, not the speed of web page rendering.

Your future self—reviewing that automated incident response playbook at 3 AM—will thank you.

Comments (0)

Comments are moderated before appearing.

No comments yet. Be the first to share your thoughts!

All tools