Skip to content

Commit 6734d70

Browse files
author
Willi Ballenthin
committed
views: xml views return strings, not bytes
1 parent eda25be commit 6734d70

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

Evtx/Views.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def rec(node, acc):
134134
return "".join(acc)
135135

136136

137-
138137
def _build_record_xml(record, cache=None):
139138
"""
140139
Note, the cache should be local to the Evtx.Chunk.
@@ -167,7 +166,7 @@ def rec(root_node):
167166

168167
def evtx_record_xml_view(record, cache=None):
169168
"""
170-
Generate an UTF-8 XML representation of an EVTX record.
169+
Generate an XML representation of an EVTX record.
171170
172171
Note, the cache should be local to the Evtx.Chunk.
173172
Do not share caches across Chunks.
@@ -178,12 +177,12 @@ def evtx_record_xml_view(record, cache=None):
178177
"""
179178
if cache is None:
180179
cache = {}
181-
return _build_record_xml(record, cache=cache).encode("utf8", "xmlcharrefreplace")
180+
return _build_record_xml(record, cache=cache)
182181

183182

184183
def evtx_chunk_xml_view(chunk):
185184
"""
186-
Generate UTF-8 XML representations of the records in an EVTX chunk.
185+
Generate XML representations of the records in an EVTX chunk.
187186
188187
Does not include the XML <?xml... header.
189188
Records are ordered by chunk.records()
@@ -194,12 +193,12 @@ def evtx_chunk_xml_view(chunk):
194193
cache = {}
195194
for record in chunk.records():
196195
record_str = _build_record_xml(record, cache=cache)
197-
yield record_str.encode("utf8", "xmlcharrefreplace"), record
196+
yield record_str, record
198197

199198

200199
def evtx_file_xml_view(file_header):
201200
"""
202-
Generate UTF-8 XML representations of the records in an EVTX file.
201+
Generate XML representations of the records in an EVTX file.
203202
204203
Does not include the XML <?xml... header.
205204
Records are ordered by file_header.chunks(), and then by chunk.records()
@@ -211,7 +210,7 @@ def evtx_file_xml_view(file_header):
211210
cache = {}
212211
for record in chunk.records():
213212
record_str = _build_record_xml(record, cache=cache)
214-
yield record_str.encode("utf8", "xmlcharrefreplace"), record
213+
yield record_str, record
215214

216215

217216
def evtx_template_readable_view(root_node, cache=None):

0 commit comments

Comments
 (0)