mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
working on #392 to fix --os-cmd and --os-shell output parsing
This commit is contained in:
parent
cb6d549e57
commit
2267dd8f47
|
@ -171,7 +171,7 @@ class Xp_cmdshell:
|
||||||
# retrieve the output when OPENROWSET is used hence the redirection
|
# retrieve the output when OPENROWSET is used hence the redirection
|
||||||
# to a temporary file from above
|
# to a temporary file from above
|
||||||
if insertIntoTable and not conf.dbmsCred:
|
if insertIntoTable and not conf.dbmsCred:
|
||||||
self._forgedCmd += "INSERT INTO %s " % insertIntoTable
|
self._forgedCmd += "INSERT INTO %s(data) " % insertIntoTable
|
||||||
|
|
||||||
self._forgedCmd += "EXEC %s @%s" % (self.xpCmdshellStr, self._randStr)
|
self._forgedCmd += "EXEC %s @%s" % (self.xpCmdshellStr, self._randStr)
|
||||||
|
|
||||||
|
@ -205,13 +205,13 @@ class Xp_cmdshell:
|
||||||
inject.goStacked("BULK INSERT %s FROM '%s' WITH (CODEPAGE='RAW', FIELDTERMINATOR='%s', ROWTERMINATOR='%s')" % (self.cmdTblName, self.tmpFile, randomStr(10), randomStr(10)))
|
inject.goStacked("BULK INSERT %s FROM '%s' WITH (CODEPAGE='RAW', FIELDTERMINATOR='%s', ROWTERMINATOR='%s')" % (self.cmdTblName, self.tmpFile, randomStr(10), randomStr(10)))
|
||||||
self.delRemoteFile(self.tmpFile)
|
self.delRemoteFile(self.tmpFile)
|
||||||
|
|
||||||
query = "SELECT %s FROM %s" % (self.tblField, self.cmdTblName)
|
query = "SELECT %s FROM %s ORDER BY id" % (self.tblField, self.cmdTblName)
|
||||||
|
|
||||||
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
|
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
|
||||||
output = inject.getValue(query, resumeValue=False, blind=False, time=False)
|
output = inject.getValue(query, resumeValue=False, blind=False, time=False)
|
||||||
else:
|
else:
|
||||||
output = []
|
output = []
|
||||||
count = inject.getValue("SELECT COUNT(*) FROM %s" % self.cmdTblName, resumeValue=False, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
|
count = inject.getValue("SELECT COUNT(id) FROM %s" % self.cmdTblName, resumeValue=False, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)
|
||||||
|
|
||||||
if isNumPosStrValue(count):
|
if isNumPosStrValue(count):
|
||||||
for index in getLimitRange(count):
|
for index in getLimitRange(count):
|
||||||
|
|
|
@ -119,7 +119,7 @@ class Miscellaneous:
|
||||||
|
|
||||||
def createSupportTbl(self, tblName, tblField, tblType):
|
def createSupportTbl(self, tblName, tblField, tblType):
|
||||||
inject.goStacked("DROP TABLE %s" % tblName, silent=True)
|
inject.goStacked("DROP TABLE %s" % tblName, silent=True)
|
||||||
inject.goStacked("CREATE TABLE %s(%s %s)" % (tblName, tblField, tblType))
|
inject.goStacked("CREATE TABLE %s(id INT PRIMARY KEY IDENTITY, %s %s)" % (tblName, tblField, tblType))
|
||||||
|
|
||||||
def cleanup(self, onlyFileTbl=False, udfDict=None, web=False):
|
def cleanup(self, onlyFileTbl=False, udfDict=None, web=False):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user