Hey there! This is my cybersecurity internship project. Basically, it's a lightweight Python tool that watches folders, logs file transfers, checks for file tampering using SHA-256 hashes, and shouts alerts if someone moves sensitive files where they aren't supposed to go (like a random USB or external folder).
- File Logging: Keeps track of when files are created, moved, or modified.
- Integrity Checks: Generates SHA-256 hashes so you can tell if a file got messed with or corrupted.
- Unauthorized Movement Detection: Triggers an alert if sensitive extensions (like
.env,.pem,.xlsx) get dumped into restricted folders. - Audit Trail: Dumps everything into an
audit_trail.logfile so you have proof.
secure_file_monitor/
│
├── monitor.py # The main engine watching the folder
├── integrity.py # Handles the SHA-256 hashing logic
├── logger.py # Handles console colors and writing to audit_trail.log
└── monitored_folder/ # The sandbox folder being watched
1. Clone or download this repo & open your terminal inside the folder:
cd secure_file_monitor2. Install dependencies:
You only need watchdog for tracking file system events.
pip install watchdog psutil3. Run the script:
python monitor.pyIt will automatically create a folder called monitored_folder. Drop some files in there, move them around, and watch the terminal work its magic!
- Run
python monitor.py. - Drop a regular text file inside
monitored_folder-> Check the console for the hash log. - Make a subfolder named
external_usbinsidemonitored_folder. - Drop a file named
config.envin there and drag it into the USB folder -> Boom! Red alert.
- Python (Cuz it's awesome and fast to write)
- Watchdog library (For real-time file system monitoring)
- Hashlib (For SHA-256 integrity checksums)
Feel free to fork or use this as a base for your own security projects! Peace out. ✌️