home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.13k stars 29.81k forks source link

nmap fails to obtain mac addresses on #123573

Open cometchaser opened 1 month ago

cometchaser commented 1 month ago

The problem

Hi

I wanted to use the Nmap Tracker to monitor my network. However, no devices are found. I am using Homeassistant in version 2024.8.0.

In the logs I only find the note that no MAC address was found for the respective devices:

2024-08-11 10:24:12.506 DEBUG (SyncWorker_0) [homeassistant.components.nmap_tracker] Scanning ['192.168.2.0/24'] with args: -F -T4 --min-rate 10 --host-timeout 15s --exclude 192.168.2.254 --reason -v
2024-08-11 10:24:35.237 DEBUG (SyncWorker_0) [homeassistant.components.nmap_tracker] Finished scanning ['192.168.2.0/24'] with args: -F -T4 --min-rate 10 --host-timeout 15s --exclude 192.168.2.254 --reason -v
2024-08-11 10:24:36.320 INFO (MainThread) [homeassistant.components.nmap_tracker] No MAC address found for 192.168.2.1
2024-08-11 10:24:37.362 INFO (MainThread) [homeassistant.components.nmap_tracker] No MAC address found for 192.168.2.3

This problem looked similar to #87623. But this one should be solved.

# python -m getmac -v -dddd --ip 192.168.2.1
DEBUG    Initializing 'ip4' method cache (platform: 'linux')
DEBUG    27 methods available: CtypesHost, ArpFile, ArpingHost, SysIfaceFile, FcntlIface, UuidLanscan, GetmacExe, IpconfigExe, WmicExe, ArpExe, DarwinNetworksetupIface, ArpFreebsd, ArpOpenbsd, IfconfigWithIfaceArg, IfconfigEther, IfconfigOther, IpLinkIface, NetstatIface, IpNeighborShow, ArpVariousArgs, UuidArpGetNode, DefaultIfaceLinuxRouteFile, DefaultIfaceIpRoute, DefaultIfaceRouteCommand, DefaultIfaceRouteGetCommand, DefaultIfaceOpenBsd, DefaultIfaceFreeBsd
DEBUG    9 type-filtered methods for 'ip4': CtypesHost, ArpFile, ArpingHost, ArpExe, ArpFreebsd, ArpOpenbsd, IpNeighborShow, ArpVariousArgs, UuidArpGetNode
DEBUG    5 platform-filtered methods for 'linux' (method_type='ip4'): ArpFile, ArpingHost, IpNeighborShow, ArpVariousArgs, UuidArpGetNode
DEBUG    5 tested methods for 'ip4': ArpFile, ArpingHost, IpNeighborShow, ArpVariousArgs, UuidArpGetNode
DEBUG    Current method cache: {'ip4': 'ArpFile', 'ip6': 'None', 'iface': 'None', 'default_iface': 'None'}
DEBUG    Current fallback cache: {'ip4': '[<getmac.getmac.ArpingHost object at 0x7f92673611c0>, <getmac.getmac.IpNeighborShow object at 0x7f9267171010>, <getmac.getmac.ArpVariousArgs object at 0x7f926706b950>, <getmac.getmac.UuidArpGetNode object at 0x7f926706ac30>]', 'ip6': '[]', 'iface': '[]', 'default_iface': '[]'}
DEBUG    Finished initializing 'ip4' method cache
DEBUG    Attempting get() (method='ArpFile', method_type='ip4', arg='192.168.2.1')
DEBUG    Not sending UDP packet, using network request method 'ArpingHost' instead
DEBUG    Attempting get() (method='ArpingHost', method_type='ip4', arg='192.168.2.1')
DEBUG    Running: '/usr/sbin/arping -f -c 1 192.168.2.1'
DEBUG    Falling back to Habets arping
DEBUG    Running: '/usr/sbin/arping -r -C 1 -c 1 192.168.2.1'
DEBUG    Method 'ArpingHost' failed for 'ip4' lookup
DEBUG    Raw MAC found: None
DEBUG    getmac took 1.0358 seconds

I tried to fix my problem by following https://github.com/home-assistant/core/issues/87623#issuecomment-1422701870 and add

import getmac
from getmac import get_mac_address
getmac.getmac.FORCE_METHOD="ArpFile"

to /usr/src/homeassistant/homeassistant/components/nmap_tracker/__init__.py. But it doesn't fix to problem. Also the installation of apk add arping doesn't fix the issue.

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

core-2024.8.0

What type of installation are you running?

Home Assistant Container

Integration causing the issue

nmap tracker

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nmap_tracker/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 month ago

nmap_tracker documentation nmap_tracker source

carefulcomputer commented 1 week ago

same here.