python-3.xscapypacketpacket-losspacket-injection

Send packet with scapy


I'm trying to send a simple ICMP packet from HOST B to HOST A

This is my configuration:

HOST A
10.0.1.10 with gateway set to 10.0.1.24


Router
NIC 1 10.0.1.24
NIC 2 192.168.100.1

HOST B 
192.168.100.3




A: 10.0.1.10 <---> 10.0.1.24 |NIC-1 Router NIC-2| 192.168.100.1 <---> 192.168.100.3: B

But when I try to send the packet with

send(IP(dst="10.0.1.10")/ICMP()/"Hello World")

nothing shows up on the tcpdump of the router . With

sendp(IP(dst="10.0.1.10")/ICMP()/"Hello World")

instead, this shows up

09:41:16.398305 00:00:40:01:4b:20 (oui Unknown) > 45:00:00:27:00:01 (oui Unknown), ethertype Unknown (0xc0a8), length 60: 
    0x0000:  6403 0a00 010a 0800 a631 0000 0000 4865  d........1....He
    0x0010:  6c6c 6f20 576f 726c 6400 0000 0000 0000  llo.World.......
    0x0020:  0000 0000 0000 0000 0000 0000 0000       ...........

It looks like a malformed packet, and nothing is forwarded to HOST A

The machines can ping correctly, what did I do wrong?

edit:sr1 output

13:25:58.235650 08:00:27:44:d7:c8 (oui Unknown) Null > Broadcast Unknown DSAP 0x08 Unnumbered, 27, Flags [Command], length 54
    0x0000:  0800 2701 507f 0800 2744 d7c8 0800 4500  ..'.P...'D....E.
    0x0010:  0028 0001 0000 4001 4b1f c0a8 6403 0a00  .(....@.K...d...
    0x0020:  010a 0800 26a8 0000 0000 4845 4c4c 4f20  ....&.....HELLO.
    0x0030:  574f 524c 440a 

Solution

  • Solved. For someone that is a "noob" with this tool like me: The router was not forwarding the packet to the subnet because it was malformed. I sniffed a regular ICMP packet acting as a MiTM,and it worked. HOST 1 received the packet correctly.

    Carcigenicate also guessed right, be sure to set the correct interface.