From 574ab5c254ba8a0bdd20347c5aca157302266de8 Mon Sep 17 00:00:00 2001 From: Alex Romero Date: Fri, 12 Jan 2024 12:43:04 -0500 Subject: [PATCH] remove redifination of hexdump() function in two files --- examples/ntfs-read.py | 25 ++----------------------- impacket/ese.py | 24 ------------------------ 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/examples/ntfs-read.py b/examples/ntfs-read.py index 01bf5ee9ff..ca1d0fe752 100755 --- a/examples/ntfs-read.py +++ b/examples/ntfs-read.py @@ -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 diff --git a/impacket/ese.py b/impacket/ese.py index 1f36483aeb..cc258ea152 100644 --- a/impacket/ese.py +++ b/impacket/ese.py @@ -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