I am trying to print the following data into file, but i get the following error: "/bin/sh: 1: Syntax error: Unterminated quoted string". Here is my program:
int main(void)
{
char* argv[] = {"/bin/sh", "-c","printf '%b' '\x7f\x45\x4c\x46\x01\x00\x02\x03' > file.bin", NULL };
execve("/bin/sh", argv, NULL);
return 1;
}
The problem is in the null byte in the middle of above text: \x7f\x45\x4c\x46\x01\x00\x02\x03"
Is there any way to do this like above ?