码迷,mamicode.com
首页 > 其他好文 > 详细

asd

时间:2019-07-18 13:32:20      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:orm   事件   number   contex   osi   root   parse   int   form   

import mmap
import contextlib

from Evtx.Evtx import FileHeader
from Evtx.Views import evtx_file_xml_view
from xml.dom import minidom

def MyFun():
EvtxPath = "C:\Windows\System32\winevt\Logs\Security.evtx"

with open(EvtxPath,‘r‘) as f:
with contextlib.closing(mmap.mmap(f.fileno(),0,access=mmap.ACCESS_READ)) as buf:
fh = FileHeader(buf,0)
for xml, record in evtx_file_xml_view(fh):
# #只输出事件ID为4624的内容
# InterestEvent(xml,4624)
# print ("")
print("xml:{},record:{}".format(xml,record))



# 过滤掉不需要的事件,输出感兴趣的事件
# def InterestEvent(xml,EventID):
# pass
# # xmldoc = minidom.parseString(xml)
# # # 获取EventID节点的事件ID
# # booknode=root.getElementsByTagName(‘event‘)
# # for booklist in booknode:
# bookdict={}
# bookdict[‘id‘]=booklist.getAttribute(‘id‘)
# bookdict[‘head‘]=booklist.getElementsByTagName(‘head‘)[0].childNodes[0].nodeValue.strip()
# bookdict[‘name‘]=booklist.getElementsByTagName(‘name‘)[0].childNodes[0].nodeValue.strip()
# bookdict[‘number‘]=booklist.getElementsByTagName(‘number‘)[0].childNodes[0].nodeValue.strip()
# bookdict[‘page‘]=booklist.getElementsByTagName(‘page‘)[0].childNodes[0].nodeValue.strip()
# if EventID == eventID:
# print (xml)

if __name__ == ‘__main__‘:
MyFun()

asd

标签:orm   事件   number   contex   osi   root   parse   int   form   

原文地址:https://www.cnblogs.com/cs2612109/p/11206575.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!