From 65937b36d0a04e78281af471edabdd170febac12 Mon Sep 17 00:00:00 2001 From: Thy_Kali Date: Thu, 29 Jun 2023 14:33:46 -0400 Subject: [PATCH] Added feature to spawn conptyshell if within tmux session --- Villain.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 Villain.py diff --git a/Villain.py b/Villain.py old mode 100644 new mode 100755 index a52a714..4e91152 --- a/Villain.py +++ b/Villain.py @@ -7,6 +7,7 @@ import argparse +import os from subprocess import check_output from Core.common import * from Core.settings import Hoaxshell_Settings, Core_Server_Settings, TCP_Sock_Handler_Settings, File_Smuggler_Settings @@ -1285,7 +1286,12 @@ def main(): villain_cmd['issuer'] = 'self' # Start listener - os.system(f'gnome-terminal -- bash -c "stty raw -echo; (stty size; cat) | nc -lvnp {lport}"') + # Will spawn in TMUX instead of gnome-terminal if available. + if os.getenv("TMUX") is not None: + os.system(f'tmux split-window -h "bash -c \'stty raw -echo; (stty size; cat) | nc -lvnp {lport}\'"') + else: + os.system(f'gnome-terminal -- bash -c "stty raw -echo; (stty size; cat) | nc -lvnp {lport}"') + sleep(0.2) Hoaxshell.command_pool[session_id].append(villain_cmd)