(self)
| 164 | self.runCmd(command) |
| 165 | |
| 166 | def _initRunAs(self): |
| 167 | if not conf.dbmsCred: |
| 168 | return |
| 169 | |
| 170 | if not conf.direct and not isStackingAvailable(): |
| 171 | errMsg = "stacked queries are not supported hence sqlmap cannot " |
| 172 | errMsg += "execute statements as another user. The execution " |
| 173 | errMsg += "will continue and the DBMS credentials provided " |
| 174 | errMsg += "will simply be ignored" |
| 175 | logger.error(errMsg) |
| 176 | |
| 177 | return |
| 178 | |
| 179 | if Backend.isDbms(DBMS.MSSQL): |
| 180 | msg = "on Microsoft SQL Server 2005 and 2008, OPENROWSET function " |
| 181 | msg += "is disabled by default. This function is needed to execute " |
| 182 | msg += "statements as another DBMS user since you provided the " |
| 183 | msg += "option '--dbms-creds'. If you are DBA, you can enable it. " |
| 184 | msg += "Do you want to enable it? [Y/n] " |
| 185 | |
| 186 | if readInput(msg, default='Y', boolean=True): |
| 187 | expression = getSQLSnippet(DBMS.MSSQL, "configure_openrowset", ENABLE="1") |
| 188 | inject.goStacked(expression) |
| 189 | |
| 190 | # TODO: add support for PostgreSQL |
| 191 | # elif Backend.isDbms(DBMS.PGSQL): |
| 192 | # expression = getSQLSnippet(DBMS.PGSQL, "configure_dblink", ENABLE="1") |
| 193 | # inject.goStacked(expression) |
| 194 | |
| 195 | def initEnv(self, mandatory=True, detailed=False, web=False, forceInit=False): |
| 196 | self._initRunAs() |
no test coverage detected