Skip to content

Commit

Permalink
Nicer error when running tmux exploit outside tmux (#2314)
Browse files Browse the repository at this point in the history
When you set the `context.terminal` to be tmux related but then try
to run the exploit outside a tmux session, you'd get a cryptic ValueError
while trying to parse the pid of the new pane in tmux.

Print a nicer reminder to start tmux first.
  • Loading branch information
peace-maker authored Dec 6, 2023
1 parent b3d4043 commit b1e2b56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,12 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr

if terminal == 'tmux':
out, _ = p.communicate()
pid = int(out)
try:
pid = int(out)
except ValueError:
pid = None
if pid is None:
log.error("Could not parse PID from tmux output (%r). Start tmux first.", out)
elif terminal == 'qdbus':
with subprocess.Popen((qdbus, konsole_dbus_service, '/Sessions/{}'.format(last_konsole_session),
'org.kde.konsole.Session.processId'), stdout=subprocess.PIPE) as proc:
Expand Down

0 comments on commit b1e2b56

Please sign in to comment.