API¶
Full API reference for the getmac package.
getmac.getmac Module¶
Get the MAC address of remote hosts or network interfaces.
It provides a platform-independent interface to get the MAC addresses of:
System network interfaces (by interface name)
Remote hosts on the local network (by IPv4/IPv6 address or hostname)
The key function is get_mac_address().
from getmac import get_mac_address
eth_mac = get_mac_address(interface="eth0")
win_mac = get_mac_address(interface="Ethernet 3")
ip_mac = get_mac_address(ip="192.168.0.1")
ip6_mac = get_mac_address(ip6="::1")
host_mac = get_mac_address(hostname="localhost")
updated_mac = get_mac_address(ip="10.0.0.1", network_request=True)
Functions¶
|
Query for a MAC using a specific method. |
Get the name of the default network interface on the system. |
|
|
Get the class for a named |
|
Get a MAC address from a local interface or remote host. |
|
|
|
Initialize the method cache for the given method type. |
Classes¶
|
Query the Windows ARP table using |
|
Use the contents of |
Use the |
|
Use the |
|
Use the |
|
Use |
|
Uses |
|
Use |
|
Determine the default interface on FreeBSD using the |
|
Determine the default interface using the |
|
Determine the default interface by parsing the |
|
Determine the default interface on OpenBSD using the |
|
Determine default interface using the |
|
Determine default interface using the |
|
Uses |
|
Uses Windows-builtin |
|
Determine interface MAC using |
|
Wild 'Shot in the Dark' attempt at using |
|
|
|
Determines interface MAC using the |
|
Uses the |
|
Uses |
|
Uses the |
|
|
Base class defining a method to get a MAC address. |
Determines interface MAC using the |
|
Uses the contents of |
|
|
Use |
getmac.variables Module¶
Global variables, constants, and settings for the getmac package.
Classes¶
getmac.utils Module¶
Utility and helper functions. These are basic in functionality and should be relatively standalone. They are intended for internal use by getmac.
Functions¶
|
Wrapper around |
|
Check if a command exists using |
|
Check if the file pointed to by |
|
Check and format a string result to be lowercase colon-separated MAC. |
Determine the IP address of the default network interface. |
|
|
Execute a command with arguments and return the stdout (stderr is discarded). |
|
Open and read a file. |
|
Search for a regular expression in a string, and return the specified group. |