Skip to content

Instantly share code, notes, and snippets.

@foone
Created February 11, 2020 14:54
Show Gist options
  • Select an option

  • Save foone/f59635def9e7fe73a3f2cdd86b9752d7 to your computer and use it in GitHub Desktop.

Select an option

Save foone/f59635def9e7fe73a3f2cdd86b9752d7 to your computer and use it in GitHub Desktop.
WeirdZip: identify zipfiles with weird compression
from zipfile import ZipFile,BadZipfile
import sys
BORING_COMPRESSION = (0,1,2,3,4,5,6,8,14)
for path in sys.argv[1:]:
try:
zipf = ZipFile(path, 'r')
except BadZipfile:
continue
for info in zipf.infolist():
if info.compress_type not in BORING_COMPRESSION:
print sys.argv[1], info.filename, info.compress_type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment