Skip to content

rykemc/Linux-av

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Linux Antivirus Scanner

A lightweight antivirus scanner for Debian-based Linux systems (Ubuntu, Pop!_OS, Debian, etc.) that integrates with VirusTotal API to scan files and folders for malware.

Features

  • πŸ” File Scanning: Scan individual files or entire directories
  • πŸ“ Directory Scanning: Recursive directory scanning with configurable depth
  • 🎯 Extension Filtering: Filter scans by file extensions (.deb, .appimage, etc.)
  • πŸ‘οΈ File Monitoring: Real-time monitoring of directories for new files
  • βš™οΈ Configuration File: Easy configuration management
  • πŸ“Š Detailed Reports: Clear scan results with threat detection statistics
  • πŸ”’ VirusTotal Integration: Leverage 70+ antivirus engines via VirusTotal API
  • πŸ’Ύ API Quota Management: Warnings when approaching API limits

Requirements

  • Python 3.6 or higher
  • Debian-based Linux distribution (Ubuntu, Pop!_OS, Debian, Linux Mint, etc.)
  • VirusTotal API key (free tier available)

Installation

Quick Install (Recommended)

  1. Clone the repository:
git clone https://github.com/rykemc/Linux-av.git
cd Linux-av
  1. Run the installation script:
chmod +x install.sh
sudo ./install.sh
  1. Edit the configuration file and add your VirusTotal API key:
nano ~/.linux-av.conf

Manual Installation

  1. Install dependencies:
sudo apt update
sudo apt install python3 python3-pip
pip3 install -r requirements.txt
  1. Make scripts executable:
chmod +x linux_av.py file_monitor.py
  1. Create a configuration file:
./linux_av.py --create-config

Configuration

The configuration file is located at ~/.linux-av.conf by default.

Configuration Options

[VirusTotal]
api_key = YOUR_API_KEY_HERE

[Scanning]
extensions = .deb, .appimage, .exe, .sh, .run
download_dir = /home/username/Downloads
schedule = manual
  • api_key: Your VirusTotal API key (get one at https://www.virustotal.com/)
  • extensions: Comma-separated list of file extensions to scan
  • download_dir: Default directory to monitor for new files
  • schedule: Scan schedule (currently: manual)

Getting a VirusTotal API Key

  1. Visit https://www.virustotal.com/
  2. Create a free account
  3. Go to your profile settings
  4. Copy your API key
  5. Add it to your configuration file

Note: The free tier allows up to 500 requests per day and 4 requests per minute.

Usage

Scan a Single File

linux-av --file /path/to/suspicious_file.deb

Scan a Directory

# Scan Downloads folder (non-recursive)
linux-av --directory ~/Downloads

# Scan recursively
linux-av --directory ~/Downloads --recursive

Scan with Extension Filter

# Only scan .deb and .appimage files
linux-av --directory ~/Downloads --extensions .deb .appimage

Monitor Directory for New Files

# Monitor Downloads folder
linux-av-monitor --directory ~/Downloads

# Monitor with extension filter
linux-av-monitor --directory ~/Downloads --extensions .deb .appimage

# Monitor multiple directories
linux-av-monitor --directory ~/Downloads /tmp/downloads

Using a Custom Config File

linux-av --config /path/to/config.conf --file myfile.deb

Command Line Options

linux-av (Scanner)

optional arguments:
  -h, --help            Show help message
  --config, -c PATH     Configuration file path (default: ~/.linux-av.conf)
  --file, -f PATH       Scan a single file
  --directory, -d PATH  Scan a directory
  --recursive, -r       Scan directory recursively
  --extensions, -e EXT  File extensions to scan (e.g., .deb .appimage)
  --api-key KEY         VirusTotal API key (overrides config)
  --create-config       Create default configuration file

linux-av-monitor (File Monitor)

optional arguments:
  -h, --help            Show help message
  --config, -c PATH     Configuration file path
  --directory, -d PATH  Directories to monitor (can specify multiple)
  --extensions, -e EXT  File extensions to scan

Examples

Example 1: Scan Downloaded .deb Packages

linux-av --directory ~/Downloads --extensions .deb

Example 2: Monitor Downloads for .appimage Files

linux-av-monitor --directory ~/Downloads --extensions .appimage

Example 3: Comprehensive System Scan

# Scan common download locations
linux-av --directory ~/Downloads --recursive
linux-av --directory ~/Desktop
linux-av --directory /tmp

Example 4: Enable Automatic Monitoring on Startup

# Enable and start the monitoring service
sudo systemctl enable linux-av-monitor
sudo systemctl start linux-av-monitor

# Check status
sudo systemctl status linux-av-monitor

# View logs
journalctl -u linux-av-monitor -f

Understanding Scan Results

When a file is scanned, you'll see output like:

Scanning: /home/user/Downloads/file.deb
  βœ… Clean
  Clean: 65, Malicious: 0, Suspicious: 0

or if a threat is detected:

Scanning: /home/user/Downloads/suspicious.exe
  🚨 THREAT DETECTED!
  Malicious: 45, Suspicious: 12

The numbers represent how many antivirus engines detected the file as:

  • Malicious: Confirmed malware
  • Suspicious: Potentially unwanted or suspicious behavior
  • Clean: Safe/harmless

API Quota Management

The free VirusTotal API has limits:

  • 500 requests per day
  • 4 requests per minute

The scanner will:

  • Warn you when scanning many files
  • Stop scanning if rate limit is reached
  • Show API request count in scan summary

Tips to conserve API quota:

  1. Use extension filters to scan only specific file types
  2. Avoid recursive scans of large directories
  3. The scanner checks file hashes first (cached results) before uploading

Security Best Practices

  1. Keep your API key secure: Don't share your configuration file
  2. Review threats carefully: Investigate any detected threats
  3. Use extension filters: Focus on potentially dangerous file types
  4. Regular scans: Periodically scan download directories
  5. File size limits: Free API has 32MB file size limit

Troubleshooting

"Error: VirusTotal API key not configured"

Edit your config file and add your API key:

nano ~/.linux-av.conf

"API rate limit reached"

You've hit the daily or per-minute limit. Wait before scanning more files, or:

  • For daily limit: Wait until the next day
  • For per-minute limit: Wait 60 seconds

"File too large (>32MB)"

The free VirusTotal API doesn't support files over 32MB. Consider:

  • Using VirusTotal Premium API
  • Skipping large files
  • Manually checking large files on virustotal.com

File Monitor Not Working

Make sure pyinotify is installed:

pip3 install pyinotify

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.

Disclaimer

This tool is provided as-is for educational and security purposes. While VirusTotal aggregates results from 70+ antivirus engines, no antivirus solution is 100% effective. Always exercise caution when handling suspicious files.

Support

For issues, questions, or suggestions, please open an issue on GitHub.

Acknowledgments

  • VirusTotal for providing the scanning API
  • The Python community for excellent libraries
  • Contributors and users of this tool

About

"Antivirus"programm that uses virustotals Api key

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •