scapy - srp doesnt send my packet to the correct network interface

China☆狼群 提交于 2020-01-05 03:46:23

问题


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

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).

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.

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


回答1:


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

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).

Example:

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

See also https://stackoverflow.com/a/55093154/5459467



来源:https://stackoverflow.com/questions/58790112/scapy-srp-doesnt-send-my-packet-to-the-correct-network-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!