From ad5ad1a9fbf48ebe0b3c07e0d6103909e43fde22 Mon Sep 17 00:00:00 2001 From: Caleb Stewart Date: Sun, 2 May 2021 14:41:25 -0400 Subject: [PATCH] Fixed pty spawn for interactive shell --- pwncat/platform/linux.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pwncat/platform/linux.py b/pwncat/platform/linux.py index 448c1ef..7ac85ad 100644 --- a/pwncat/platform/linux.py +++ b/pwncat/platform/linux.py @@ -547,11 +547,12 @@ class Linux(Platform): return pty_command = None + shell = self.getenv("SHELL") if pty_command is None: script_path = self.which("script") if script_path is not None: - pty_command = f""" exec {script_path} -qc /bin/sh /dev/null 2>&1\n""" + pty_command = f""" exec {script_path} -qc {shell} /dev/null 2>&1\n""" if pty_command is None: python_path = self.which( @@ -566,7 +567,7 @@ class Linux(Platform): ] ) if python_path is not None: - pty_command = f"""exec {python_path} -c "import pty; pty.spawn('/bin/sh')" 2>&1\n""" + pty_command = f"""exec {python_path} -c "import pty; pty.spawn('{shell} -i')" 2>&1\n""" if pty_command is not None: self.logger.info(pty_command.rstrip("\n"))