GhostofGoes Getmac Versions Save

Platform-independent pure-Python module to get a MAC address

0.9.4

1 year ago

Added

  • Support BusyBox's arping

Changed

  • Improve how ARP is handled. If ArpFile method succeeds, use it instead of ArpingHost (this should fix #86, for realsies this time).
  • Speed up the first call to ArpingHost
  • Fix FORCE_METHOD not being respected for IPv4 macs

0.9.3

1 year ago

Changed

  • Fix ArpFile method being used for IPv6 (/proc/net/arp, and ARP in general, is IPv4-only). Fixes #84

0.9.2

1 year ago

Announcement: Compatibility with Python versions older than 3.7 (2.7, 3.4, 3.5, and 3.6) is deprecated and will be removed in getmac 1.0.0. If you are stuck on an unsupported Python, consider loosely pinning the version of this package in your dependency list, e.g. getmac<1.0.0 or getmac~=0.9.0.

Changed

  • Fix flakyness with UuidArpGetNode on MacOS by making it the last method attempted (Fixes issue #82)

0.9.1

1 year ago

Announcement: Compatibility with Python versions older than 3.7 (2.7, 3.4, 3.5, and 3.6) is deprecated and will be removed in getmac 1.0.0. If you are stuck on an unsupported Python, consider loosely pinning the version of this package in your dependency list, e.g. getmac<1.0.0 or getmac~=0.9.0.

Changed

  • Deprecate Python 3.6 support (support will be removed in getmac 1.0.0)

Dev

  • Fix links in README and PyPI metadata to use "main" instead of "master" for primary branch
  • Remove "Documentation" link from PyPI (the ReadTheDocs site is broken and hasn't been updated since 0.5.0)
  • Add PyPI classifiers for 3.10 and 3.11
  • Some cleanup of CHANGELOG

0.9.0

1 year ago

Announcement: Compatibility with Python versions older than 3.6 (2.7, 3.4, and 3.5) is deprecated and will be removed in getmac 1.0.0. If you are stuck on an unsupported Python, consider loosely pinning the version of this package in your dependency list, e.g. getmac<1.0.0 or getmac~=0.9.0.

This release is a complete rewrite of getmac from the ground up.

Refer to docs/rewrite.md for a in-depth explanation of the rewrite changes.

The new system has a number of benefits

  • Reduction of false-positives and false-negatives by improving method selection accuracy (platform, validity, etc.)
  • Significantly faster overall
  • "Misses" have the same performance as "Hits"
  • Easier to test, since each method can be tested directly via it's class
  • Eaiser to type annotate and analyze with mypy
  • Easier to read, improving reviewability and ease of contributing for newcomers
  • Extensible! Custom methods can be defined and added at runtime (which is perfect if you have some particular edge case but aren't able to open-source it).

Added

  • Fully support Python 3.9 (automated tests in CI)
  • Tentatively support Python 3.10 and 3.11 (unable to test due to the need to be able to still test 2.7)
  • Added default interface detection for MacOS (command: route get default)
  • Added initial support for Solaris/SunOS. There were a few existing methods that worked as-is, so just added indicators that those methods support sunos (Which applies to any system where platform.system() == SunOS).
  • arping (POSIX) or SendARP (Windows) will now always be used instead of sending a UDP packet when looking for the MAC of a IPv4 host, if they're available and operable (otherwise, UDP + ARP table check will be used like before).
  • The amount of time taken to get a result (in seconds) will now be recorded and logged if debugging is enabled (DEBUG>=1 or -d)
  • Added command line argument to override the UDP port for network requests: --override-port (this was already possible in Python via getmac.getmac.PORT, but wasn't configurable via the CLI. Now it is!).
  • Added ability to override the detected platform via --override-platform argument (CLI) or getmac.getmac.OVERRIDE_PLATFORM variable (Python). This will force methods for that platform to be used, regardless of the actual platform. Here's an example forcing linux to be used as the platform: getmac -i eth0 --override-platform linux. In version 1.0.0, this feature will added as an argument to get_mac_address().
  • Added ability to force a specific method to be used via --force-method argument (CLI) or getmac.getmac.FORCE_METHOD variable (Python). This is useful for troubleshotting issues, general debugging, and testing changes. Example: getmac -v -dddd --ip 192.168.0.1 --force-method ctypeshost

Changed

  • Complete rewrite of getmac from the ground up. Refer to docs/rewrite.md for a in-depth explanation of the rewrite changes
  • Fixed a failure to look up a hostname now returns None, as expected, instead of raising an exception (socket.gaierror).
  • Fixed numerous false-negative and false-positive bugs
  • Improved overall performance
  • Performance for cases where no MAC is found is now the same as cases where a MAC is found (speed of "misses" now equals that of "hits")
  • Improved the reliability and performance of many methods
  • Fixed netstat on older Linux distros (such as Ubuntu 12.04)
  • Overhauled ifconfig parsing. It should now be far more reliable and accurate across all platforms.
  • Improved Android support. Note that newer devices are locked down and the amount of information that's obtainable by an unprivileged process is quite limited (Android 7/9 and newer, not sure exactly when they changed this, I'm not an Android guy). That being said, the normal Linux methods should work fine, provided you have the proper permissions (usually, root).
  • Fixed bug with /proc/net/route parsing (this affected Android and potentially other platforms)
  • Improve default interface detection for FreeBSD (command: route get default)

Removed

  • Removed man pages from distribution (getmac.1/getmac2.1). They were severely out of date and unused. May re-add at a later date.

Dev

  • Migrate CI to GitHub Actions, remove TravisCI and Appveyor
  • Add flake8 plugins: flake8-pytest-style and flake8-annotations
  • Add additional samples and tests for WSL1 (with the Ubuntu 18.04 distro)
  • Add additional samples for Windows 10
  • Add additional samples for MacOS
  • Add samples and tests for Ubuntu 12.04
  • Add samples for NetBSD 8 (support coming in a future release)
  • Add samples for Solaris 10 (support TBD)
  • Add samples for several versions of Android
  • Add new tests
  • Improve existing tests
  • Consolidate everything related to RPM packaging to packaging/rpm/. This stuff hasn't been updated since 0.6.0, may remove in the future and leave distro packaging to distro maintainers.

0.9.0b0

2 years ago

This pre-release is a complete rewrite of getmac from the ground up.

If you want to test the new changes, use the --pre argument to pip install

pip install --pre -U getmac

It's passing tests and seems to be operable. However, with a change this large there are inevitably issues that the tests or I don't catch, so I'm doing a series of pre-releases until I'm 99% confident in it's stability. Refer to docs/rewrite.md for a in-depth explanation of the rewrite changes.

See previous pre-releases or CHANGELOG.md to full details on this pre-release.

0.9.0a1

2 years ago

This pre-release is a complete rewrite of getmac from the ground up.

If you want to test the new changes, use the --pre argument to pip install

pip install --pre -U getmac

It's passing tests and seems to be operable. However, with a change this large there are inevitably issues that the tests or I don't catch, so I'm doing a series of pre-releases until I'm 99% confident in it's stability. Refer to docs/rewrite.md for a in-depth explanation of the rewrite changes.

The new system has a number of benefits

  • Reduction of false-positives and false-negatives by improving method selection accuracy (platform, validity, etc.)
  • Significantly faster overall
  • "Misses" have the same performance as "Hits"
  • Easier to test, since each method can be tested directly via it's class
  • Eaiser to type annotate and analyze with mypy
  • Easier to read, improving reviewability and ease of contributing for newcomers
  • Extensible! Custom methods can be defined and added at runtime (which is perfect if you have some particular edge case but aren't able to open-source it).

See CHANGELOG.md to full details on this pre-release.

0.8.3

2 years ago

Announcement: Compatibility with Python versions older than 3.6 (2.7, 3.4, and 3.5) is deprecated and will be removed in getmac 1.0.0. If you are stuck on an unsupported Python, considor loosely pinning the version of this package in your dependency list, e.g. getmac<1.

Changed

  • Added support for Thomas Habets' version of arping in addition to the existing iputils one (contributed by Ville Skyttä (@scop) in #52 and #54)
  • Added support for docker in network bridge mode (contributed by Tomasz Duda (@tomaszduda23) in #57)
  • Add CHANGELOG URL to PyPI metadata (contributed by Ville Skyttä (@scop) in #58)
  • Fixed code quality test suite errors (includes changes by Daniel Flanagan (@FlantasticDan) in #67)
  • Improved Android support (contributed by @emadmahdi in #71)
  • Minor code quality fixes (2 years of neglecting master branch)
  • Add Code of Conduct for project contributors
  • Add SECURITY.md for reporting security issues (e.g. vulnerabilities)
  • Deprecate Python 3.4 and 3.5
  • Issue deprecation message as a warning in addition to a log message

0.8.2

4 years ago

Announcement: Python 2 compatibility will be dropped in getmac 1.0.0, which will be finished sometime in 2020. If you are stuck on Python 2, consider loosely pinning the version in your dependencies list, e.g. getmac<1. I will continue to fix reported bugs and accept patches for the last release before 1.0.0, however active development will cease and new features will not be backported.

Changed

  • Added warning about Python 2 compatibility being dropped in 1.0.0
  • Officially support Python 3.8
  • Documented a known issue with looking up IP of a local interface on Linux/WSL (See the "Known Issues" section in the README)
  • Added remote host lookup using arping as last resort

Dev

  • Standardized formatting on Black
  • Lint additions: vulture, several Flake8 plugins
  • Pinned test dependencies (pytest 5 dropped Python 2 support)
  • Various quality-of-life improvements for contributors/developers

0.8.1

5 years ago

Changed

  • Fixed sockets being opened and not closed when ip or ip6 were used, which could lead to a ResourceWarning (GH-42)