Linux Exploitation/settings

gdb.attach (in docker enviornment)

Rosieblue 2023. 8. 17. 01:21
728x90

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.

installing tmux

 
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