1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-24 01:25:37 +01:00

Fixed pty spawn for interactive shell

This commit is contained in:
Caleb Stewart 2021-05-02 14:41:25 -04:00
parent ea5cbf5c81
commit ad5ad1a9fb

View File

@ -547,11 +547,12 @@ class Linux(Platform):
return return
pty_command = None pty_command = None
shell = self.getenv("SHELL")
if pty_command is None: if pty_command is None:
script_path = self.which("script") script_path = self.which("script")
if script_path is not None: 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: if pty_command is None:
python_path = self.which( python_path = self.which(
@ -566,7 +567,7 @@ class Linux(Platform):
] ]
) )
if python_path is not None: 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: if pty_command is not None:
self.logger.info(pty_command.rstrip("\n")) self.logger.info(pty_command.rstrip("\n"))