How can I protect myself from a zip bomb?
Question: I just read about [zip bombs](http://en.wikipedia.org/wiki/Zip%5Fbomb), i.e.
zip files that contain very large amount of highly compressible data
(00000000000000000...).

When opened they fill the server's disk.

How can I detect a zip file is a zip bomb **before** unzipping it?

**UPDATE** Can you tell me how is this done in Python or Java?


Answer: Try this in Python:

    
    
    import zipfile
    z = zipfile.ZipFile('c:/a_zip_file')
    print 'total files size=', sum(e.file_size for e in z.infolist())
    z.close()
    

