Skip to content

Commit a382fbd

Browse files
committed
Execute should always return a string not a list
1 parent b5e9f1f commit a382fbd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nxc/protocols/smb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ def gen_relay_list(self):
618618
relay_list.write(self.host + "\n")
619619

620620
@requires_admin
621-
def execute(self, payload=None, get_output=False, methods=None) -> list:
621+
def execute(self, payload=None, get_output=False, methods=None) -> str:
622622
"""
623623
Executes a command on the target host using CMD.exe and the specified method(s).
624624
@@ -630,7 +630,7 @@ def execute(self, payload=None, get_output=False, methods=None) -> list:
630630
631631
Returns:
632632
-------
633-
list: A list containing the lines of the output of the command
633+
str: The output of the command
634634
"""
635635
if self.args.exec_method:
636636
methods = [self.args.exec_method]
@@ -765,7 +765,7 @@ def execute(self, payload=None, get_output=False, methods=None) -> list:
765765

766766
if "This script contains malicious content" in output:
767767
self.logger.fail("Command execution blocked by AMSI")
768-
return []
768+
return ""
769769

770770
if (self.args.execute or self.args.ps_execute):
771771
self.logger.success(f"Executed command via {current_method}")
@@ -776,7 +776,7 @@ def execute(self, payload=None, get_output=False, methods=None) -> list:
776776
return output
777777
else:
778778
self.logger.fail(f"Execute command failed with {current_method}")
779-
return []
779+
return ""
780780

781781
@requires_admin
782782
def ps_execute(self, payload=None, get_output=False, methods=None, force_ps32=False, obfs=False, encode=False) -> list:

0 commit comments

Comments
 (0)