File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2590,7 +2590,10 @@ def decodeIntToUnicode(value):
25902590 try :
25912591 # http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_ord
25922592 if Backend .getIdentifiedDbms () in (DBMS .MYSQL ,):
2593- retVal = getUnicode (hexdecode (hex (value )))
2593+ _ = "%x" % value
2594+ if len (_ ) % 2 == 1 :
2595+ _ = "0%s" % _
2596+ retVal = getUnicode (hexdecode (_ ))
25942597 elif value > 255 :
25952598 retVal = unichr (value )
25962599 else :
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