Analyzing web server logs for intrusion

From killvxk/cybersecurity-skills-zh · View interactive version

Analyzing web server logs for intrusion is an AI agent skill from the GitHub repository killvxk/cybersecurity-skills-zh. 解析 Apache 和 Nginx 访问日志,检测 SQL 注入(SQL Injection)尝试、本地文件包含(Local File Inclusion)、 目录遍历(Directory Traversal)、Web 扫描器指纹及暴力破解(Brute Force)模式。 使用基于正则表达式的模式匹配对照 OWASP 攻击签名、GeoIP 富化进行来源溯源, 以及针对请求频率和响应大小异常值的统计异常检测。

How to use this skill

Skill file

操作说明

  1. 安装依赖:pip install geoip2 user-agents
  2. 以 Combined Log Format(Apache)或 Nginx 默认格式收集 Web 服务器访问日志。
  3. 解析每条日志条目,提取:IP、时间戳、方法、URI、状态码、响应大小、user-agent、referer。
  4. 应用检测规则:
  1. 用 GeoIP 数据富化,生成按优先级排序的发现报告。
python scripts/agent.py --log-file /var/log/nginx/access.log --geoip-db GeoLite2-City.mmdb --output web_intrusion_report.json

示例

在 URI 中检测 SQL 注入(SQLi)

192.168.1.100 - - [15/Jan/2024:10:30:45 +0000] "GET /products?id=1' UNION SELECT username,password FROM users-- HTTP/1.1" 200 4532

扫描器 User-Agent 检测

Nikto/2.1.6, sqlmap/1.7, DirBuster-1.0-RC1, gobuster/3.1.0
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.