Hacking/Pwnable

[Pwnable] python으로 인자 및 stdin 전달

h4won 2021. 4. 1. 17:42

1. shell에서 python으로 바이너리에 stdin 전달

(python -c 'print "A"*10';cat) | <executable>

 

2. shell에서 python으로 바이너리에 인자 전달

./program `python -c 'print "A"*10'`

 

3. gdb에서 python으로 바이너리에 stdin 전달

r < <(python -c 'print "A"*10')

 

4. gdb에서 python으로 바이너리에 인자 전달

r `python -c 'print "A"*10'`

 

-> 만약 로컬이 아닌 서버에 접속해야 할 경우, 뒤에 | nc (접속정보) 를 붙여준다.