Skip to content

Commit 574ab5c

Browse files
committed
remove redifination of hexdump() function in two files
1 parent 6c9a1aa commit 574ab5c

File tree

2 files changed

+2
-47
lines changed

2 files changed

+2
-47
lines changed

examples/ntfs-read.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,8 @@
4343
from datetime import datetime
4444
from impacket.examples import logger
4545
from impacket import version
46-
from impacket.structure import Structure
47-
48-
49-
def pretty_print(x):
50-
visible = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '
51-
return x if x in visible else '.'
52-
53-
def hexdump(data):
54-
x = str(data)
55-
strLen = len(x)
56-
i = 0
57-
while i < strLen:
58-
print("%04x " % i, end=' ')
59-
for j in range(16):
60-
if i+j < strLen:
61-
print("%02X" % ord(x[i+j]), end=' ')
62-
else:
63-
print(" ", end=' ')
64-
if j%16 == 7:
65-
print("", end=' ')
66-
print(" ", end=' ')
67-
print(''.join(pretty_print(x) for x in x[i:i+16] ))
68-
i += 16
46+
from impacket.structure import Structure, hexdump
47+
6948

7049
# Reserved/fixed MFTs
7150
FIXED_MFTS = 16

impacket/ese.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -430,30 +430,6 @@ def __init__(self,data):
430430
Structure.__init__(self,data)
431431

432432

433-
#def pretty_print(x):
434-
# if x in '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ ':
435-
# return x
436-
# else:
437-
# return '.'
438-
#
439-
#def hexdump(data):
440-
# x=str(data)
441-
# strLen = len(x)
442-
# i = 0
443-
# while i < strLen:
444-
# print "%04x " % i,
445-
# for j in range(16):
446-
# if i+j < strLen:
447-
# print "%02X" % ord(x[i+j]),
448-
#
449-
# else:
450-
# print " ",
451-
# if j%16 == 7:
452-
# print "",
453-
# print " ",
454-
# print ''.join(pretty_print(x) for x in x[i:i+16] )
455-
# i += 16
456-
457433
def getUnixTime(t):
458434
t -= 116444736000000000
459435
t //= 10000000

0 commit comments

Comments
 (0)