LogParse Windows系統日誌分析

2022-01-24 02:39:02 字數 4186 閱讀 7965

本文將對常見的日誌型別,利用微軟日誌分析工具(logparser)結合已經掌握的惡意**分析windows系統日誌,關聯出系統的異常。

資料**於windows的事件檢視器中的*.evtx檔案,eventvwr.msc。

除此之外還要關注木馬病毒的資訊

安全日誌登入部分的事件 id 和登入型別**都具有一定含義:

event id(2000/xp/2003)

event id(vista/7/8/2008/2012)

描述528

4624

成功登入

5294625

失敗登入

6804776

成功/失敗的賬戶認證

6244720

建立使用者

6364732

新增使用者到啟用安全性的本地組中

6324728

新增使用者到啟用安全性的全域性組中

2934

7030

服務建立錯誤

2944

7040

ipsec服務服務的啟動型別已從禁用更改為自動啟動

2949

7045

服務建立

登入型別

登入型別描述2

interactive

使用者登入到本機

3network

使用者或計算手機從網路登入到本機,如果網路共享,或使用 net use 訪問網路共享,net view 檢視網路共享

4batch

批處理登入型別,無需使用者干預

5service

服務控制管理器登入

7unlock

使用者解鎖主機

8networkcleartext

使用者從網路登入到此計算機,使用者密碼用非雜湊的形式傳遞

9newcredentials

程序或執行緒轉殖了其當前令牌,但為出站連線指定了新憑據

10remotelnteractive

使用終端服務或遠端桌面連線登入

11cachedlnteractive

使用者使用本地儲存在計算機上的憑據登入到計算機(域控制器可能無法驗證憑據),如主機不能連線域控,以前使用域賬戶登入過這台主機,再登入就會產生這樣日誌

12cachedremotelnteractive

與 remotelnteractive 相同,內部用於審計目的

13cachedunlock

登入嘗試解鎖

1、得到已經發現webshell、遠控木馬的建立時間

2、搜尋登錄檔資訊,通過登錄檔資訊獲取登錄檔鍵值建立時間再找出同一時間建立的檔案。

3、整合檔案建立的時間、登錄檔鍵值建立時間找出的新檔案時間整合分析系統日誌,把整個行為關聯起來。

-i:evt是指定分析的日誌,也可以分析csv 、iisw3c 等日誌格式。

# 網格顯示

logparser.exe –i:evt –o:datagrid 「select * from security.evtx」

# csv顯示

logparser.exe –i:evt –o:datagrid 「select * from security.evtx」

logparse直接sql語句,詳細sql語句使用說明在自帶的chm說明裡。結合分組、提取語句就可以統計出源ip,時間,使用者名稱。

只需要取出關鍵列進行判斷或者比對,就可以從龐大的windows安全日誌中提取出安全事件發生後想要關聯的資訊。

extract_token(列名,字段數,『分隔符』)

extract_token(strings, 8, '|')

輸出結果:

欄位名 as 別名

logparser.exe -i:evt -o:datagrid "select timegenerated as logintime from security.evtx where eventid=4624"

輸出結果:

使用timestamp('年-月-日', 'yyyy-mm-dd')函式

logparser.exe -i:evt -o:datagrid "select * from security.evtx where to_date(timegenerated) between timestamp('2018-10-17', 'yyyy-mm-dd') and timestamp('2018-10-27', 'yyyy-mm-dd')" -rtp:-1
logparser.exe -i:evt -o:datagrid "select * from security.evtx where to_time(timegenerated) between timestamp('13:33:00', 'hh:mm:ss') and timestamp('13:35:00', 'hh:mm:ss')" -rtp:-1
4624是登入成功的id資訊,指定某個關鍵列中的事件id顯示出結果。

logparser.exe -i:evt -o:datagrid "select timegenerated as logintime,extract_token(strings,5,'|') as username,extract_token(strings, 8, '|') as logontype,extract_token(strings, 17, '|') as processname,extract_token(strings, 18, '|') as sourceip from security.evtx where eventid=4624「
security日誌篩選出登入成功的事件(4624)中的登入時間、使用者名稱、登入型別、程序名、源ip。

關注點:

1、管理員登入時間段是不是正常時間

2、木馬執行的時間和管理員登入時間對不對應

語句:

logparser.exe -i:evt -o:datagrid "select timegenerated as logintime,extract_token(strings,5,'|') as username,extract_token(strings, 8, '|') as logontype,extract_token(strings, 17, '|') as processname,extract_token(strings, 18, '|') as sourceip from security.evtx where eventid=4624 and to_date(timegenerated) between timestamp('2018-10-17', 'yyyy-mm-dd') and timestamp('2018-10-27', 'yyyy-mm-dd')" -rtp:-1
system日誌關注點:

1、時間段

2、服務名、服務路徑

語句:

logparser.exe -i:evt -o:datagrid "select timewritten,eventid,eventtype,eventtypename,sourcename,extract_token(strings,0,'|') as service_name,extract_token(strings,1,'|') as service_path,message from system.evtx where to_date(timegenerated) between timestamp('2018-10-19', 'yyyy-mm-dd') and timestamp('2018-10-20', 'yyyy-mm-dd')" -rtp:-1"
關注點:

1、程式執行時間
語句:

用logparser分析windows日誌

windows 系統安全事件應急響應

logparser: filter records for specific time frame/date

日誌 syslog系統日誌

原創 2017年02月17日 20 47 05 前言 本文列出了在linux系統下的幾個日誌檔案。以及結合message中的日誌記錄,作出了簡單分析。syslog是linux系統預設的日誌守護程序。預設的syslog配置檔案是 etc sysctl.conf檔案 通常,syslog 接受來自系統的各...

python logging yaml日誌分割

1 建立log.yaml檔案 version 1 disable existing loggers false formatters format asctime s filename s levelname s message s datefmt f t handlers console clas...

Poco 日誌 之 系統日誌

poco 支援windows 事件日誌.僅支援win poco autoptrlog new poco eventlogchannel log open poco message msg msg.setsource 1111 msg.settext 333 msg.setpriority poco ...