MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / webUpload

Method webUpload

lib/takeover/web.py:97–114  ·  view source on GitHub ↗
(self, destFileName, directory, stream=None, content=None, filepath=None)

Source from the content-addressed store, hash-verified

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

Callers 3

webInitMethod · 0.95
uploadShellcodeexecMethod · 0.80
uploadIcmpshSlaveMethod · 0.80

Calls 7

_webFileStreamUploadMethod · 0.95
decloakFunction · 0.90
openFileFunction · 0.90
getBytesFunction · 0.90
tellMethod · 0.80
readMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected