Search code examples
arraysnetworkingudphexnetcat

How to send a Hex Byte array using NetCat (nc)


I want to send a byte array to a device in my network with IP addres 192.168.0.80 via UDP to port 8888, how can i do that using NetCat?

02,01,65,C9,00,02,01,06


Solution

  • You can use echo to pipe a string into netcat like this:

    echo -ne "\x2\x1\x65\xc9\x0\x2\x1\x6" | netcat -u -q 0 192.168.0.80 8888

    Make sure to remove trailing zeros by first replacing ,0 with \x and then replace all remaining , with \x using search and replace in notepad++