1

I am using nping to send raw a Ethernet frame. I want to send a frame with custom data starting after the EtherType. However, nping puts the custom data in the middle of the packet. For example, here's my command:

nping --dest-mac <my mac> --ether-type 0xd2d2  -e eth0 --send-eth --data 00010028 192.168.2.10

and here's what I see on the receiver:

    0x0000:  8cfd f000 cb16 9410 3eb8 483d d2d2 4500
    0x0010:  0020 f412 0000 4001 0169 c0a8 0207 c0a8
    0x0020:  020a 0800 9a72 5d61 0003 0001 0028 0000
    0x0030:  0000 0000 0000 0000 0000 0000

In the third line I want the 6th and 7th half words, 0001 0028 to come after 0xd2d2

user2233706
  • 6,148
  • 5
  • 44
  • 86

1 Answers1

0

The custom data nping put is an IP header.

I'm not familiar with nping, but I guess the 192.168.2.10 you put at the end of your command is doing wrong. It's encoded at 16th and 17th half words (destination IP address) as c0a8 020a. Probably nping added the IP header because you specified 192.168.2.10.

Try the command without 192.168.2.10, or <my mac> instead of 192.168.2.10.

kaitoy
  • 1,545
  • 9
  • 16
  • I have to specify the IP address, otherwise nping throws an error. This even though I am specifying the interface directly (```-e eth0```) and specifying that I want to send a raw Ethernet frame (```--send-eth```). – user2233706 Nov 04 '16 at 14:50
  • Putting instead of 192.168.2.10 doesn't work? I guess not, though, as far as I read [the man page](https://linux.die.net/man/1/nping). – kaitoy Nov 04 '16 at 15:33
  • Do you need to use nping? I can write java code to work for you using pcap4j if you want. – kaitoy Nov 04 '16 at 15:36
  • 1
    Thanks, but I ended up using Ostinato to generate the packet. I just wanted some tool to generate raw packets on Windows. – user2233706 Nov 04 '16 at 16:11