
Recursively scan folders with VirusTotal API to detect malware. Features hash lookup, CSV export, real-time progress, and rate-limit handling for automated file analysis.
Python script to analyze ALL files with the VirusTotal API, scanning folders and subfolders recursively. Optimized for Windows.
Download the files to your computer
Install dependencies:
pip install -r requirements.txt
Copy the .env.example file to .env:
cp .env.example .env
Edit the .env file and add your configuration:
VIRUSTOTAL_API_KEY=your_actual_api_key_here
SCAN_FOLDER=C:\Users\username\Desktop\my_files
Run the script:
python virustotal_scanner.py
The script will automatically load your configuration from the .env file.
If you prefer not to use the .env file, the script will ask for the information:
python virustotal_scanner.py
The script will ask for:
Usage example:
Enter your VirusTotal API key: a1b2c3d4e5f6...
Enter the folder path to scan: C:\Users\username\Desktop\my_files
Do you want to continue? (y/n): y
C:\Users\username\Documents\my_filesC:\Users\username\Desktop\folder. (dot = current folder)After running the script, the following files will be generated automatically:
Log file with all events:
CSV file with results (semicolon-separated):
The CSV can be opened with Excel, Google Sheets, or any spreadsheet program.
================================================================================
VIRUSTOTAL SCANNER - COMPLETE FOLDER SCAN
================================================================================
Folder: C:\Users\username\Desktop\my_files
API limit: 4 files per minute
Maximum file size: 32 MB
================================================================================
Counting files...
Total files found: 15
Starting analysis...
================================================================================
Progress: [1/15]
================================================================================
[*] Analyzing: document.pdf
Path: C:\Users\username\Desktop\my_files\document.pdf
Uploading file...
Waiting for analysis results...
Analysis in progress... (attempt 1/30)
>> URL: https://www.virustotal.com/gui/file/abc123...
>> Detections: 0/70
================================================================================
Progress: [2/15]
================================================================================
[*] Analyzing: program.exe
Path: C:\Users\username\Desktop\my_files\program.exe
Uploading file...
Waiting for analysis results...
>> URL: https://www.virustotal.com/gui/file/def456...
>> Detections: 2/70
[!] Rate limit reached: Waiting 15 seconds...
================================================================================
FINAL SCAN SUMMARY
================================================================================
ANALYZED FILES:
--------------------------------------------------------------------------------
1. [CLEAN] 0/70
File: C:\Users\username\Desktop\my_files\document.pdf
URL: https://www.virustotal.com/gui/file/abc123...
2. [DETECTED] 2/70
File: C:\Users\username\Desktop\my_files\program.exe
URL: https://www.virustotal.com/gui/file/def456...
================================================================================
SKIPPED FILES:
--------------------------------------------------------------------------------
1. C:\Users\username\Desktop\my_files\large_file.iso
Reason: File too large (650.50 MB)
2. C:\Users\username\Desktop\my_files\system.dll
Reason: No read permissions
================================================================================
STATISTICS
================================================================================
Total files found: 15
Files analyzed: 13
Files skipped: 2
- Clean files (0 detections): 12
- Files with detections: 1
================================================================================
Error: "Invalid API key"
Error: "Access denied to file"
The script is very slow
Skipped files
MIT License - Copyright (c) 2025 neorai
This project is free and open source. You can use, modify, and distribute it freely. See the LICENSE file for details.