sebschrader / python-arpreq

Query the Kernel ARP cache for the MAC address of an IP address
MIT License
11 stars 1 forks source link

doing it in windows #11

Closed martin3000 closed 2 years ago

martin3000 commented 5 years ago

If someone wants to do the same in windows, this is the right call:

IPHLPAPI_DLL_LINKAGE _NETIOAPISUCCESS NETIOAPI_API ResolveIpNetEntry2( PMIB_IPNET_ROW2 Row, const SOCKADDR_INET *SourceAddress );

https://docs.microsoft.com/en-us/windows/desktop/api/netioapi/nf-netioapi-resolveipnetentry2

sebschrader commented 2 years ago

ResolveIpNetEntry2 does a bit more than just querying the ARP cache:

This function flushes any existing neighbor entry that matches the IP address on the interface and then resolves the physical address (MAC) address by sending ARP requests for an IPv4 address or neighbor solicitation requests for an IPv6 address.

GetIpNetEntry2 would be the equivalent function to the arpreq ioctl on Linux.

In any case, I won't be implementing Windows support, but I'm willing to merge a proper PR that implements and provides automatic builds and tests, as I can not build or test for that platform myself.