Skip to content

Commit

Permalink
remove redifination of hexdump() function in two files
Browse files Browse the repository at this point in the history
  • Loading branch information
NtAlexio2 committed Jan 12, 2024
1 parent 6c9a1aa commit 574ab5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
25 changes: 2 additions & 23 deletions examples/ntfs-read.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,8 @@
from datetime import datetime
from impacket.examples import logger
from impacket import version
from impacket.structure import Structure


def pretty_print(x):
visible = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '
return x if x in visible else '.'

def hexdump(data):
x = str(data)
strLen = len(x)
i = 0
while i < strLen:
print("%04x " % i, end=' ')
for j in range(16):
if i+j < strLen:
print("%02X" % ord(x[i+j]), end=' ')
else:
print(" ", end=' ')
if j%16 == 7:
print("", end=' ')
print(" ", end=' ')
print(''.join(pretty_print(x) for x in x[i:i+16] ))
i += 16
from impacket.structure import Structure, hexdump


# Reserved/fixed MFTs
FIXED_MFTS = 16
Expand Down
24 changes: 0 additions & 24 deletions impacket/ese.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,30 +430,6 @@ def __init__(self,data):
Structure.__init__(self,data)


#def pretty_print(x):
# if x in '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ':
# return x
# else:
# return '.'
#
#def hexdump(data):
# x=str(data)
# strLen = len(x)
# i = 0
# while i < strLen:
# print "%04x " % i,
# for j in range(16):
# if i+j < strLen:
# print "%02X" % ord(x[i+j]),
#
# else:
# print " ",
# if j%16 == 7:
# print "",
# print " ",
# print ''.join(pretty_print(x) for x in x[i:i+16] )
# i += 16

def getUnixTime(t):
t -= 116444736000000000
t //= 10000000
Expand Down

0 comments on commit 574ab5c

Please sign in to comment.