I was trying to make read return 0 in a program (the one in the while loop), and then execute the second read properly, which worked perfectly by hand, with CTRL-D
. However I wanted to do the same in pwntools (p = process("./test")
). I have already tried to send the eof character with p.sendline("\x04")
but didn't work. The program took the input like "\x0a\x04"
. p.send()
doesn't change anything. This is my test program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
char buf[24];
while(1) {
if(read(0,buf,16)==0) {
break;
}
}
read(0,buf,16);
return 0;
}
I hope anyone can help me.