NdpNeighbors

class getmac.getmac.NdpNeighbors[source]

Bases: Method

Use the ndp -an command to find the MAC address of an IPv6 host in the NDP neighbor cache on macOS, FreeBSD, NetBSD, OpenBSD and DragonFly BSD.

A link-local address can include a zone, as the interface name (fe80::1%en0) or index (fe80::1%2).

Attributes Summary

method_type

The type of method, e.g. does it get the MAC of a interface.

platforms

Platforms supported by a method.

Methods Summary

get(arg)

Core logic of the method that performs the lookup.

test()

Low-impact test that the method is feasible, e.g. a command exists.

Attributes Documentation

method_type: str = 'ip6'

The type of method, e.g. does it get the MAC of a interface.

Allowed values:

  • ip

  • ip4

  • ip6

  • iface

  • default_iface

platforms: set[str] = {'darwin', 'dragonfly', 'freebsd', 'netbsd', 'openbsd'}

Platforms supported by a method.

Methods Documentation

get(arg)[source]

Core logic of the method that performs the lookup.

Warning

If the method itself fails to function an exception will be raised! (for instance, if some command arguments are invalid, or there’s an internal error with the command, or a bug in the code).

Parameters:

arg (str) – What the method should get, such as an IP address or interface name. In the case of default_iface methods, this is not used and defaults to an empty string.

Return type:

Optional[str]

Returns:

The raw value the technique found, or None if nothing was found. It isn’t cleaned up, so it may not be a lowercase colon-separated MAC (get_mac_address() runs it through clean_mac()). For default_iface methods, it’s the name of an interface instead of a MAC.

test()[source]

Low-impact test that the method is feasible, e.g. a command exists.

Return type:

bool