Skip to content

Commit 594c3b9

Browse files
committed
Add stderr printing to winrm execution
1 parent f981215 commit 594c3b9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nxc/protocols/winrm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ def execute(self, payload=None, get_output=False, shell_type="cmd"):
261261
return result[0]
262262
self.logger.success(f"Executed command (shell type: {shell_type})")
263263
if not self.args.no_output:
264-
for line in StringIO(result[0]).readlines():
265-
self.logger.highlight(line.strip())
264+
if result[2] == 0:
265+
for line in result[0].replace("\r", "").splitlines():
266+
self.logger.highlight(line.strip())
267+
else:
268+
for line in result[1].replace("\r", "").splitlines():
269+
self.logger.fail(line.strip())
266270

267271
def ps_execute(self, payload=None, get_output=False):
268272
command = payload if payload else self.args.ps_execute

0 commit comments

Comments
 (0)