Comments (4)
It seems that it's not the problem of gdb , because I can attach the process outside the python script (using the gdb shell command).
It looks like the problem lies in the pwntools python lib, since I have found some issue about this problem in their repo:
pwntools issue
I have checked two elf files , one is 32 Bits ELF and another is 64 Bits ELF, and both of them can be debugged in the gdb in bash. The same error occur in both of them. So I believe it's not the problem of ELF file to be debug.
I still can't fix the gdb.attach problem in the py script. Hope an elegant way can be found to solve it .
from pwndocker.
@Vccxx , I test with latest docker environment and it seems that it reports the same problem but the debugger works.
I compile a test program in my docker environment and it suceeds:
test.c
#include <stdio.h>
int main()
{
puts("test");
getchar();
puts("done");
}
and I run docker run -it --privileged skysider/pwndocker/ /bin/bash
, and it works.
from pwndocker.
I have test your test program on my docker and it doesn't work , here is how I did:
Firstly I start the docker with command :
sudo docker run -it --privileged skysider/pwndocker /bin/bash
Secondly I compile the test.c file with gcc test.c -o test
, which contains the following code:
#include <stdio.h>
int main()
{
puts("test");
getchar();
puts("done");
}
Thirdly I write the exp.py:
from pwn import *
context.log_level = "debug"
context.terminal = ["tmux","splitw","-h"]
io = process("./test")
io.send("1")
gdb.attach(io)
io.interactive()
and then I run the exp.py , get stuck here:
root@d3f8a524e41e:/ctf/work# python3 test_exp.py
[+] Starting local process './test' argv=[b'./test'] : pid 38
[DEBUG] Sent 0x1 bytes:
49 * 0x1
[*] running in new terminal: /usr/bin/gdb -q "./test" 38
[DEBUG] Launching a new terminal: ['/usr/bin/tmux', 'splitw', '-h', '/usr/bin/gdb -q "./test" 38']
[-] Waiting for debugger: debugger exited! (maybe check /proc/sys/kernel/yama/ptrace_scope)
and after about 1 minute, the program just exit without debugger attached:
root@d3f8a524e41e:/ctf/work# python3 test_exp.py
[+] Starting local process './test' argv=[b'./test'] : pid 38
[DEBUG] Sent 0x1 bytes:
49 * 0x1
[*] running in new terminal: /usr/bin/gdb -q "./test" 38
[DEBUG] Launching a new terminal: ['/usr/bin/tmux', 'splitw', '-h', '/usr/bin/gdb -q "./test" 38']
[-] Waiting for debugger: debugger exited! (maybe check /proc/sys/kernel/yama/ptrace_scope)
[*] Switching to interactive mode
[*] Process './test' stopped with exit code 0 (pid 38)
[DEBUG] Received 0xa bytes:
b'test\n'
b'done\n'
test
done
[*] Got EOF while reading in interactive
$
[DEBUG] Sent 0x1 bytes:
10 * 0x1
[*] Got EOF while sending in interactive
Would you please show me your exp.py? I think there maybe some coding problem.
from pwndocker.
OK, It turns out that I didn't run exp.py in a tmux terminal but in a bash terminal......
the debugger works fine in tmux terminal.
Thank you for your time.
from pwndocker.
Related Issues (15)
- there's not roputils but it is included in README.md HOT 1
- 不知道root密码,如何使用ida附加调试 HOT 3
- When I tring to use gdb.attach(io) in py script using pwntools. An Error occurred said HOT 1
- pwn version is not for tmux HOT 3
- Error: Authentication required to pull the image HOT 2
- Feature request: include glibc 2.34~2.36 in the docker image HOT 1
- Feature: add zsh and ohmyzsh! HOT 1
- gdb can't disable ASLR inside the container HOT 2
- there is no angr but it is included in readme.md HOT 1
- pwndocker的问题
- I can't change the interpreter HOT 3
- 是否可以提供各版本glibc源码调试支持 HOT 1
- date is utc and can't change to +8 hours HOT 1
- phusion/baseimage:master-amd64 updated to libc-2.31 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwndocker.