| 95 | return output |
| 96 | |
| 97 | def webUpload(self, destFileName, directory, stream=None, content=None, filepath=None): |
| 98 | if filepath is not None: |
| 99 | if filepath.endswith('_'): |
| 100 | content = decloak(filepath) # cloaked file |
| 101 | else: |
| 102 | with openFile(filepath, "rb", encoding=None) as f: |
| 103 | content = f.read() |
| 104 | |
| 105 | if content is not None: |
| 106 | stream = io.BytesIO(getBytes(content)) # string content |
| 107 | |
| 108 | # Reference: https://github.com/sqlmapproject/sqlmap/issues/3560 |
| 109 | # Reference: https://stackoverflow.com/a/4677542 |
| 110 | stream.seek(0, os.SEEK_END) |
| 111 | stream.len = stream.tell() |
| 112 | stream.seek(0, os.SEEK_SET) |
| 113 | |
| 114 | return self._webFileStreamUpload(stream, destFileName, directory) |
| 115 | |
| 116 | def _webFileStreamUpload(self, stream, destFileName, directory): |
| 117 | stream.seek(0) # Rewind |