Created
February 11, 2020 14:54
-
-
Save foone/f59635def9e7fe73a3f2cdd86b9752d7 to your computer and use it in GitHub Desktop.
WeirdZip: identify zipfiles with weird compression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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