windows安全日志分析
- 格式:docx
- 大小:920.08 KB
- 文档页数:6
window安全日志分析
今日服务器遭受入侵,入侵路径回溯:被入侵服务器->跳板机->办公网某主机。因此整理记录windows被入侵相关信息。本文只研究windows安全登录相关日志,介绍三种事件类型(登录,注销,尝试登陆)。通过此日志可查看windows主机是否通过3389远程服务爆破进入。注:windows日志有存储大小限制,有被覆盖的可能。可修改,请自行百度。
1.1 windows日志位置
我的电脑右键管理:
刷选windows安全日志事件ID:4000-4700,登录相关
1.2 三种登录事件详解
1.2.1 事件4648(尝试登陆)
事件4648描述:
此事件发生在日志所在windows主机,表明日志所在windows主机尝试连接远程主机,无论连接成功与否,这里都会记录。
网络地址端口:经测试发现只有同一局域网(且同一C段)才会记录目标服务器ip端口。
1.2.2 事件4624(登陆成功)
事件4624描述:表示日志所在win主机被成功连接
“使用者”:指明本地系统上请求登录的帐户。这通常是一个服务(例如Server 服务)或本地进程(例如Winlogon.exe 或Services.exe)。
“登录类型”:指明发生的登录种类。最常见的类型是2 (交互式)和3 (网络)。(登陆类型3:例如连接共享文件,打印机等;登陆类型7:解锁;登陆类型10:例如远程桌面等参考连接:/s/blog_5c39a08901012uu5.html)
“新登录”:指明新登录是为哪个帐户创建的,即登录的帐户。
“网络信息”:指明远程登录请求来自哪里。“工作站名”并非总是可用,而且在某些情况下可能会留为空白。
1.2.3 事件4634(注销)
1.3 日志分析工具log_parser_lizard
工具介绍:
一个Log Parser的图形版,功能强大(可能需要安全相关依赖,我一开始安装了Log Parser)使用参考连接: /post/2012/03/26/Useful-tool-Log-Parser-Lizard-GUI.aspx
下载地址:https:///lizardlabsdataUS/LogParserLizardSetup.msi
获取15天免费key,需要注册邮箱:
https:///forms/d/e/1FAIpQLSeB09sSTV_kxMpHcWpxp5CFBFh_fE8SRRKm2E F0v3Chsk_3fA/viewform
工具界面:
执行查询:
我这里把相关安全日志单独copy一份,下面是我执行的语句:
相应字段:
执行结果:
strings难以查看,导出excel后,使用python处理了一下:
#! /usr/bin/python
# _*_ coding:utf-8 _*_
import xlrd
import xlwt
import time
workbook = xlrd.open_workbook('zhangsan.xlsx')
sheet = workbook.sheets()[0]
nrows = sheet.nrows
ncols = sheet.ncols
workbook1 = xlwt.Workbook()
sheet1 = workbook1.add_sheet('my sheet')
sheet1.write(0, 0, u'时间')
sheet1.write(0, 1, u'事件ID')
sheet1.write(0, 2, u'事件类型')
sheet1.write(0, 3, u'描述')
for i in range(1, nrows):
row = sheet.row_values(i)
timegenerated = xlrd.xldate_as_tuple(row[0], 0)
timegenerated = '{}/{}/{} {}:{}:{}'.format(timegenerated[0], timegenerated[1], timegenerated[2], timegenerated[3], timegenerated[4], timegenerated[5])
eventid = int(row[1])
string = str(row[2]).split('|')
if eventid == 4648:
event_type = u'尝试登录'
account_name01 = string[1]
account_domain01 = string[2]
account_name02 = string[5]
account_domain02 = string[6]
destination_servername01 = string[8]
ip_addr01 = string[12]
result = u'使用者:{}:{},凭证:{}:{},目标服务器:{},网络信息:{}'.format(account_name01, account_domain01, account_name02, account_domain02,
destination_servername01,
ip_addr01)
elif eventid == 4624:
event_type = u'登录成功'
account_name11 = string[1]
account_domain11 = string[2]
account_name12 = string[5]
account_domain12 = string[6]
login_type11 = string[8]
workstation11 = string[11]
ip_addr11 = string[18]
result = u'使用者:{}:{},登录用户:{}:{},登录类型:{},网络信息:{}:{}'.format(account_name11, account_domain11, account_name12, account_domain12, login_type11,
workstation11, ip_addr11)
elif eventid == 4634:
event_type = u'注销'
account_name21 = string[1]
account_domain21 = string[2]
login_type21 = string[4]
result = u'使用者:{}:{},登录类型:{}'.format(account_name21, account_domain21, login_type21)
else:
result = string
# print i, timegenerated, eventid, result
sheet1.write(i, 0, timegenerated)
sheet1.write(i, 1, eventid)
sheet1.write(i, 2, event_type)
sheet1.write(i, 3, result)
workbook1.save('zhanghang.xls')
最终处理结果如下:
希望此文可以给关注windows主机的同学提供一些新的思路。