Skip to main content

vamp-entropy-watch

Real-time Shannon entropy monitor for early ransomware detection and encrypted file analysis
VampSecure Labs · Security Research Division


Overview

vamp-entropy-watch monitors directories for ransomware activity by computing the Shannon entropy of files as they are created or modified. Encrypted content approaches the theoretical maximum of 8 bits/byte and is statistically distinguishable from plaintext (~3–5 bits/byte) and even from legitimately compressed data (~7–7.5 bits/byte). When a file exceeds the configured entropy threshold, the tool raises an alert and optionally moves the file to a quarantine directory with read-only permissions to contain further damage.

It operates in two modes: a continuous monitor mode with a live Rich terminal table, and a one-shot scan mode for point-in-time audits and CI/CD pipeline integration.

Features

  • Shannon entropy calculation per file: H(X) = −Σ P(xᵢ) · log₂ P(xᵢ) over all 256 byte values; reads up to 1 MB per file for performance on large datasets
  • Four entropy levels: ENCRYPTED (≥ threshold, default 7.0) / HIGH (≥ 88% of threshold) / MEDIUM (≥ 5.0) / SAFE (< 5.0)
  • Continuous monitor mode with mtime/size change detection and configurable polling interval; displays a live-updating Rich table sorted by entropy descending
  • Automatic quarantine — moves alert-triggering files to a configurable quarantine directory and sets them read-only (0o444) to prevent further modification; collision-safe naming with timestamp prefix
  • One-shot scan mode — processes all files in the target directory once, prints the entropy table, and optionally exports JSON output sorted by entropy descending
  • Recursive directory support via --recursive flag in both modes
  • Default extension exclusions for already-compressed/binary formats (.jpg, .zip, .gz, .exe, .dll, etc.) that would generate spurious alerts
  • Configurable entropy threshold — adjust to match the specific file corpus: --threshold 7.5 for stricter detection, --threshold 6.5 for broader coverage
  • JSON export with per-file entropy, status label, size in bytes, and scan metadata
  • Unified VSL client report (HTML/PDF) via --report-html / --report-pdf in both modes

Requirements

pip install -r requirements.txt
Package Version
rich >= 13.7.0

Standard library: argparse, json, math, os, shutil, sys, time, datetime, pathlib.

Installation

git clone https://github.com/belky-me/vamp-entropy-watch.git
cd vamp-entropy-watch
pip install -r requirements.txt

Usage

python vamp_entropy_watch.py --help

Two subcommands are available: monitor and scan.

usage: vamp-entropy-watch {monitor,scan} ...

subcommands:
  monitor   Continuous directory surveillance
  scan      One-shot entropy audit

Examples

Continuously monitor the current directory with default threshold (7.0):

python vamp_entropy_watch.py monitor

Monitor a specific path, recursive, with quarantine enabled:

python vamp_entropy_watch.py monitor -p /data/uploads -r --quarantine /data/quarantine

Monitor without automatic quarantine (alert-only mode):

python vamp_entropy_watch.py monitor -p /var/www --no-quarantine

Monitor with a stricter threshold and 5-second polling interval:

python vamp_entropy_watch.py monitor -p /home --threshold 7.5 --interval 5

One-shot scan, recursive, export results to JSON:

python vamp_entropy_watch.py scan -p /srv/data -r -o entropy_report.json

One-shot scan with lowered threshold for broader suspicious-file coverage:

python vamp_entropy_watch.py scan -p . --threshold 6.5

Entropy Level Reference

Label Entropy Range Typical Content
ENCRYPTED ≥ 7.0 (configurable) Ransomware output, AES/ChaCha ciphertext
HIGH ≥ ~6.2 Dense binary, some archive formats
MEDIUM ≥ 5.0 Mixed binary/text, executables
SAFE < 5.0 Plaintext, source code, HTML

Output Formats

Format Flag Description
Console (Rich) (default) Live table with per-file entropy, status, size, and detection time
JSON -o FILE (scan mode) Structured report with scan metadata and file list sorted by entropy

Exit Codes

Code Meaning
0 No files exceeded the alert threshold
1 One or more files exceeded the alert threshold

Part of VampSecure Labs Toolkit

This tool is part of the VampSecure Labs Security Toolkit — a collection of research-grade security tools for authorized penetration testing and red/blue team exercises.


© VampSecure Studios — VampSecure Labs Security Research Division
For authorized security testing only.

Metadata

Release files for vamp-entropy-watch 2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vamp-entropy-watch 2.1
File Size Uploaded
vamp_entropy_watch-2.1.tar.gz 22.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vamp-entropy-watch 2.1
File Interpreter ABI Platform
vamp_entropy_watch-2.1-py3-none-any.whl Python 3 none any Details

Total release size: 46.7 kB

Release files / vamp_entropy_watch-2.1.tar.gz

Download URL vamp_entropy_watch-2.1.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6cb4ff9d6745e1cc15923957ce6e96785c69421eac6349db445f2fc2a04d7d68
BLAKE2b-256 checksum
How to use checksums
44862a9442549eba0847f1a55d4a1e564bf6aa1e31788d09ba372461a2de6029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / vamp_entropy_watch-2.1-py3-none-any.whl

Download URL vamp_entropy_watch-2.1-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd8ba84fd87f08a3b7874ab4e1ec1a4fa2f543816e18515589ee6046bd94ed86
BLAKE2b-256 checksum
How to use checksums
0a279b0899b68d918a900e59d456625f9e235ce09745b79b766ecbd2b6214de8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

2.2

2 release files

This release

2.1 This release

2 release files

2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page