|
47 | 47 | from lib.core.exception import SqlmapNoneDataException |
48 | 48 | from lib.core.settings import BACKDOOR_RUN_CMD_TIMEOUT |
49 | 49 | from lib.core.settings import EVENTVALIDATION_REGEX |
| 50 | +from lib.core.settings import SHELL_RUNCMD_EXE_TAG |
| 51 | +from lib.core.settings import SHELL_WRITABLE_DIR_TAG |
50 | 52 | from lib.core.settings import VIEWSTATE_REGEX |
51 | 53 | from lib.request.connect import Connect as Request |
52 | 54 | from thirdparty.oset.pyoset import oset |
@@ -134,7 +136,7 @@ def _webFileStreamUpload(self, stream, destFileName, directory): |
134 | 136 |
|
135 | 137 | def _webFileInject(self, fileContent, fileName, directory): |
136 | 138 | outFile = posixpath.join(ntToPosixSlashes(directory), fileName) |
137 | | - uplQuery = getUnicode(fileContent).replace("WRITABLE_DIR", directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory) |
| 139 | + uplQuery = getUnicode(fileContent).replace(SHELL_WRITABLE_DIR_TAG, directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory) |
138 | 140 | query = "" |
139 | 141 |
|
140 | 142 | if isTechniqueAvailable(kb.technique): |
@@ -324,7 +326,7 @@ def webInit(self): |
324 | 326 |
|
325 | 327 | with open(filename, "w+b") as f: |
326 | 328 | _ = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.%s_" % self.webApi)) |
327 | | - _ = _.replace("WRITABLE_DIR", utf8encode(directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory)) |
| 329 | + _ = _.replace(SHELL_WRITABLE_DIR_TAG, utf8encode(directory.replace('/', '\\\\') if Backend.isOs(OS.WINDOWS) else directory)) |
328 | 330 | f.write(_) |
329 | 331 |
|
330 | 332 | self.unionWriteFile(filename, self.webStagerFilePath, "text", forceCheck=True) |
@@ -369,7 +371,7 @@ def webInit(self): |
369 | 371 | continue |
370 | 372 |
|
371 | 373 | _ = "tmpe%s.exe" % randomStr(lowercase=True) |
372 | | - if self.webUpload(backdoorName, backdoorDirectory, content=backdoorContent.replace("WRITABLE_DIR", backdoorDirectory).replace("RUNCMD_EXE", _)): |
| 374 | + if self.webUpload(backdoorName, backdoorDirectory, content=backdoorContent.replace(SHELL_WRITABLE_DIR_TAG, backdoorDirectory).replace(SHELL_RUNCMD_EXE_TAG, _)): |
373 | 375 | self.webUpload(_, backdoorDirectory, filepath=os.path.join(paths.SQLMAP_EXTRAS_PATH, "runcmd", "runcmd.exe_")) |
374 | 376 | self.webBackdoorUrl = "%s/Scripts/%s" % (self.webBaseUrl, backdoorName) |
375 | 377 | self.webDirectory = backdoorDirectory |
|
0 commit comments