MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / initEnv

Method initEnv

lib/takeover/abstraction.py:195–233  ·  view source on GitHub ↗
(self, mandatory=True, detailed=False, web=False, forceInit=False)

Source from the content-addressed store, hash-verified

193 # inject.goStacked(expression)
194
195 def initEnv(self, mandatory=True, detailed=False, web=False, forceInit=False):
196 self._initRunAs()
197
198 if self.envInitialized and not forceInit:
199 return
200
201 if web:
202 self.webInit()
203 else:
204 self.checkDbmsOs(detailed)
205
206 if mandatory and not self.isDba():
207 warnMsg = "functionality requested probably does not work because "
208 warnMsg += "the current session user is not a database administrator"
209
210 if not conf.dbmsCred and Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.PGSQL):
211 warnMsg += ". You can try to use option '--dbms-cred' "
212 warnMsg += "to execute statements as a DBA user if you "
213 warnMsg += "were able to extract and crack a DBA "
214 warnMsg += "password by any mean"
215
216 logger.warning(warnMsg)
217
218 if any((conf.osCmd, conf.osShell)) and Backend.isDbms(DBMS.PGSQL) and self.checkCopyExec():
219 success = True
220 elif Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL):
221 success = self.udfInjectSys()
222
223 if success is not True:
224 msg = "unable to mount the operating system takeover"
225 raise SqlmapFilePathException(msg)
226 elif Backend.isDbms(DBMS.MSSQL):
227 if mandatory:
228 self.xpCmdshellInit()
229 else:
230 errMsg = "feature not yet implemented for the back-end DBMS"
231 raise SqlmapUnsupportedFeatureException(errMsg)
232
233 self.envInitialized = True

Callers 7

osCmdMethod · 0.80
osShellMethod · 0.80
osPwnMethod · 0.80
osBofMethod · 0.80
_regInitMethod · 0.80
stackedReadFileMethod · 0.80
stackedWriteFileMethod · 0.80

Calls 11

_initRunAsMethod · 0.95
webInitMethod · 0.80
getIdentifiedDbmsMethod · 0.80
isDbmsMethod · 0.80
checkCopyExecMethod · 0.80
udfInjectSysMethod · 0.80
xpCmdshellInitMethod · 0.80
checkDbmsOsMethod · 0.45
isDbaMethod · 0.45

Tested by

no test coverage detected