简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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