1

I am using bash script to send hex values to my network.

I need to send 0001000011050000FF00 hex value to IP: 192.168.1.5 Port# 502 using netcat.

I tried

$ echo '0001000011050000FF00' | xxd -r -p | nc -l 192.168.1.5 502

and it seems to be wrong.

Can you help me with that?

Thank you,

Bart
  • 2,221
Roman
  • 19
  • What did you do to verify that it's wrong? Do you have debug output from the destination port/machine (to show that the message was received but in the wrong format; to show that the message was not received; ...)? Do you have a tcpdump/wireshark trace to show that those bytes were transmitted over the wire? What else? (And, did you read the manual page for nc to understand the options you're using?) –  Aug 07 '19 at 23:06
  • I don't have a debug output printout. I used wireshark to trace the message, but couldn't find the message in the printout. Does the command $ echo '0001000011050000FF00' | xxd -r -p | nc -l 192.168.1.5 502 looks right? – Roman Aug 07 '19 at 23:25
  • If wireshark didn't show the message, that suggests it wasn't put out on the network. What did you do to verify each step of the command is correct? –  Aug 07 '19 at 23:34
  • I ran nc -v -n -z -w 1 192.168.1.5 502 to see if the port is up. The response was (UNKNOWN) [192.168.1.5] 502 (?) open. There was a lot of messages to the port (502). May be I need to look at the wireshark printout one more time and see if I can find the message. – Roman Aug 07 '19 at 23:48
  • After you do that, if you don't see the message, figure out what each command outputs. For example, pass echo ... | xxd... to hexdump -C to verify it is correctly turned into hex. Then look at the man page for nc to see what options it expects. –  Aug 07 '19 at 23:53
  • I will try that. Thank you. – Roman Aug 07 '19 at 23:57

0 Answers0