I want to send input to a process which includes unprintable characters like "\x90". I when I try to send it like this: p.sendline(p64(0x414190)), my programm which prints it back, returns AA\x90. It took the "\x90" as a string, not as a byte. Can someone help me how to send raw bytes?
My program (vulnerable to format string, I dont need to be told):
#include <stdio.h>
int main() {
char name[512];
char passwd[512];
printf("Enter your name: ");
fgets(name, sizeof(name), stdin);
printf(name);
printf("Enter your password: ");
fgets(passwd, sizeof(passwd), stdin);
printf(passwd);
exit(1);
}
Using
p64()does send the input as raw bytes. You can check it by adding pwntools'DEBUGflag while running your script. The debug output then prints everything that is sent and received. E.g.:In the example above, you see that the bytes
90 41 41 00 00 00 00 00 0aare sent to the program, and not the string\x90.