将Windows事件日志(.evtx)快速导入Elasticsearch。
evtx2es的Python项目详细描述
Evtx2es公司
将Windows事件日志(.evtx)快速导入Elasticsearch。在
生命太短暂,没有足够的时间用pure Python软件处理hurge Windows EventLogs
evtx2es使用Rust库pyevtx-rs,因此它比传统软件运行速度快得多。在
Note:
2020.06.12
I've published to PyPI!
https://pypi.org/project/evtx2es/
使用
^{pr2}$或者
fromevtx2esimportevtx2esif__name__=='__main__':filepath='/path/to/your/file.evtx'evtx2es(filepath)
参数
evtx2es支持多个文件输入,所有参数都被确定为文件路径。在
$ evtx2es file1.evtx file2.evtx file3.evtx
或者
$ tree .
evtxfiles/
├── file1.evtx
├── file2.evtx
├── file3.evtx
└── subdirectory/
├── file4.evtx
└── subsubdirectory/
├── file5.evtx
└── file6.evtx
$ evtx2es /evtxfiles/ # The Path is recursively expanded to file1~6.evtx.
选项
--host:
ElasticSearch host address
(default: localhost)
--port:
ElasticSearch port number
(default: 9200)
--index:
Index name
(default: evtx2es)
--size:
bulk insert size
(default: 500)
--scheme:
Scheme to use (http, or https)
(default: http)
示例
$ evtx2es /path/to/your/file.evtx --host=localhost --port=9200 --index=foo --size=500
if__name__=='__main__':evtx2es('/path/to/your/file.evtx',host=localhost,port=9200,index='foo',size=500)
额外的
Evtx2json
额外功能。:寿司::寿司::寿司:
从Windows事件日志转换为json文件。在
$ evtx2json /path/to/your/file.evtx /path/to/output/target.json
或者
fromevtx2esimportevtx2jsonif__name__=='__main__':filepath='/path/to/your/file.evtx'result:List[dict]=evtx2json(filepath)
输出格式
以JPCERT/CC:LogonTracer的示例evtx文件为例。在
[
{
"event_record_id": 227559,
"timestamp": "2016-10-06 01:50:49.420927 UTC",
"winlog": {
"channel": "Security",
"computer_name": "WIN-WFBHIBE5GXZ.example.co.jp",
"event_id": 4624,
"opcode": 0,
"provider_guid": "{54849625-5478-4994-a5ba-3e3b0328c30d}",
"provider_name": "Microsoft-Windows-Security-Auditing",
"record_id": 227559,
"task": 12544,
"version": 0,
"process": {
"pid": 572,
"thread_id": 1244
},
"event_data": {
"AuthenticationPackageName": "Kerberos",
"IpAddress": "192.168.16.102",
"IpPort": "49220",
"KeyLength": 0,
"LmPackageName": "-",
"LogonGuid": "F4DC1C19-0544-BC52-0900-DFC19752C3C6",
"LogonProcessName": "Kerberos",
"LogonType": 3,
"ProcessId": 0,
"ProcessName": "-",
"SubjectDomainName": "-",
"SubjectLogonId": "0x0",
"SubjectUserName": "-",
"SubjectUserSid": "S-1-0-0",
"TargetDomainName": "EXAMPLE",
"TargetLogonId": "0x1fa0869",
"TargetUserName": "WIN7_64JP_02$",
"TargetUserSid": "S-1-5-21-1524084746-3249201829-3114449661-1107",
"TransmittedServices": "-",
"WorkstationName": "",
"Status": null
}
},
"log": {
"file": {
"name": "sample/Security.evtx"
}
},
"event": {
"code": 4624,
"created": "2016-10-06T01:50:49.420927Z"
},
"@timestamp": "2016-10-06T01:50:49.420927Z"
},
...
]
绩效评估
使用JPCERT/CC:LogonTracer(大约30MB二进制数据)的示例evtx文件评估evtx2es。在
$ time evtx2es ./Security.evtx > 6.25 user 0.13 system 0:14.08 elapsed 45%CPU
有关详细信息,请参见Qiita。在
运行环境
OS: Ubuntu 18.04
CPU: Intel Core i5-6500
RAM: DDR4 32GB
ElasticSearch 7.4在Docker版本(官方图片)上运行。
https://hub.docker.com/_/elasticsearch
安装
通过pip
$ pip install evtx2es
evtx2es的源代码托管在GitHub上,您可以从这个存储库(https://github.com/sumeshi/evtx2es)下载、派生和查看它。在
请报告问题和功能请求。:寿司::寿司::寿司:
许可证
evtx2es是在MIT许可下发布的。在
- 项目
标签: