Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

This started with a simple task, send an ICMP package of type 8 and code 0 to a host in my network. Since I use my Mac for everything I installed nemesis using macports and tried the following command.

sudo nemesis icmp -i 8 -c 0 -P ./payload -D

This resulted in an error.

ERROR: Incomplete packet injection.  Only wrote -1 bytes.

ICMP Injection Failure

And ever since then I have not been able to use nemesis icmp at all from two known good mac computers, I always get this same exact error.

So my response when I noticed this was to simply compile it on a FreeBSD 8.2 system from ports, nemesis 1.4 build 26, same as on OS X.

Works just as it should, no errors, happy user. :)

But I don't want to login to a FreeBSD system everytime I want to use nemesis so what's wrong here? I've tried compiling nemesis 1.4 build 26 from the source code on sourceforge, linking to the libnet installed by macports in /opt, but it did not make a difference.

Note: I've tried running this nemesis command on both systems using a root terminal, not just through sudo that is.

share|improve this question
Just fishing here, but what if you try sudo -s and then run the command? – squircle May 1 '11 at 14:05
@squircle same issue. On FreeBSD I don't even use sudo for this, I just have a root terminal open. I've tried this on OS X too, same issue. – nocturnal May 1 '11 at 14:12
Well that's what sudo -s does; open a root terminal. So I guess it's not a permissions problem... – squircle May 1 '11 at 14:19
up vote 0 down vote accepted

This looks like a failing of libnet. From the source code of nemesis:

if (got_link)
    n = libnet_write_link_layer(l2, device, pkt, icmp_packetlen);
    n = libnet_write_ip(sockfd, pkt, icmp_packetlen);

if (verbose == 2)
    nemesis_hexdump(pkt, icmp_packetlen, HEX_ASCII_DECODE);
if (verbose == 3)
    nemesis_hexdump(pkt, icmp_packetlen, HEX_RAW_DECODE);

if (n != icmp_packetlen)
    fprintf(stderr, "ERROR: Incomplete packet injection.  Only wrote "
            "%d bytes.\n", n);

So the failure is in libnet_write_ip() or libnet_write_link_layer().

I would recommend manually recompiling libnet from source and linking nemesis against that new copy.

share|improve this answer
You read my mind, and also the source code. Thank you. – nocturnal May 1 '11 at 14:38

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.