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

Function decloakToTemp

lib/core/common.py:5131–5155  ·  view source on GitHub ↗

Decloaks content of a given file to a temporary file with similar name and extension NOTE: using in-memory decloak() in docTests because of the "problem" on Windows platform >>> decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.asp_")).startswith(b'<%') True >>>

(filename)

Source from the content-addressed store, hash-verified

5129 raise SqlmapGenericException(errMsg)
5130
5131def decloakToTemp(filename):
5132 """
5133 Decloaks content of a given file to a temporary file with similar name and extension
5134
5135 NOTE: using in-memory decloak() in docTests because of the "problem" on Windows platform
5136
5137 >>> decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.asp_")).startswith(b'<%')
5138 True
5139 >>> decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoors", "backdoor.asp_")).startswith(b'<%')
5140 True
5141 >>> b'sys_eval' in decloak(os.path.join(paths.SQLMAP_UDF_PATH, "postgresql", "linux", "64", "11", "lib_postgresqludf_sys.so_"))
5142 True
5143 """
5144
5145 content = decloak(filename)
5146
5147 parts = os.path.split(filename[:-1])[-1].split('.')
5148 prefix, suffix = parts[0], '.' + parts[-1]
5149 handle, filename = tempfile.mkstemp(prefix=prefix, suffix=suffix)
5150 os.close(handle)
5151
5152 with openFile(filename, "w+b", encoding=None) as f:
5153 f.write(content)
5154
5155 return filename
5156
5157def prioritySortColumns(columns):
5158 """

Callers 3

writeFileMethod · 0.90
udfSetLocalPathsMethod · 0.90
udfSetLocalPathsMethod · 0.90

Calls 4

decloakFunction · 0.90
openFileFunction · 0.85
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…