sebschrader / python-arpreq

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

install issues on Mac OS 10.13.6 #9

Closed martinka closed 2 years ago

martinka commented 5 years ago

I am seeing the following issues when attempting to install arpreq. src/arpreq.c:215:39: error: use of undeclared identifier 'SIOCGIFHWADDR' . I am guessing this is a setting that exists for linux but not Mac OS. Any thoughts on resolving it would be great. If there isn't an easy path, I can setup a linux VM.

sebschrader commented 5 years ago

Hi @martinka,

as I've stated in the readme, I've only tested it on Linux systems. It turns out the SIOCGIFHWADDR ioctl(2) is not supported on Mac OS X. I would have to switch to a different API to query the local MAC address. I'll see if I can find a more portable way.

martinka commented 5 years ago

Hi @sebschrader Nice to virtually meet you. I absolutely understand and realize I am outside your testing. Thank you for looking into it. I spent a little time looking at the BSD implementation of the arp command and comparing it to the Linux version. The good news is it’s simpler than the Linux version but there isn’t a lot of overlap. Also I would need to test on the Mac since while it’s mostly BSD it does have some quirks. If you don’t have time to look at this and would be open to a pull request I might take a stab at it. Given my schedule it’s likely to take me a couple weeks.

On Jan 7, 2019, at 7:37 AM, Sebastian Schrader notifications@github.com wrote:

Hi @martinka,

as I've stated in the readme, I've only tested it on Linux systems. It turns out the SIOCGIFHWADDR ioctl(2) is not supported on Mac OS X. I would have to switch to a different API to query the local MAC address. I'll see if I can find a more portable way.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

wackazong commented 5 years ago

I looked into this but was not successfull, but maybe you can make something out of this:

https://github.com/alexxy/netdiscover/pull/11/files

and my closed PR in this repo here: https://github.com/sebschrader/python-arpreq/pull/10

wackazong commented 5 years ago

Ok, I have another solution. Use the getmac library instead of the arpreq library, that one is pure python and also works on OS X.

In discover.py:

21 from getmac import get_mac_address

...

391 hw_address = get_mac_address(ip=ip_address)
martinka commented 5 years ago

Thank you.

On Jan 10, 2019, at 5:31 PM, wackazong notifications@github.com wrote:

Ok, I have another solution. Use the getmac library instead of the arpreq library, that one is pure python and also works on OS X.

21 from getmac import get_mac_address

...

391 hw_address = get_mac_address(ip=ip_address) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.