LoginSignup
0
2

More than 3 years have passed since last update.

Windows EventLogをjson形式に変換する

Last updated at Posted at 2020-06-11

Overview

Windows EventLogをElasticSearchにimportする
Windows EventLogをElasticSearchにimportする(のを100倍早くする)

の続きです.

昨年evtx形式のファイルをElasticsearchにインデックスするライブラリをつくったんですが,
poetryにリプレースした(機能追加もした)ついでにPyPIにアップロードしたのでその記録です.

Usage

$ evtx2json /path/to/your/file.evtx /path/to/output/target.json
from typing import List
from evtx2es import evtx2json

if __name__ == '__main__':
  filepath = '/path/to/your/file.evtx'
  result: List[dict] = evtx2json(filepath)

コマンドとして使う場合には evtx2json 変換したいファイル 変換後jsonのパス という使い方でOKです.

pythonから読み込む場合にはjsonに一回吐き出すよりも辞書型でreturnされるほうが便利かな〜と思ったのでそうしてます.
返り値は各レコードのdictがlistになったものです.

evtx2esというライブラリのevtx2jsonという機能です. ややこしいですね.
オマケ機能だしリポジトリ分けるほどのものでもないので...機能が肥大化したら考えます.

Installation

$ pip install evtx2es

Evaluation

案の定JPCERTくんのサンプルを使用しました
PCによって違うのであくまで目安で...

$ evtx2json Security.evtx output.json                                                                                                                                                                                                                          
Converting Security.evtx
125it [00:07, 15.94it/s]

30MBくらいのファイルの変換に7秒でした.
う〜む, そこそこ速い?

お わ り

0
2
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2