Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/takeover/xp_cmdshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ def _xpCmdshellTest(self):

if output == "1":
logger.info("xp_cmdshell extended procedure is usable")
elif isNoneValue(output):
elif isNoneValue(output) and conf.dbmsCred:
errMsg = "it seems that the temporary directory ('%s') used for " % self.getRemoteTempPath()
errMsg += "storing console output within the back-end file system "
errMsg += "does not have writing permissions for the DBMS process. "
errMsg += "You are advised to manually adjust it with option "
errMsg += "--tmp-path switch or you will not be able to retrieve "
errMsg += "the commands output"
logger.error(errMsg)
elif isNoneValue(output):
logger.error("unable to retrieve xp_cmdshell output")
else:
logger.info("xp_cmdshell extended procedure is usable")

Expand Down Expand Up @@ -207,9 +209,11 @@ def xpCmdshellEvalCmd(self, cmd, first=None, last=None):

query = "SELECT %s FROM %s ORDER BY id" % (self.tblField, self.cmdTblName)

output = None
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)
else:

if (output is None) or len(output)==0 or output[0] is None:
output = []
count = inject.getValue("SELECT COUNT(id) FROM %s" % self.cmdTblName, resumeValue=False, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS)

Expand Down