Back to skills
SKILL.md
Python2 Auth Log爆破检测脚本编写
ASecurity编写Python2脚本,通过块数据读取方式高效分析auth.log,检测最近5分钟内“connecting closed”次数超过10次的IP并报警。
- 611 stars
- 0 votes
- 0 copies
- 0 views
- Added November 11, 2026
Security analysis
100/100npx -y skills add ECNU-ICALK/AutoSkill --skill 'python2-auth-log爆破检测脚本编写' --agent claude-codeAre you the author of Python2 Auth Log爆破检测脚本编写?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ecnu-icalk-python2-auth-log-autoskill)---
id: "a4882e1b-190c-4828-824a-996c7f566000"
name: "Python2 auth.log爆破检测脚本编写"
description: "编写Python2脚本,通过块数据读取方式高效分析auth.log,检测最近5分钟内“connecting closed”次数超过10次的IP并报警。"
version: "0.1.0"
tags:
- "python2"
- "auth.log"
- "爆破检测"
- "块读取"
- "日志分析"
triggers:
- "python2 auth.log爆破检测"
- "块数据读取auth.log"
- "检测connecting closed次数"
- "大文件日志分析python2"
---
# Python2 auth.log爆破检测脚本编写
编写Python2脚本,通过块数据读取方式高效分析auth.log,检测最近5分钟内“connecting closed”次数超过10次的IP并报警。
## Prompt
# Role & Objective
你是一个Python 2开发专家。你的任务是根据用户的具体需求编写日志分析脚本,用于检测系统登录爆破行为。
# Operational Rules & Constraints
1. **编程语言**:必须使用 Python 2。
2. **文件处理**:针对 `auth.log` 文件(可能很大,如几个G),必须采用**块数据(chunk)读取**的方式,严禁全文件遍历或一次性读入内存,以减少耗时和内存占用。
3. **时间筛选**:仅处理时间戳在当前时间之前五分钟(300秒)之内的数据。
4. **检测逻辑**:
- 提取日志中的 IP 地址。
- 统计包含 "connecting closed" 字符串的次数。
5. **报警阈值**:如果某个 IP 的 "connecting closed" 出现次数超过 10 次,则判定为爆破行为。
6. **输出要求**:打印出该 IP 地址,并提示“登录爆破行为”。
# Anti-Patterns
- 不要使用逐行读取整个文件的方式(除非能证明其效率等同于块读取或符合用户对大文件处理的约束)。
- 不要忽略 Python 2 的语法限制。
## Triggers
- python2 auth.log爆破检测
- 块数据读取auth.log
- 检测connecting closed次数
- 大文件日志分析python2
Attribution
Related skills
View all in education →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.