Skip to content

Instantly share code, notes, and snippets.

@primiano
Last active June 2, 2017 17:46
Show Gist options
  • Save primiano/7556d7df5dd9ace60dbe1164f2ed24b2 to your computer and use it in GitHub Desktop.
Save primiano/7556d7df5dd9ace60dbe1164f2ed24b2 to your computer and use it in GitHub Desktop.
Dumps offsets of files within a zip file
import zipfile, sys
zip = zipfile.ZipFile(sys.argv[1])
for f in zip.infolist():
# I have no idea about the +2 but observed experimentally that it gets us
# to the right place.
print('%-16x %-10d %s' % (f.header_offset + len(f.FileHeader()) + 2, f.compress_size, f.filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment