Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 144dc1b

Browse files
committed
Show proper warning message when --priv-esc is provided and underlying OS is not Windows
1 parent 6f5d2ed commit 144dc1b

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

plugins/generic/takeover.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ def osCmd(self):
8686
if kb.stackedTest:
8787
web = False
8888
elif not kb.stackedTest and kb.dbms == "MySQL":
89-
web = True
9089
infoMsg = "going to use a web backdoor for command execution"
9190
logger.info(infoMsg)
91+
92+
web = True
9293
else:
9394
errMsg = "unable to execute operating system commands via "
9495
errMsg += "the back-end DBMS"
@@ -105,9 +106,10 @@ def osShell(self):
105106
if kb.stackedTest:
106107
web = False
107108
elif not kb.stackedTest and kb.dbms == "MySQL":
108-
web = True
109109
infoMsg = "going to use a web backdoor for command prompt"
110110
logger.info(infoMsg)
111+
112+
web = True
111113
else:
112114
errMsg = "unable to prompt for an interactive operating "
113115
errMsg += "system shell via the back-end DBMS"
@@ -187,20 +189,36 @@ def osPwn(self):
187189
warnMsg += "might not work"
188190
logger.warn(warnMsg)
189191

190-
else:
192+
elif kb.os != "Windows" and conf.privEsc:
191193
# Unset --priv-esc if the back-end DBMS underlying operating
192194
# system is not Windows
193195
conf.privEsc = False
194196

197+
warnMsg = "sqlmap does not implement any operating system "
198+
warnMsg += "user privilege escalation technique when the "
199+
warnMsg += "back-end DBMS underlying system is not Windows"
200+
logger.warn(warnMsg)
201+
195202
elif not kb.stackedTest and kb.dbms == "MySQL":
196-
web = True
197203
infoMsg = "going to use a web backdoor to execute the "
198204
infoMsg += "payload stager"
199205
logger.info(infoMsg)
200206

207+
web = True
208+
201209
self.initEnv(web=web)
202210

203211
if self.webBackdoorUrl:
212+
if kb.os != "Windows" and conf.privEsc:
213+
# Unset --priv-esc if the back-end DBMS underlying operating
214+
# system is not Windows
215+
conf.privEsc = False
216+
217+
warnMsg = "sqlmap does not implement any operating system "
218+
warnMsg += "user privilege escalation technique when the "
219+
warnMsg += "back-end DBMS underlying system is not Windows"
220+
logger.warn(warnMsg)
221+
204222
self.getRemoteTempPath()
205223
self.createMsfPayloadStager()
206224
self.uploadMsfPayloadStager(web=True)

0 commit comments

Comments
 (0)