A Windows desktop application built with C# and Windows Forms that implements ClamAV signature-based virus scanning functionality. This application can scan files and directories using ClamAV virus signatures.
- Features
- Requirements
- Installation
- Database Setup
- Usage
- Supported Signature Formats
- Project Structure
- Screenshots
- File Scanning: Scan individual files for virus signatures
- Directory Scanning: Recursively scan directories for infected files
- Multiple Signature Types: Support for various ClamAV signature formats:
- HDB (MD5 hash-based)
- HSB (SHA-1 hash-based)
- MDB (MD5 hash with offset)
- NDB (Hex pattern matching)
- LDB (Logical signatures with operators)
- LDU (Logical signatures unsigned)
- CDB (Container metadata signatures)
- FP (False positive signatures)
- Aho-Corasick Algorithm: Efficient pattern matching for virus detection
- Database Organization: Support for Daily and Main virus signature databases
- Real-time Logging: Monitor scanning progress and results
- Signature Details: View detailed information about detected threats
- Operating System: Windows (XP/7/8/10/11)
- .NET Framework: .NET Framework 4.5 or higher
- RAM: Minimum 512 MB (2 GB recommended for large databases)
- Disk Space: 500 MB minimum (for virus signatures database)
git clone https://github.com/yourusername/ClamAV_Engine.git
cd ClamAV_EngineOption A: Using Visual Studio
- Open
ClamAV_Engine.slnxin Visual Studio 2015 or later - Build the solution (Ctrl + Shift + B)
- Run the application (F5)
Option B: Using Command Line
cd ClamAV_Engine
msbuild ClamAV_Engine.csproj /p:Configuration=ReleaseThe ClamAV signature database files are required for the application to detect viruses. Follow these steps:
You can download the ClamAV virus signatures from the official ClamAV mirror:
Option 1: Using ClamAV Official Repository
- Visit: https://www.clamav.net/downloads/productive-use-downloads
- Download the latest version of the following files:
main.cvd- Main virus definitionsdaily.cvd- Daily updated definitionssafebrowsing.cvd- SafeBrowsing database (optional)bytecode.cvd- Bytecode signatures (optional)
Option 2: Automated Download (Recommended)
- Install ClamAV command-line tools: https://www.clamav.net/downloads/production
- Run
freshclamutility to download latest signatures automatically
The .cvd files are actually compressed archives (similar to ZIP files). You need to extract them:
Using ClamAV Tools:
# Extract main.cvd
clamunrar main.cvd
# Extract daily.cvd
clamunrar daily.cvdUsing 7-Zip or WinRAR:
- Right-click on
main.cvd→ Open with Archive Manager - Extract all files to a folder
- Repeat for
daily.cvd
Create the following directory structure in your application folder:
ClamAV_Engine/
bin/
Debug/
clamdb/
daily/
[extracted daily database files]
main/
[extracted main database files]
bytecode/
[optional bytecode files]
Detailed Steps:
-
Create a folder named
clamdbinbin/Debug/directory:bin\Debug\clamdb\ -
Create two subfolders inside
clamdb:bin\Debug\clamdb\daily\ bin\Debug\clamdb\main\ -
Extract
daily.cvdcontents and place all.xxxfiles in:bin\Debug\clamdb\daily\ -
Extract
main.cvdcontents and place all.xxxfiles in:bin\Debug\clamdb\main\ -
(Optional) If you have bytecode files, create:
bin\Debug\clamdb\bytecode\And place
.cbcfiles there.
The application will automatically load the database when you:
- Click the "Load Database" button
- Select the
clamdbfolder - The application will display the total number of loaded signatures
Expected format of signature files:
- Files without extension or with numeric extensions (e.g.,
001,002) - Each file contains virus signatures in text format
- The application recognizes signature types by format and content
After extraction, your folder should look like:
clamdb/
├── daily/
│ ├── 001
│ ├── 002
│ ├── 003
│ └── ...
├── main/
│ ├── 001
│ ├── 002
│ ├── 003
│ └── ...
└── bytecode/
├── 3986187.cbc
├── 3986188.cbc
└── ...
- Run the application (
ClamAV_Engine.exe) - Click the "Load Database" button
- Browse to your
clamdbfolder (containsdaily/andmain/subfolders) - Click "OK" to load the signatures
- The status bar will show "Signatures Loaded: [count]"
- Click the "Select File" button
- Choose a file to scan
- Click the "Scan File" button
- Results will appear in the log area
- If threats are detected, they will be listed with:
- Threat name
- Detection type
- Signature information
- Click the "Select Folder" button
- Choose a directory to scan
- Click the "Scan Folder" button
- The application will recursively scan all files in the directory
- Progress will be displayed in real-time
- A summary of results will show at the end
- In the Signatures List window (if available), double-click on any signature
- A details window will open showing:
- Signature name
- Pattern/Hash
- Offset information
- Signature type
- Detection statistics
- Format:
Name:MD5:Size - Example:
Trojan.Win32.Generic:4D01D7B2D4FF4F92A9A7D2B6E8F3C9B1:1024
- Format: Similar to HDB but uses SHA-1 hash
- Format:
Name:MD5:Offset:Size - Detects specific sections of files
- Format:
Name:HexPattern:Offset:Target:SectionType - Pattern matching with hex values
- Complex signatures using logical operators (AND, OR, NOT)
- Can combine multiple conditions
- Unsigned version of LDB signatures
- Signatures for container file metadata
- Used for encrypted/compressed archives
- Whitelisted signatures to prevent false detections
ClamAV_Engine/
├── ClamLib/ # Core ClamAV Engine Library
│ ├── ClamAVEngine.cs # Main scanning engine
│ ├── ClamAVDatabase.cs # Database storage
│ ├── ClamAVSignature.cs # Signature definition
│ ├── ClamAVResult.cs # Scan results
│ ├── AhoCorasickEngine.cs # Pattern matching algorithm
│ ├── AhoCorasickMatcher.cs # Pattern matcher implementation
│ ├── ScanOptions.cs # Scan configuration
│ ├── ScanStatus.cs # Scan status enum
│ ├── SignatureType.cs # Signature type definitions
│ ├── TargetType.cs # Target type (file/folder)
│ └── Helpers/
│ ├── HashHelper.cs # Hash calculation utilities
│ ├── PatternMatcher.cs # Pattern matching helpers
│ ├── ExpressionEvaluator.cs # Logical expression evaluation
│ └── TargetTypeHelper.cs # Target type utilities
├── Form1.cs # Main scanning interface
├── Form2.cs # Secondary interface/dialogs
├── Program.cs # Application entry point
├── App.config # Application configuration
├── ClamAV_Engine.csproj # Project file
└── Properties/ # Assembly information
- Verify the folder structure matches the expected format:
clamdb/daily/contains signature filesclamdb/main/contains signature files
- Check that the database files have read permissions
- Ensure database files are not corrupted
- Confirm the database loading was successful (check the signatures count)
- Verify your test file matches a known signature pattern
- Check the application log for any error messages
- Large databases may take time to load (first load is slower)
- Scanning large directories takes proportional time
- Consider using the daily database only for faster scanning
- Reduce the database size (use daily database only)
- Scan smaller directories instead of entire drives
- Increase available system RAM
- Visual Studio 2015 or later
- .NET Framework 4.5 or higher SDK
- Git (optional, for cloning)
# Clone the repository
git clone https://github.com/yourusername/ClamAV_Engine.git
cd ClamAV_Engine
# Build Release version
msbuild ClamAV_Engine.csproj /p:Configuration=Release /p:Platform="Any CPU"
# Output will be in bin/Release/- Project source code: Released under the MIT License.
- ClamAV signature databases (main/daily/bytecode) are not included in this repository. When you download and use official ClamAV signatures, you must comply with the ClamAV GPL licensing terms and any accompanying COPYING/README files.
- Trademarks: ClamAV is a trademark of its respective owner; this project is an independent implementation for educational/use-case purposes.
- ClamAV Signatures: Provided by ClamAV Foundation
- Aho-Corasick Algorithm: String matching algorithm for pattern detection
For more information about ClamAV:
- Official Website: https://www.clamav.net/
- Documentation: https://docs.clamav.net/
- Signature Format: https://docs.clamav.net/Signatures
- v1.0.0 - Initial release
- File and folder scanning
- ClamAV signature support
- Multiple signature format support
- Database loading and management
Last Updated: January 2026 Tested On: Windows 10/11, .NET Framework 4.5+

