I want to send tcpflow dump to a TCP port in HEX data, to send with netcat i need to convert to HEX and add \\x before each HEX bytes, to do this i use this line:
tcpflow -i [interface] -C dst port [port] | xxd -p | sed 's/../&\\\\x/g;s/ $//' | nc [host] [port]
Hello again and merry Xmass to all, thankx again Franklin52 for your fix
After experimenting with tcp test tool and tcpflow i discovered that tcpflow -C ( print to console ) implies -s witch convert unprintable characters to "." witch i don't want, i patched tcpflow to have -B (send output to stdout) hxxps://launchpadlibrarian.net/11992351/20_stdout-dump.diff now tcpflow -B send the data as it is. (tested with tcp test tool)
I have another problem with pipes after i convert to HEX using xxd -p it seems i cannot pipes the output to anything awk, sed ,netcat nothing works
Is there a way to fix this or is there better way to convert tcpflow stdout binary code and send as hex on a tcp port... C code, perl, python... anything that works on ubuntu 10.04