0
votes

I am using the command line of Windows 10 to ping a device that is not on my LAN. I am using a VPN connection to communicate with that device. The device responds to all the ping requests that I send from the command line.

But when I send the ICMP echo requests with scapy, I don't get any response. The only difference between the command line ping and the scapy ping is that the latter doesn't fill the Identifier and Sequence fields of the ICMP packet (the default value is probably 0 in both fields).

This is my python code:

from scapy.all import IP, ICMP, sr1

reply = sr1(IP(dst=dst_ip)/ICMP())

I have tried both ping requests with the windows firewall off.

What could be wrong? How can I get response with the scapy ping?

1

1 Answers

1
votes

Scapy may be picking the wrong interface/route.

What I would do is run sr1 with the iface parameter and provide an explicit interface name. Scapy has the get_if_list() function to list your network interfaces but on Windows this could be different. Seeing that you are using Windows you may have to use the 'meaningful name' ie 'Network Connection 1'. Here is a useful link just in case: Python netifaces and scapy: Getting meaningful Interface-names and full IP-Adresses-/Netmask-Information