Skip to content

Commit

Permalink
bug fix issue #1675 (#1680)
Browse files Browse the repository at this point in the history
* bugfix #1675 __str__

* bug fix __str__ returns bytes
  • Loading branch information
NtAlexio2 authored Apr 11, 2024
1 parent 5cb9dbb commit cba9632
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions impacket/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from __future__ import print_function
from struct import pack, unpack, calcsize
from six import b, PY3
from binascii import hexlify


class Structure:
""" sublcasses can define commonHdr and/or structure.
Expand Down Expand Up @@ -160,7 +162,7 @@ def fromString(self, data):
data = data[size:]

return self

def __setitem__(self, key, value):
self.fields[key] = value
self.data = None # force recompute
Expand All @@ -170,9 +172,9 @@ def __getitem__(self, key):

def __delitem__(self, key):
del self.fields[key]

def __str__(self):
return self.getData()
return hexlify(self.getData())

def __len__(self):
# XXX: improve
Expand Down

0 comments on commit cba9632

Please sign in to comment.