Skip to content
gamster01Public

About

Context-aware lightweight security monitoring with local LLM analysis

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Gamtinel

A context-aware, lightweight security monitoring system for resource-constrained, single-operator environments (personal NAS, home labs, small-infrastructure setups).

Gamtinel collects logs from a few hosts, filters out noise, groups related events into attack sessions, and uses a local LLM to analyze each session in context and produce a Korean-language threat report. It is designed to run in the background on an ordinary laptop without a dedicated SOC or an enterprise SIEM.

Status: personal research / hobby project. Not production-hardened.

Why

Enterprise SIEM/SOAR stacks assume large budgets, high-spec dedicated infrastructure, and a staffed security team to tune rules. A single operator running a NAS or a home lab has none of those, and ends up relying on default rule sets that produce heavy false positives. Gamtinel explores whether a local LLM can take over the context-reading part of a human analyst's job — reading a 10-minute window of events and judging whether it is normal operation, automated noise, or a real attack — cheaply enough to run alongside everything else on one machine.

How it works

 logs (NAS / Ubuntu / honeypot)
      │
      ▼
 Scanner ──► Parser ──► PreFilter ──► SessionBuilder ──► local LLM ──► Markdown report
                         (noise cut,     (groups events      (Ollama)      + SQLite record
                          WAF aggregate)  into sessions,
                                          kill-chain checks)
  • Scanner — picks up new log files from a sync folder (catch-up on start, then every 5 minutes).
  • Parser — normalizes NAS/Ubuntu syslog, auth, eBPF, and nginx-WAF JSON logs, plus Cowrie honeypot logs.
  • PreFilter — drops routine daemon noise and aggregates high-volume WAF logs; flags WAF bypass and fuzzing patterns.
  • SessionBuilder — groups events by source into time-bounded sessions and runs kill-chain cross-checks (e.g. WAF pass-through followed by a web-daemon shell command).
  • LLM analysis — a local Ollama model classifies each expired session (tactical 10-minute view) or subnet (24-hour strategic view) and writes a report.
  • Storage — SQLite with WAL mode; short-term raw events, threat alerts, and processing state. A web dashboard (Dashboard.py) reads from it.

Requirements

  • Python 3.9+
  • Ollama running locally with a model pulled (default: llama3.1)
  • Python packages: requests, psutil, plyer (optional, for desktop notifications)
pip install requests psutil plyer
ollama pull llama3.1

Configuration

Gamtinel reads configuration from environment variables. All are optional.

Variable Default Purpose
GAMTINEL_SYNC_ROOT ~/Gamtinel_Sync Root folder where host logs are synced
GAMTINEL_WORK_DIR ~/Project_Gamtinel Working dir for DB, reports, temp files
GAMTINEL_LLM_URL http://localhost:11434 Ollama endpoint
GAMTINEL_LLM_MODEL llama3.1 Model name
GAMTINEL_ADMIN_NAME Operator Operator name used in the LLM prompt context

Expected sync-folder layout (see the comments at the bottom of Gamtinel.py):

<SYNC_ROOT>/NAS_Logs/YYYY-MM-DD/{system,conn}_hhmm.log
<SYNC_ROOT>/Ubuntu_Logs/YYYY-MM-DD/{syslog,auth,ebpf,nginx_waf}_hhmm.log
<SYNC_ROOT>/Honeypot_Logs/cowrie_backup_YYYYMMDD_0830.tar.gz

Usage

# 1. create your rule set from the example
cp rules.txt.example rules.txt      # Windows: copy rules.txt.example rules.txt

# 2. run
python Gamtinel.py

On start it runs a one-time catch-up pass over pending logs, then switches to a passive mode that re-scans every 5 minutes. Press Enter during the startup delay to skip the wait. Reports are written to <WORK_DIR>/reports/ as Markdown.

What is NOT in this repository

For safety, operational data is excluded via .gitignore and must never be committed:

  • gamtinel.db and WAL/SHM files — contain real attacker/host IPs and captured payloads
  • rules.txt — the live detection rule set (only rules.txt.example is published)
  • reports/ — generated reports with real IPs and attack content
  • any *.log, honeypot archives, or synced log folders

If you clone and run this, keep your own rules.txt and data local.

Notes / limitations

  • The msvcrt-based startup key check is Windows-only; on other platforms remove or guard that block.
  • Detection thresholds (WAF bypass, fuzzing, kill-chain timing) are tuned for a low-traffic single-host setup and will need adjustment elsewhere.
  • LLM output quality depends entirely on the local model you run.

License

No license yet. If you intend others to reuse this, add one (e.g. MIT).

About

Context-aware lightweight security monitoring with local LLM analysis

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages