Constants

class getmac.variables.Constants[source]

Bases: VarsClass

Platform identifiers and other constants.

Attributes Summary

ANDROID

BSD

DARWIN

FREEBSD

HPUX

LINUX

If the system is running Linux (excluding WSL1).

MAC_RE_COLON

Regular expression pattern for MAC addresses with : (colon) characters.

MAC_RE_DASH

Regular expression pattern for MAC addresses with - (dash) characters.

MAC_RE_SHORT

On OSX, some MACs in arp output may have a single digit instead of two.

NETBSD

OPENBSD

PLATFORM

Generic platform identifier used for filtering methods.

SOLARIS

WINDOWS

WSL1

Windows Subsystem for Linux (WSL) version 1.

WSL2

Windows Subsystem for Linux (WSL) version 2.

Attributes Documentation

ANDROID: Final[bool]

Note

“Linux” methods apply to Android without modifications. If there’s Android-specific stuff then we can add a platform identifier for it.

BSD: Final[bool]

Note

This doesn’t include Darwin or Solaris as a “BSD”.

DARWIN: Final[bool] = False
FREEBSD: Final[bool] = False
HPUX: Final[bool] = False
LINUX: Final[bool]

If the system is running Linux (excluding WSL1).

MAC_RE_COLON: Final[str] = '([0-9a-fA-F]{2}(?::[0-9a-fA-F]{2}){5})'

Regular expression pattern for MAC addresses with : (colon) characters.

MAC_RE_DASH: Final[str] = '([0-9a-fA-F]{2}(?:-[0-9a-fA-F]{2}){5})'

Regular expression pattern for MAC addresses with - (dash) characters.

MAC_RE_SHORT: Final[str] = '([0-9a-fA-F]{1,2}(?::[0-9a-fA-F]{1,2}){5})'

On OSX, some MACs in arp output may have a single digit instead of two. This can also happen on other platforms, like Solaris.

Examples:

  • 18:4f:32:5a:64:5 (note the :5 at the end)

  • 14:cc:20:1a:99:0 (note the :0 at the end)

NETBSD: Final[bool] = False
OPENBSD: Final[bool] = False
PLATFORM: Final[str]

Generic platform identifier used for filtering methods.

# TODO: change “wsl” to “wsl1”, since WSL2 method should just work like normal linux

Possible values:

  • wsl

  • linux

  • windows

  • darwin

  • openbsd

  • freebsd

  • netbsd

  • sunos

  • hp-ux

  • Any other values that can be returned by platform.uname(),

    converted to lowercase.

SOLARIS: Final[bool] = False
WINDOWS: Final[bool] = False
WSL1: Final[bool]

Windows Subsystem for Linux (WSL) version 1. The version that’s a very cool abstraction layer remapping Linux syscalls to Windows syscalls.

WSL2: Final[bool]

Windows Subsystem for Linux (WSL) version 2. The version that’s basically a fancy Linux VM on Hyper-V.