Skip to content

Commit

Permalink
Execute should always return a string not a list
Browse files Browse the repository at this point in the history
  • Loading branch information
NeffIsBack committed Oct 22, 2024
1 parent b5e9f1f commit a382fbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nxc/protocols/smb.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ def gen_relay_list(self):
relay_list.write(self.host + "\n")

@requires_admin
def execute(self, payload=None, get_output=False, methods=None) -> list:
def execute(self, payload=None, get_output=False, methods=None) -> str:
"""
Executes a command on the target host using CMD.exe and the specified method(s).
Expand All @@ -630,7 +630,7 @@ def execute(self, payload=None, get_output=False, methods=None) -> list:
Returns:
-------
list: A list containing the lines of the output of the command
str: The output of the command
"""
if self.args.exec_method:
methods = [self.args.exec_method]
Expand Down Expand Up @@ -765,7 +765,7 @@ def execute(self, payload=None, get_output=False, methods=None) -> list:

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

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

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

0 comments on commit a382fbd

Please sign in to comment.