diff --git a/pwnlib/tubes/tube.py b/pwnlib/tubes/tube.py index 8168ad2fd..a97e23ab0 100644 --- a/pwnlib/tubes/tube.py +++ b/pwnlib/tubes/tube.py @@ -1168,7 +1168,11 @@ def upload_manually(self, data, target_path = './payload', prompt = b'$', chunk_ compressed_path = target_path + '.xz' elif compression_mode == 'gzip': import gzip - compressed_data = gzip.compress(data, compresslevel=9) + from six import BytesIO + with BytesIO() as f: + with gzip.GzipFile(fileobj=f, mode='wb', compresslevel=9) as g: + g.write(data) + compressed_data = f.getvalue() compressed_path = target_path + '.gz' else: compressed_path = target_path