|
43 | 43 | from impacket.dcerpc.v5.dcom import wmi |
44 | 44 | from impacket.dcerpc.v5.dtypes import NULL |
45 | 45 | from impacket.krb5.keytab import Keytab |
46 | | -from six import PY2 |
47 | 46 |
|
48 | 47 | OUTPUT_FILENAME = '__' + str(time.time()) |
49 | 48 | CODEC = sys.stdout.encoding |
@@ -226,10 +225,7 @@ def do_cd(self, s): |
226 | 225 | print(self.__outputBuffer) |
227 | 226 | self.__outputBuffer = '' |
228 | 227 | else: |
229 | | - if PY2: |
230 | | - self.__pwd = ntpath.normpath(ntpath.join(self.__pwd, s.decode(sys.stdin.encoding))) |
231 | | - else: |
232 | | - self.__pwd = ntpath.normpath(ntpath.join(self.__pwd, s)) |
| 228 | + self.__pwd = ntpath.normpath(ntpath.join(self.__pwd, s)) |
233 | 229 | self.execute_remote('cd ') |
234 | 230 | self.__pwd = self.__outputBuffer.strip('\r\n') |
235 | 231 | self.prompt = (self.__pwd + '>') |
@@ -296,11 +292,11 @@ def execute_remote(self, data, shell_type='cmd'): |
296 | 292 |
|
297 | 293 | if self.__noOutput is False: |
298 | 294 | command += ' 1> ' + '\\\\127.0.0.1\\%s' % self.__share + self.__output + ' 2>&1' |
299 | | - if PY2: |
300 | | - self.__win32Process.Create(command.decode(sys.stdin.encoding), self.__pwd, None) |
| 295 | + response = self.__win32Process.Create(command, self.__pwd, None) |
| 296 | + if self.__noOutput is False: |
| 297 | + self.get_output() |
301 | 298 | else: |
302 | | - self.__win32Process.Create(command, self.__pwd, None) |
303 | | - self.get_output() |
| 299 | + response.printInformation() # print ProcessId and ReturnValue |
304 | 300 |
|
305 | 301 | def send_data(self, data): |
306 | 302 | self.execute_remote(data, self.__shell_type) |
|
0 commit comments