Skip to content

Commit 5ec3136

Browse files
1 parent 24e248a commit 5ec3136

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

Evtx/Nodes.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,40 @@ def verify(self):
602602
self.token() & 0x0F == SYSTEM_TOKENS.CDataSectionToken
603603

604604

605+
class CharacterReferenceNode(BXmlNode):
606+
"""
607+
The binary XML node for the system token 0x08.
608+
609+
This is an character reference node. That is, something that represents
610+
a non-XML character, eg. & --> 8.
611+
"""
612+
def __init__(self, buf, offset, chunk, parent):
613+
super(CharacterReferenceNode, self).__init__(buf, offset, chunk, parent)
614+
self.declare_field("byte", "token", 0x0)
615+
self.declare_field("word", "entity")
616+
self._tag_length = 3
617+
618+
def __repr__(self):
619+
return "CharacterReferenceNode(buf={!r}, offset={!r}, chunk={!r}, parent={!r})".format(
620+
self._buf, self.offset(), self._chunk, self._parent)
621+
622+
def __str__(self):
623+
return "CharacterReferenceNode(offset={}, length={}, token={})".format(
624+
hex(self.offset()), hex(self.length()), hex(0x08))
625+
626+
def entity_reference(self):
627+
return '&#x%04x;' % (self.entity())
628+
629+
def flags(self):
630+
return self.token() >> 4
631+
632+
def tag_length(self):
633+
return self._tag_length
634+
635+
def children(self):
636+
return []
637+
638+
605639
class EntityReferenceNode(BXmlNode):
606640
"""
607641
The binary XML node for the system token 0x09.
@@ -1531,7 +1565,7 @@ def string(self):
15311565
ValueNode,
15321566
AttributeNode,
15331567
CDataSectionNode,
1534-
None,
1568+
CharacterReferenceNode,
15351569
EntityReferenceNode,
15361570
ProcessingInstructionTargetNode,
15371571
ProcessingInstructionDataNode,

0 commit comments

Comments
 (0)