From ea94ee4ca5a8060567cc9bd0dc33796a89ad0b95 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Wed, 24 Aug 2016 14:36:33 -0700 Subject: [PATCH] Disallow usage of semicolons in run_in_new_terminal. Fixes Gallopsled/pwntools#690 Fixes Gallopsled/pwntools#635 --- pwnlib/util/misc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pwnlib/util/misc.py b/pwnlib/util/misc.py index 7aaafd7a5..be448a7d7 100644 --- a/pwnlib/util/misc.py +++ b/pwnlib/util/misc.py @@ -189,7 +189,6 @@ def run_in_new_terminal(command, terminal = None, args = None): Returns: None - """ if not terminal: @@ -214,8 +213,12 @@ def run_in_new_terminal(command, terminal = None, args = None): argv = [terminal_path] + args if isinstance(command, str): + if ';' in command: + log.error("Cannot use commands with semicolon. Create a script and invoke that directly.") argv += [command] elif isinstance(command, (list, tuple)): + if any(';' in c for c in command): + log.error("Cannot use commands with semicolon. Create a script and invoke that directly.") argv += list(command) log.debug("Launching a new terminal: %r" % argv)