From 38b8eb35610f154ef6d90b0e9be693f832dda0a9 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sun, 26 Jul 2015 19:29:49 +0300 Subject: [PATCH] scripts: Also print entry offset in shadacat.py --- scripts/shadacat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/shadacat.py b/scripts/shadacat.py index c710d0ca95..d29000a5d9 100755 --- a/scripts/shadacat.py +++ b/scripts/shadacat.py @@ -59,9 +59,10 @@ def mnormalize(o): with open(sys.argv[1], 'rb') as fp: - unpacker = msgpack.Unpacker(file_like=fp) + unpacker = msgpack.Unpacker(file_like=fp, read_size=1) while True: try: + pos = fp.tell() typ = EntryTypes(unpacker.unpack()) except msgpack.OutOfData: break @@ -70,5 +71,5 @@ with open(sys.argv[1], 'rb') as fp: time = datetime.fromtimestamp(timestamp) length = unpacker.unpack() entry = unpacker.unpack() - print('{0:13} {1} {2:5} {3!r}'.format( - typ.name, time.isoformat(), length, mnormalize(entry))) + print('{0:4} {1:13} {2} {3:5} {4!r}'.format( + pos, typ.name, time.isoformat(), length, mnormalize(entry)))