简体   繁体   English

使用 scapy 发送数据包

[英]Send packet with scapy

I'm trying to send a simple ICMP packet from HOST B to HOST A我正在尝试从主机 B 向主机 A 发送一个简单的 ICMP 数据包

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.路由器的tcpdump上没有显示任何内容。 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它看起来像一个格式错误的数据包,没有任何东西转发给HOST A

The machines can ping correctly, what did I do wrong?机器可以正常ping,我做错了什么?

edit:sr1 output编辑: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 

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.我嗅探了一个充当 MiTM 的常规 ICMP 数据包,它起作用了。 HOST 1 received the packet correctly. HOST 1 正确接收到数据包。

Carcigenicate also guessed right, be sure to set the correct interface. Carcigenicate也猜对了,一定要设置正确的界面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM