操作系统日志

一、常见日志类型及位置

系统类型    日志路径    关键日志文件
Linux    /var/log/    auth.log/secure(认证日志)
syslog/messages(系统日志)
btmp(失败登录)
wtmp(登录历史)
Windows    C:\Windows\System32\winevt\Logs\    Security.evtx(安全事件)
System.evtx
Application.evtx

二、技巧

1. 确定日志类型

Linux文本日志:直接用grep、awk、sed分析。

Windows EVTX:需专用工具(如evtxdump、Event Viewer或Python库evtx)。

2. 过滤关键事件

Linux示例:

# 查找SSH暴力破解
grep "Failed password" /var/log/auth.log
# 分析登录成功的IP
grep "Accepted password" auth.log | awk '{print $11}' | sort -u

Windows EVTX示例(使用evtxdump):

evtxdump Security.evtx | grep "4625"  # 登录失败事件ID

3. 关注高频事件ID(Windows)

事件ID    含义
4624    登录成功
4625    登录失败
4672    特权登录(管理员)
7045    服务安装(后门可疑)

4. 时间线分析

按时间排序日志,还原攻击顺序:

# Linux:按时间戳排序
grep "Failed password" auth.log | sort -k 1,2
# Windows:用Event Viewer的时间轴功能

5. 用户与进程异常

检查可疑用户:

# Linux:新增用户
grep "new user" /var/log/auth.log

异常进程创建(Windows事件ID 4688):

evtxdump Security.evtx | grep "4688" | grep "cmd.exe"

6. 文件/日志篡改痕迹

日志被删除? 检查日志中断时间戳。

Linux隐藏操作:查找history文件或/tmp目录异常文件。

7. 工具自动化分析

Linux工具:

logwatch:日志摘要报告

goaccess:Web日志分析

Windows工具:

Event Viewer(图形化)

Zimmerman Tools(evtxcmd命令行)

通用工具:

grep/awk:快速过滤

ELK Stack(大型日志)

无标签
评论区
头像