AlexPGAO/honeyfile-watcher
حول
Real-time intrusion detection system that monitors honeypot files and sends instant Discord alerts when unauthorized access is detected. Built for Homelabs.
الأمان والخصوصيةالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- +٤
- خلال 15 يومًا
- +٤
- خلال شهر
- +٤
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصل🍯 Honeyfile Monitor v2
Decoy-file intrusion detection for Linux homelabs. Plants convincing
fake files (real .xlsx/.docx, not renamed text), watches them 24/7,
and fires Discord/email alerts with host context the moment anything
touches them. Every event lands in SQLite and a SIEM-ready JSON-lines
log, with a built-in terminal-style dashboard.
Built and tested on Raspberry Pi. One runtime dependency (watchdog) —
everything else, including the Office file generators, is standard library.
Quick start
git clone https://github.com/AlexPGAO/honeyfile-monitor.git
cd honeyfile-monitor
pip install .
honeyfile init # writes config.toml + .env
nano config.toml # set your decoy paths
nano .env # paste your Discord webhook URL
honeyfile deploy # generates the decoy files (real xlsx/docx, backdated)
honeyfile watch # go
Test it from another terminal:
echo tamper >> ~/Desktop/CreditCards_2026.xlsx
You get a console alert, a Discord embed (if configured), a row in
SQLite, and a line in events.jsonl.
CLI
| Command | What it does |
|---|---|
honeyfile init |
Create config.toml and .env skeleton |
honeyfile deploy |
Generate any missing decoy files (--force to regenerate) |
honeyfile watch |
Run the monitor |
honeyfile events -n 20 |
Print recent events from the database |
honeyfile dashboard -o dash.html |
Render the HTML dashboard |
honeyfile dashboard --serve |
Live dashboard at http://127.0.0.1:8777 |
honeyfile test-alert [--send] |
Fire a fake event through the whole pipeline |
Configuration
Everything lives in one TOML file. Secrets never go in it — they come
from environment variables or a .env next to the config:
[monitor]
cooldown_seconds = 10 # coalesce editor event storms
log_file = "~/.honeyfile/events.jsonl" # SIEM-ready JSON lines
db_file = "~/.honeyfile/events.db" # powers events + dashboard
[[honeyfiles]]
path = "~/Desktop/CreditCards_2026.xlsx"
type = "xlsx" # xlsx | docx | csv | txt
[[honeyfiles]]
path = "~/Documents/passwords_backup.docx"
type = "docx"
[alerts.discord]
enabled = true
mention_everyone = false
# .env (gitignored)
HONEYFILE_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
HONEYFILE_EMAIL_PASSWORD=your-app-password
Decoy generation
honeyfile deploy builds real Office files by writing the OOXML zip
structure directly with the standard library — no openpyxl, no
python-docx. An attacker who opens the spreadsheet sees an actual
spreadsheet. Files are backdated 45–400 days so they look established,
not freshly planted. All data is fake; card numbers intentionally fail
Luhn validation.
Alert pipeline
Each (debounced) event fans out to:
- Console — formatted alert if running in a terminal
events.jsonl— one flat JSON object per line; point Wazuh, Splunk, or Filebeat at it and every field arrives pre-parsed- SQLite — history for
honeyfile eventsand the dashboard - Discord — rich embed with proper fields (respects Discord limits)
- Email — optional SMTP
Editors like vim fire 3–6 filesystem events per save; the per-file, per-event-type cooldown collapses those into a single alert that notes how many duplicates it absorbed.
Dashboard
honeyfile dashboard --serve gives a live view: totals, last-24h count,
events-by-type chart, and a filterable event log — dark terminal
aesthetic, single self-contained HTML file, zero JS dependencies.
Deployment
systemd (recommended on the Pi): see
examples/honeyfile.service — includes
sandboxing directives (ProtectSystem=strict, NoNewPrivileges).
Docker: see the Dockerfile. Mount the watched
directories into the container.
What this can and can't attribute (honest limits)
inotify-level monitoring tells you what happened and when, plus host context (hostname, IP, logged-in users, connection count) — but a filesystem event does not carry the identity of the process or user that caused it. v1 labeled the watcher's own UID as "the file accessor", which was wrong; v2 labels host context as exactly that. Real accessor attribution (PID/UID/executable of the touching process) requires auditd or fanotify and is the headline feature planned for v3.
Also inherent to this approach: reads don't trigger inotify events via
watchdog — cat on the decoy is invisible. Same v3 roadmap item.
Changelog: v1 → v2
- Fixed: Discord placeholder guard typo (
YOUER_...) that let unconfigured webhooks attempt real POSTs — replaced with URL validation - Fixed: decoy "xlsx" was CSV plaintext — now generates genuine OOXML files
- Fixed: misleading "file accessor" attribution — labels now honest
- Fixed: alert storms from editor saves — debounce/coalescing added
- Fixed: MOVED events now match both source and destination paths
- Fixed: SQLite cross-thread access (watchdog dispatches from its observer thread)
- New: multiple honeyfiles, decoy generator, TOML config +
.envsecrets, SQLite store, JSON-lines SIEM log, HTML dashboard, proper packaging (pip install,honeyfileCLI), test suite, GitHub Actions CI, Docker, hardened systemd unit - Removed:
requestsdependency (Discord viaurllib)
Development
pip install -e ".[dev]"
pytest tests -v # or: python -m unittest discover tests -v
License
MIT
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…