0

I have a small ingest TCP server that should accept a device UUID as a first message, which is only 16 bytes. I'd like to test this manually from terminal, but sending a string won't work, since it had 36 bytes and would be truncated, hence the wrong UUID. In general i'd like the most easiest way to do this, e.g -

echo 6a43cf05-9d41-4ebf-b8da-f491f42128c0 | nc localhost 8080

But naturally this won't work. Any other way to send a proper UUID from the console via tcp?

4lex1v
  • 103
  • 3

1 Answers1

1

You send 36 bytes, because you are providing the UUID as a human readable string.

To generate valid binary UUID, you can use uuid(1) utility. Output of which you can pipe to netcat.

Fox
  • 3,977
  • 18
  • 23
  • Thank you. Could you please update you answer, cause it should be `uuid -F BIN | nc ...`, since `uuid | nc ...` sends a string representation over the wire, which is the same as if i `echo ... | nc ...`, so `-F BIN` is required – 4lex1v Aug 19 '15 at 10:36