mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-18 04:20:35 +03:00
sqlmap does not save nor leave back in temporary folder any file named 'sqlmapRANDOM', only random names now, less suspicious
This commit is contained in:
parent
42f53f380f
commit
694356821d
|
@ -463,7 +463,7 @@ def randomInt(length=4):
|
||||||
|
|
||||||
return int("".join([random.choice(string.digits) for _ in xrange(0, length)]))
|
return int("".join([random.choice(string.digits) for _ in xrange(0, length)]))
|
||||||
|
|
||||||
def randomStr(length=5, lowercase=False):
|
def randomStr(length=4, lowercase=False):
|
||||||
"""
|
"""
|
||||||
@param length: length of the random string.
|
@param length: length of the random string.
|
||||||
@type length: C{int}
|
@type length: C{int}
|
||||||
|
|
|
@ -531,7 +531,7 @@ class Metasploit:
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
self.__randStr = randomStr(lowercase=True)
|
self.__randStr = randomStr(lowercase=True)
|
||||||
self.__shellcodeFilePath = os.path.join(conf.outputPath, "sqlmapmsf%s" % self.__randStr)
|
self.__shellcodeFilePath = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
||||||
|
|
||||||
self.__initVars()
|
self.__initVars()
|
||||||
self.__prepareIngredients(encode=encode, askChurrasco=False)
|
self.__prepareIngredients(encode=encode, askChurrasco=False)
|
||||||
|
@ -580,7 +580,7 @@ class Metasploit:
|
||||||
self.__randStr = randomStr(lowercase=True)
|
self.__randStr = randomStr(lowercase=True)
|
||||||
|
|
||||||
if kb.os == "Windows":
|
if kb.os == "Windows":
|
||||||
self.exeFilePathLocal = os.path.join(conf.outputPath, "sqlmapmsf%s.exe" % self.__randStr)
|
self.exeFilePathLocal = os.path.join(conf.outputPath, "tmpm%s.exe" % self.__randStr)
|
||||||
|
|
||||||
# Metasploit developers added support for the old exe format
|
# Metasploit developers added support for the old exe format
|
||||||
# to msfencode using '-t exe-small' (>= 3.3.3-dev),
|
# to msfencode using '-t exe-small' (>= 3.3.3-dev),
|
||||||
|
@ -593,7 +593,7 @@ class Metasploit:
|
||||||
else:
|
else:
|
||||||
self.__fileFormat = "exe"
|
self.__fileFormat = "exe"
|
||||||
else:
|
else:
|
||||||
self.exeFilePathLocal = os.path.join(conf.outputPath, "sqlmapmsf%s" % self.__randStr)
|
self.exeFilePathLocal = os.path.join(conf.outputPath, "tmpm%s" % self.__randStr)
|
||||||
self.__fileFormat = "elf"
|
self.__fileFormat = "elf"
|
||||||
|
|
||||||
if initialize:
|
if initialize:
|
||||||
|
@ -684,7 +684,7 @@ class Metasploit:
|
||||||
|
|
||||||
def smb(self):
|
def smb(self):
|
||||||
self.__initVars()
|
self.__initVars()
|
||||||
self.__randFile = "sqlmapunc%s.txt" % randomStr(lowercase=True)
|
self.__randFile = "tmpu%s.txt" % randomStr(lowercase=True)
|
||||||
|
|
||||||
self.__forgeMsfConsoleResource()
|
self.__forgeMsfConsoleResource()
|
||||||
self.__forgeMsfConsoleCmd()
|
self.__forgeMsfConsoleCmd()
|
||||||
|
|
|
@ -41,8 +41,8 @@ class Registry:
|
||||||
self.__regData = regData
|
self.__regData = regData
|
||||||
|
|
||||||
self.__randStr = randomStr(lowercase=True)
|
self.__randStr = randomStr(lowercase=True)
|
||||||
self.__batPathRemote = "%s/sqlmapreg%s%s.bat" % (conf.tmpPath, self.__operation, self.__randStr)
|
self.__batPathRemote = "%s/tmpr%s%s.bat" % (conf.tmpPath, self.__operation, self.__randStr)
|
||||||
self.__batPathLocal = os.path.join(conf.outputPath, "sqlmapreg%s%s.bat" % (self.__operation, self.__randStr))
|
self.__batPathLocal = os.path.join(conf.outputPath, "tmpr%s%s.bat" % (self.__operation, self.__randStr))
|
||||||
|
|
||||||
if parse:
|
if parse:
|
||||||
readParse = "FOR /F \"tokens=2* delims==\" %%A IN ('REG QUERY \"" + self.__regKey + "\" /v \"" + self.__regValue + "\"') DO SET value=%%A\r\nECHO %value%\r\n"
|
readParse = "FOR /F \"tokens=2* delims==\" %%A IN ('REG QUERY \"" + self.__regKey + "\" /v \"" + self.__regValue + "\"') DO SET value=%%A\r\nECHO %value%\r\n"
|
||||||
|
|
|
@ -167,11 +167,11 @@ class Web:
|
||||||
directories = list(directories)
|
directories = list(directories)
|
||||||
directories.sort()
|
directories.sort()
|
||||||
|
|
||||||
backdoorName = "tmpb%s.%s" % (randomStr(4), self.webApi)
|
backdoorName = "tmpb%s.%s" % (randomStr(lowercase=True), self.webApi)
|
||||||
backdoorStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoor.%s_" % self.webApi), backdoorName)
|
backdoorStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, "backdoor.%s_" % self.webApi), backdoorName)
|
||||||
originalBackdoorContent = backdoorContent = backdoorStream.read()
|
originalBackdoorContent = backdoorContent = backdoorStream.read()
|
||||||
|
|
||||||
uploaderName = "tmpu%s.%s" % (randomStr(4), self.webApi)
|
uploaderName = "tmpu%s.%s" % (randomStr(lowercase=True), self.webApi)
|
||||||
uploaderContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "uploader.%s_" % self.webApi))
|
uploaderContent = decloak(os.path.join(paths.SQLMAP_SHELL_PATH, "uploader.%s_" % self.webApi))
|
||||||
|
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
|
@ -200,7 +200,7 @@ class Web:
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
if self.webApi == "asp":
|
if self.webApi == "asp":
|
||||||
runcmdName = "tmpe%s.exe" % randomStr(4)
|
runcmdName = "tmpe%s.exe" % randomStr(lowercase=True)
|
||||||
runcmdStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, 'runcmd.exe_'), runcmdName)
|
runcmdStream = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_SHELL_PATH, 'runcmd.exe_'), runcmdName)
|
||||||
match = re.search(r'input type=hidden name=scriptsdir value="([^"]+)"', uplPage)
|
match = re.search(r'input type=hidden name=scriptsdir value="([^"]+)"', uplPage)
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ class xp_cmdshell:
|
||||||
def xpCmdshellEvalCmd(self, cmd, first=None, last=None):
|
def xpCmdshellEvalCmd(self, cmd, first=None, last=None):
|
||||||
self.getRemoteTempPath()
|
self.getRemoteTempPath()
|
||||||
|
|
||||||
tmpFile = "%s/sqlmapevalcmd%s.txt" % (conf.tmpPath, randomStr(lowercase=True))
|
tmpFile = "%s/tmpc%s.txt" % (conf.tmpPath, randomStr(lowercase=True))
|
||||||
cmd = self.xpCmdshellForgeCmd("%s > %s" % (cmd, tmpFile))
|
cmd = self.xpCmdshellForgeCmd("%s > %s" % (cmd, tmpFile))
|
||||||
|
|
||||||
self.xpCmdshellExecCmd(cmd)
|
self.xpCmdshellExecCmd(cmd)
|
||||||
|
|
|
@ -390,7 +390,7 @@ class MySQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
|
||||||
self.createSupportTbl(self.fileTblName, self.tblField, "longtext")
|
self.createSupportTbl(self.fileTblName, self.tblField, "longtext")
|
||||||
self.getRemoteTempPath()
|
self.getRemoteTempPath()
|
||||||
|
|
||||||
tmpFile = "%s/sqlmapfilehex%s" % (conf.tmpPath, randomStr(lowercase=True))
|
tmpFile = "%s/tmpf%s" % (conf.tmpPath, randomStr(lowercase=True))
|
||||||
|
|
||||||
debugMsg = "saving hexadecimal encoded content of file '%s' " % rFile
|
debugMsg = "saving hexadecimal encoded content of file '%s' " % rFile
|
||||||
debugMsg += "into temporary file '%s'" % tmpFile
|
debugMsg += "into temporary file '%s'" % tmpFile
|
||||||
|
@ -537,7 +537,7 @@ class MySQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
|
||||||
|
|
||||||
def udfSetLocalPaths(self):
|
def udfSetLocalPaths(self):
|
||||||
self.udfLocalFile = paths.SQLMAP_UDF_PATH
|
self.udfLocalFile = paths.SQLMAP_UDF_PATH
|
||||||
self.udfSharedLibName = "libsqlmapudf%s" % randomStr(lowercase=True)
|
self.udfSharedLibName = "libs%s" % randomStr(lowercase=True)
|
||||||
|
|
||||||
if kb.os == "Windows":
|
if kb.os == "Windows":
|
||||||
self.udfLocalFile += "/mysql/windows/lib_mysqludf_sys.dll"
|
self.udfLocalFile += "/mysql/windows/lib_mysqludf_sys.dll"
|
||||||
|
|
|
@ -395,7 +395,7 @@ class PostgreSQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeove
|
||||||
|
|
||||||
def udfSetLocalPaths(self):
|
def udfSetLocalPaths(self):
|
||||||
self.udfLocalFile = paths.SQLMAP_UDF_PATH
|
self.udfLocalFile = paths.SQLMAP_UDF_PATH
|
||||||
self.udfSharedLibName = "libsqlmapudf%s" % randomStr(lowercase=True)
|
self.udfSharedLibName = "libs%s" % randomStr(lowercase=True)
|
||||||
|
|
||||||
self.getVersionFromBanner()
|
self.getVersionFromBanner()
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ class Filesystem:
|
||||||
back-end DBMS underlying file system
|
back-end DBMS underlying file system
|
||||||
"""
|
"""
|
||||||
|
|
||||||
randScr = "sqlmapfile%s.scr" % randomStr(lowercase=True)
|
randScr = "tmpf%s.scr" % randomStr(lowercase=True)
|
||||||
chunkName = randomStr(lowercase=True)
|
chunkName = randomStr(lowercase=True)
|
||||||
fileScrLines = self.__binDataToScr(binaryData, chunkName)
|
fileScrLines = self.__binDataToScr(binaryData, chunkName)
|
||||||
forgedScrLines = []
|
forgedScrLines = []
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Takeover(Abstraction, Metasploit, Registry):
|
||||||
tmpFile = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_CONTRIB_PATH, "tokenkidnapping", "Churrasco.exe_"))
|
tmpFile = decloakToNamedTemporaryFile(os.path.join(paths.SQLMAP_CONTRIB_PATH, "tokenkidnapping", "Churrasco.exe_"))
|
||||||
|
|
||||||
wFile = tmpFile.name
|
wFile = tmpFile.name
|
||||||
self.churrascoPath = "%s/sqlmapchur%s.exe" % (conf.tmpPath, randomStr(lowercase=True))
|
self.churrascoPath = "%s/tmpc%s.exe" % (conf.tmpPath, randomStr(lowercase=True))
|
||||||
self.cmdFromChurrasco = True
|
self.cmdFromChurrasco = True
|
||||||
|
|
||||||
self.writeFile(wFile, self.churrascoPath, "binary", confirm=False)
|
self.writeFile(wFile, self.churrascoPath, "binary", confirm=False)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user