To open new terminal in docker environment, we have to add this line to our python code.
context.terminal = ['tmux', 'splitw', '-h']
If you didn't install tmux, you have to install it. It's one kind of Linux terminal.

unfortunally I got this kind of error below..

You can solve it by changing your pwntools version (reference below)
https://github.com/Gallopsled/pwntools/issues/1874
ValueError in gdb.attach when using tmux terminal · Issue #1874 · Gallopsled/pwntools
I am using ubuntu 20. I Install the python2 version of pwntools and specify context.terminal = ["tmux", "splitw", "-h"]. when use gdb.attach(p),it throws ValueError The Traceback is below: File ".....
github.com
https://github.com/Gallopsled/pwntools/issues/1907
ValueError while launch process with gdb.debug() · Issue #1907 · Gallopsled/pwntools
Hi there, I always got ValueError: invalid literal for int() with base 10: b'' when I try to launch gdb.debug(). Is it problem with pwntools or tmux? How should I workaround it? I have the latest v...
github.com
I downgraded it into 4.9.0 version but it doesn't work
So I downgraded into 4.4.0 again and got new error :(

Maybe it's because that I wasn't running python script inside tmux.
https://github.com/Gallopsled/pwntools/issues/1140#issue-316464648
docker gdb attach · Issue #1140 · Gallopsled/pwntools
I have make a docker about pwntools. But,when i use gdb.attach it always wait for debugger . i have install tmux and set context.terminal = ['tmux', 'splitw', '-h'] [+] Starting local process './sr...
github.com
I should have run it inside of tmux 😅
Now it finally works!

reference
pwntools로 익스 중에 디버깅 (gdb 등)
io = process('./binary') gdb.attach(proc.pidof(io)[0]) context(terminal = ['xterm', 'splitw']) 하고 attach 따로 해주면 된다. bp는 따로 걸어줘야됨 gdb.attach(s,'c\n') ----------------------------------------- context.terminal=['tmux', 'spli
training-1.tistory.com
'Linux Exploitation > settings' 카테고리의 다른 글
[Pwnable] ROP 가젯 찾기 어려울 때 할 수 있는 방법들... (0) | 2024.01.03 |
---|---|
pwntools version (pwntools 버전 확인 하는 법) (0) | 2023.08.17 |
[스크랩] gdb attach (0) | 2023.08.08 |
[Pwnable] 디버깅 심볼 다운로드 및 오프셋 알아내기 (0) | 2023.07.14 |
[Pwnable] 로더 파일 설정, patchelf 사용법 (0) | 2023.07.14 |