Mini-HIDS
Stop brute-force IPs and suspicious web payloads on a small Linux server in minutes, without deploying a full SIEM or heavyweight EDR stack.
GitHub profile
Mini-HIDS is a lightweight Linux host intrusion detection tool built with the Python standard library. It focuses on three things that are easy to operationalize on small servers:
- Detect repeated SSH login failures with a sliding time window
- Detect obvious web attack payloads from access logs
- Scan common script files for suspicious webshell patterns
It also exposes both a JSON CLI and a minimal MCP server, so AI agents can inspect status, read alerts, query the blacklist, and trigger ban or unban actions through a standard tool interface.
Why This Exists
Most open-source security tools are optimized for human operators first. Mini-HIDS is intentionally small enough to understand quickly, script easily, and embed into agent workflows without a large control plane.
This repository is a good fit if you want:
- A single-host defensive tool for VPS or small Linux fleets
- A JSON-first CLI for automation and agent usage
- Simple, inspectable detection logic instead of opaque pipelines
- A local MCP tool server that IDE agents can call directly
This repository is not a good fit if you need:
- Cross-host correlation or centralized SOC workflows
- Kernel telemetry, eBPF, or endpoint prevention
- High-fidelity detection engineering with low false positives
Architecture
mini_hids.py: long-running daemon that tails logs, tracks attack windows, bans IPs, and rescans web rootshids_cli.py: JSON-only control-plane CLI for operators and agentshids_common.py: shared config loading, SQLite helpers, IP validation, and firewall backendsmcp_server.py: stdio MCP adapter that exposes Mini-HIDS actions as agent-callable toolsconfig.json: runtime configuration loaded by both the daemon and the CLIllms.txt: LLM-oriented project map for AI search and coding assistants
Quick Start
git clone https://github.com/netkr/mini-hids.git cd mini-hidsAdjust
config.json, then start the daemon:sudo python3 mini_hids.pyUse the JSON CLI:
python3 hids_cli.py --action status python3 hids_cli.py --action get_alerts --lines 20 python3 hids_cli.py --action get_blacklist python3 hids_cli.py --action ban --ip 192.168.1.100 --reason "manual ban" python3 hids_cli.py --action unban --ip 192.168.1.100Use With AI Agents
Mini-HIDS now ships with a local MCP server. That means tools like Cursor, Claude Desktop, and other MCP-compatible clients can call the project directly instead of shelling out ad hoc.
Run the MCP server:
python3 mcp_server.pyExample client config:
{ "mcpServers": { "mini-hids": { "command": "python3", "args": ["/absolute/path/to/mini-hids/mcp_server.py"] } } }A ready-to-copy sample is also included at
examples/claude_desktop_mcp.json.Available MCP tools:
mini_hids_statusmini_hids_get_alertsmini_hids_get_blacklistmini_hids_ban_ipmini_hids_unban_ip
This is the practical replacement for a fake "one-click deploy" button. Mini-HIDS needs local log access and firewall privileges, so local or server-side MCP integration is the correct deployment model.
CLI Output
All CLI commands return JSON. Example:
{ "success": true, "data": { "is_running": true, "pid": 12345, "firewall_backend": "iptables" } }Requirements
- Python 3.6+
- Linux
- Root privileges for firewall operations and protected log access
- One supported firewall backend:
iptablesnftfail2ban-client
Configuration
Edit
config.jsoninstead of modifying the Python files.{ "LOG_PATHS": { "auth": ["/var/log/auth.log", "/var/log/secure"], "web": ["/var/log/nginx/access.log", "/var/log/apache2/access.log"], "mysql": ["/var/log/mysql/mysql.log", "/var/log/mysql/error.log"] }, "BAN_TIME": 3600, "TRUSTED_IPS": ["127.0.0.1", "192.168.1.1"], "WEB_ROOT": ["/var/www/html", "/var/www"], "BLACKLIST_DB": "blacklist.db", "ALERT_LOG": "hids_alert.log", "PID_FILE": "mini_hids.pid", "MAX_FAILURES": 5, "WINDOW_SECONDS": 300, "CHECK_INTERVAL": 1, "WEBSHELL_SCAN_INTERVAL": 3600 }Notes:
BLACKLIST_DB,ALERT_LOG, andPID_FILEcan be absolute paths. If they are relative, they are created in the project directory.CHECK_INTERVALcontrols how often the daemon checks for expired bans.WEBSHELL_SCAN_INTERVALcontrols how often the daemon rescans web roots.TRUSTED_IPSare never banned by the daemon or the CLI.
Security Notes
- Run the daemon as root if you need firewall enforcement or access to privileged logs.
- Review
TRUSTED_IPScarefully to avoid locking yourself out. - Web attack and webshell detection are heuristic. Treat alerts as signals, not final verdicts.
- MCP clients should be treated as privileged local integrations, since they can trigger ban and unban operations.
Limitations
- Detection is regex-based and intentionally simple.
- The project does not yet ship with automated tests or service packaging.
nftablessupport uses a dedicatedmini_hidstable and timeout-enabled sets, so existing firewall policies should still be reviewed before production use.
v1.2 Release Notes
- Unified runtime configuration loading from config.json with default merging
- Added shared core module for config, firewall, IP validation, and blacklist persistence
- Added SQLite-backed blacklist persistence with automatic recovery and expired-entry cleanup
- Improved ban/unban idempotency and reduced risk of duplicate firewall rules
- Fixed firewall backend detection, including proper nftables support
- Improved daemon scheduling so ban expiry is checked on a short interval
- Added incremental webshell scanning based on file modification time
- Improved log tailing robustness with log rotation handling
- Normalized runtime file paths for blacklist.db, hids_alert.log, and mini_hids.pid
- Added JSON CLI for status, alerts, blacklist inspection, manual ban, and unban
Lightweight Host Intrusion Detection and Log Analysis System (Mini-HIDS)
实时监控Linux日志,AI检测暴力破解、Web攻击和Webshell,自动封禁IP并支持白名单。
本文目录展开
推荐文章
更多本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。
在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。
JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。
在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。
在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。
OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。
Skill 文件
-
SKILL.md
- Mini-HIDS
- GitHub profile
- Why This Exists
- Architecture
- Quick Start
- Use With AI Agents
- CLI Output
- Requirements
- Configuration
- Security Notes
- Limitations
- v1.2 Release Notes
- Mini-HIDS
- 项目或源文件
相关 Skill
更多
service-qa-coach
Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手
>图片识别 直接读取学生手写作答照片,识别公式、符号、步骤
🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设
📊 逐步给分 每个关键步骤独立评分,体现过程分
📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告
🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Traditional Bone Tool Making Basics
Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...

