I have a binary file that I can send with netcat
:
$ nc -l localhost 8181 < my.dat
The file contains this:
$ xxd my.dat
0000000: 0006 3030 3030 4e43 ..0000NC
What I really want to do is send the hex string directly. I've tried this:
$ echo '0006303030304e43' | nc -l localhost 8181
However, the above command just sends the ascii string directly to nc
.
Best Answer
I used the -r and -p switch to xxd:
Thanks to inspiration from @Gilles answer, here's a perl version: