File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010from lib .core .common import Backend
1111from lib .core .common import dataToStdout
12+ from lib .core .common import getPublicTypeMembers
1213from lib .core .common import getSQLSnippet
14+ from lib .core .common import getTechniqueData
1315from lib .core .common import isTechniqueAvailable
1416from lib .core .convert import utf8decode
1517from lib .core .data import conf
@@ -39,14 +41,23 @@ def sqlQuery(self, query):
3941 sqlType = sqlTitle
4042 break
4143
42- if 'OPENROWSET' not in query .upper () and (not sqlType or 'SELECT' in sqlType ):
44+ stacked = isTechniqueAvailable (PAYLOAD .TECHNIQUE .STACKED )
45+
46+ if not stacked :
47+ for technique in getPublicTypeMembers (PAYLOAD .TECHNIQUE , True ):
48+ _ = getTechniqueData (technique )
49+ if _ and "stacked" in _ ["title" ].lower ():
50+ stacked = True
51+ break
52+
53+ if "OPENROWSET" not in query .upper () and (not sqlType or "SELECT" in sqlType ):
4354 infoMsg = "fetching %s query output: '%s'" % (sqlType if sqlType is not None else "SQL" , query )
4455 logger .info (infoMsg )
4556
4657 output = inject .getValue (query , fromUser = True )
4758
4859 return output
49- elif not isTechniqueAvailable ( PAYLOAD . TECHNIQUE . STACKED ) and not conf .direct :
60+ elif not stacked and not conf .direct :
5061 warnMsg = "execution of custom SQL queries is only "
5162 warnMsg += "available when stacked queries are supported"
5263 logger .warn (warnMsg )
You can’t perform that action at this time.
0 commit comments