A Python-based file integrity monitoring tool that uses SHA-256 hashes to detect added, modified, and deleted files.
This project was built to move beyond theory and practice a core security concept: file integrity monitoring.
Instead of only checking whether a file exists, the tool creates a cryptographic fingerprint for every monitored file and compares those fingerprints during later scans.
┌──────────────────┐
│ Monitored Files │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ SHA-256 Hash │
└────────┬─────────┘
│
┌────────────┴────────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Baseline │ │ Current Scan │
│ JSON │ │ Hashes │
└──────┬───────┘ └──────┬───────┘
│ │
└────────────┬────────────┘
▼
┌──────────────────┐
│ Comparison │
└────────┬─────────┘
▼
Added / Modified / Deleted
Clone the repository:
git clone https://github.com/btwsalts/file-integrity-monitor.git
cd file-integrity-monitor
Create a test directory:
mkdir -p monitored
echo "important data" > monitored/example.txt
Create a baseline:
python3 src/fim.py baseline monitored
Scan the directory later:
python3 src/fim.py scan monitored
If a file changes:
echo "changed data" > monitored/example.txt
python3 src/fim.py scan monitored
Example output:
FILE INTEGRITY SCAN
────────────────────────────────
[!] MODIFIED example.txt
────────────────────────────────
Files scanned: 1
Unchanged: 0
Modified: 1
Added: 0
Deleted: 0
python3 -m unittest discover -s tests -v
GitHub Actions also runs the test suite automatically on pushes and pull requests.
file-integrity-monitor/
├── .github/
│ └── workflows/
│ └── tests.yml
├── src/
│ └── fim.py
├── tests/
│ └── test_fim.py
├── .gitignore
├── PROJECT_OVERVIEW.md
├── README.md
└── requirements.txt
SHA-256 provides a strong cryptographic fingerprint for detecting file-content changes, but the baseline must be treated as trusted data.
For stronger real-world protection, a production system could use a digitally signed or externally protected baseline and send scan results to a separate logging system.
Building this project gave me hands-on practice with:
This project is intended for learning, experimentation, and local file monitoring. It is not a replacement for a dedicated enterprise file integrity monitoring or endpoint security platform.