Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think (based on searching the forums), that NetCat is the best option, but wanted to hear if others are preferable.

Anyone have good success with a packet-crafting tool (specifically on Mac)? I've tried HPing, but had some issues. I'm looking into NetCat ('nc' on mac) now, but it's not working as I had thought. Basically, I captured some packets that a remote control sends over a wifi network to turn lights on and off (using X10 controllers), and am looking for a way to replay them by crafting a TCP packet from the command line.

I used Wireshark to sniff the traffic, so I know the package is: DEVICE -sendplc-"C4 DIM 10"

I'm trying: echo 'DEVICE -sendplc-"C4 DIM 10"' > nc 6003 but there's no response from the receiving system.

The exact bytestream is (if anyone wants to check that I got the right dataframe): 08004642f1b400260897ad6308004500004b08e240004006aaf5c0a802c1c0a802c4d8d7177399aab39 e57ff4753801880ae37ea00000101080a323353ce01b406424445564943457e73656e64706c637e2243 34204f4e220a

Next step I'm going to check is to make sure the packet arrives exactly by sniffing and compare it to the original.

share|improve this question

Checkout Scapy. It is available as a macport or just download, build and install it yourself.

and, Scapy at Darwinports.

share|improve this answer

Is it not liking the newline echo would append? Have you tried echo -n to leave off the newline?

share|improve this answer

The standard place to look for packet crafting tools is the Sectools page: Top 4 Packet Crafting Tools. Scapy from there is probably the best suited for your needs.

In this case, the new nping tool from the same source might be an interesting try too.
I see that you are generating an Ethernet IP packet, this should be feasible with nping.

share|improve this answer

I realize it was all a unix piping problem. Netcat worked perfectly, I needed to use a | instead of a > to send data to nc.

Thanks, Brad, you gave me the right idea.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.