scapy - srp 没有将我的数据包发送到正确的网络接口 [英] scapy - srp doesnt send my packet to the correct network interface

查看:77
本文介绍了scapy - srp 没有将我的数据包发送到正确的网络接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 10 机器上工作,我正在为我正在做的一些项目使用 scapy.

I work on windows 10 machine and I am using scapy for some project I am doing.

当我使用嗅探功能从我的以太网接口嗅探数据包时,它按预期工作,但是当我使用 srp1 从同一接口发送数据包时,它通过我的 vEthernet 接口发送我的数据包,而不是通过我的物理以太网接口(所以数据包永远不会到达目的地).

When I use the sniff function to sniff packets form my ethernet interface it is working as expected but when I use srp1 to send packet from the same interface it send my packet trough my vEthernet interface and not trough my physical ethernet interface(so the packet never gets to it destination).

这是我的嗅探与 srp1 代码:

Here is my code of sniff versus srp1:

a = sniff(count = 1, iface = "Ethernet")
p = srp1(pkt, iface = "Ethernet")

正如您在两次调用中所看到的,我使用了以太网"接口名称.

as you can see in both calls I use "Ethernet" interface name.

谁能告诉我该怎么做,这样我的数据包将通过以太网而不是 vEthernet 发送?

Can someone tell me what to do so my packet will be send trough Ethernet and not vEthernet?

推荐答案

如果您打开 Scapy shell 并键入 IFACES(仅限 Windows ATM),您将看到接口的确切列表.

If you open a Scapy shell and type IFACES (Windows only ATM), you will be shown the exact list of interfaces.

然后您可以使用接口对象,而不是名称.(请参阅 help(IFACES) 以了解各种实用函数,例如 IFACES.dev_from_id()... 以获取它).

You can then use the interface object, rather than the name. (see help(IFACES) for the various util functions such as IFACES.dev_from_id()... to get it).

示例:

from scapy.arch.windows import IFACES
a = IFACES.dev_from_id(5)
sr1(IP(dst="www.google.com")/ICMP(), iface=a)

另见https://stackoverflow.com/a/55093154/5459467

这篇关于scapy - srp 没有将我的数据包发送到正确的网络接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆