Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context.terminal: existing code breaks #1898

Closed
martinclauss opened this issue May 28, 2021 · 3 comments
Closed

context.terminal: existing code breaks #1898

martinclauss opened this issue May 28, 2021 · 3 comments

Comments

@martinclauss
Copy link
Contributor

Hello :)

I generated a simple script with pwn template ./a.out > xpl.py. When running the script with GDB everything works just find. When I add the following line as usual: context.terminal = "tmux splitw -h".split(" ") and run the script ./xpl.py GDB I get the following error:

Traceback (most recent call last):
  File "/io/exercise_bufferoverflow_shellcode/./xpl.py", line 43, in <module>
    io = start()
  File "/io/exercise_bufferoverflow_shellcode/./xpl.py", line 21, in start
    return gdb.debug([exe.path] + argv, gdbscript=gdbscript, *a, **kw)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/context/__init__.py", line 1524, in setter
    return function(*a, **kw)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/gdb.py", line 576, in debug
    tmp = attach((host, port), exe=exe, gdbscript=gdbscript, ssh=ssh, sysroot=sysroot, api=api)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/context/__init__.py", line 1524, in setter
    return function(*a, **kw)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/gdb.py", line 1046, in attach
    gdb_pid = misc.run_in_new_terminal(cmd, preexec_fn = preexec_fn)
  File "/usr/local/lib/python3.9/dist-packages/pwnlib/util/misc.py", line 297, in run_in_new_terminal
    pid = int(out)
ValueError: invalid literal for int() with base 10: b''

Maybe this is related to recent changes in pwnlib/util/misc.py (https://github.com/Gallopsled/pwntools/commits/dev/pwnlib/util/misc.py)

$ pwn version
[*] Pwntools v4.7.0dev

Thanks!

@Arusekk
Copy link
Member

Arusekk commented May 28, 2021

Yes, this is a bug, but see #1874 #1878 for a workaround

DO NOT CLOSE THIS PLEASE, even if the workaround works

@heapcrash
Copy link
Collaborator

@martinclauss can you try the patch here, and see if this resolves the issue?

70b2b2c

@martinclauss
Copy link
Contributor Author

@heapcrash Yes, this works for me :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants