Platform-independent pure-Python module to get a MAC address
MIT License
Bot releases are visible (Hide)
Thanks to @raymanP for the fix and their help with getting GitHub Actions healthy again!
Published by GhostofGoes over 1 year ago
arping
ArpFile
method succeeds, use it instead of ArpingHost
(this should fix #86, for realsies this time).ArpingHost
Published by GhostofGoes over 1 year ago
ArpFile
method being used for IPv6 (/proc/net/arp
, and ARP in general, is IPv4-only). Fixes #84Published by GhostofGoes over 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
.
Published by GhostofGoes over 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
.
Published by GhostofGoes over 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
route get default
)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).DEBUG>=1
or -d
)--override-port
(this was already possible in Python via getmac.getmac.PORT
, but wasn't configurable via the CLI. Now it is!).--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()
.--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
getmac
from the ground up. Refer to docs/rewrite.md
for a in-depth explanation of the rewrite changesNone
, as expected, instead of raising an exception (socket.gaierror
).netstat
on older Linux distros (such as Ubuntu 12.04)ifconfig
parsing. It should now be far more reliable and accurate across all platforms.root
)./proc/net/route
parsing (this affected Android and potentially other platforms)route get default
)getmac.1
/getmac2.1
). They were severely out of date and unused. May re-add at a later date.flake8-pytest-style
and flake8-annotations
packaging/rpm/
. This stuff hasn't been updated since 0.6.0, may remove in the future and leave distro packaging to distro maintainers.Published by GhostofGoes over 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.
Published by GhostofGoes over 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
See CHANGELOG.md to full details on this pre-release.
Published by GhostofGoes almost 3 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
.
arping
in addition to the existing iputils one (contributed by Ville Skyttä (@scop) in #52 and #54)Published by GhostofGoes almost 5 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.
arping
as last resortvulture
, several Flake8 pluginsPublished by GhostofGoes over 5 years ago
ip
or ip6
were used,ResourceWarning
(GH-42)Published by GhostofGoes over 5 years ago
print
(logger: getmac
)--no-network-requests
: -N
and --no-net
-v
/--verbose
RuntimeWarning
pytest
Published by GhostofGoes over 5 years ago
netifaces
, psutil
, scapy
, and arpreq
).warnings
module will only be imported if a error/warningpytest
for all tests now instead of unittest
Published by GhostofGoes about 6 years ago
network_request
is enabled (Credit: @cyberhobbes)getmac
. This applies to everything, includinggetmac.exe
.__future__
getmac.getmac.DEBUG
.Published by GhostofGoes about 6 years ago
argparse
if Python version is 2.6 or olderPublished by GhostofGoes about 6 years ago
arp
arpreq
packagewmic nic
get_mac_address(ip='10.0.0.100')
was 1.71 seconds.12.7 miliseconds
, with the special case of a unpopulatedping
command to send an ICMP packet to the host. This took time,getmac.PORT
.getmac.py
Published by GhostofGoes about 6 years ago
psutil
: Interface MACs on all platformsscapy
: Interface MACs and Remote MACs on all platformsnetifaces
: Interface MACs on Non-Windows platformsip neighbor show
, Abuse of uuid._arp_getnode()
lanscan -ai
(HP-UX)ip6
argument (IPv6 addresses)proc/net/arp
would return shorter addresses in the192.168.16.2
on Linux would instead return the MAC address of192.168.16.254
with no errors or warning whatsoever.ip
or route
commands available, or thenetifaces
Python module.Published by GhostofGoes about 6 years ago
Note: Nothing changed in 0.2.1, it was simply a workaround for PyPI not allowing changes without a new version.
Published by GhostofGoes over 6 years ago
get-mac
python -m getmac
arp_request
argument was renamed to network_request
Published by GhostofGoes over 6 years ago
--debug
-d
option from --no-network-requests