getmac icon indicating copy to clipboard operation
getmac copied to clipboard

Windows 11 support

Open GhostofGoes opened this issue 3 years ago • 2 comments

Support and test Windows 11. I don't think any of the networking APIs or built-in tools changed in a significant way, so this is probably just a matter of collecting samples to add to the unit tests.

  • [x] Verify it works on Windows 11
  • [ ] Add Samples of command output for the same commands used on Windows 10
  • [ ] Add test cases for the new samples
  • [x] Add Windows 11 to supported platforms in README

GhostofGoes avatar Oct 29 '21 19:10 GhostofGoes

I haven't done all steps, but it seems to work for me for IPv4. Running on Windows 11, all patches installed. Running Python 3.10.4 from the Microsoft Store.

C:\src>ver

Microsoft Windows [Version 10.0.22000.593] <-- yes, it says 10, but it surely is win 11!

C:\src>mkdir getmac

C:\src>cd getmac

C:\src\getmac>python3 -m venv .venv

C:\src\getmac>.venv\Scripts\activate.bat

(.venv) C:\src\getmac>python3 --version
Python 3.10.4

(.venv) C:\src\getmac>pip install getmac==0.8.3
Collecting getmac==0.8.3
  Using cached getmac-0.8.3-py2.py3-none-any.whl (25 kB)
Installing collected packages: getmac
Successfully installed getmac-0.8.3


(.venv) C:\src\getmac>getmac
04:42:1a:cf:57:2c


(.venv) C:\src\getmac>ipconfig /all
...
Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : home
   Description . . . . . . . . . . . : Realtek USB GbE Family Controller
   Physical Address. . . . . . . . . : 04-42-1A-CF-57-2C
...


(.venv) C:\src\getmac>getmac -dd -4 192.168.178.1
DEBUG    Trying: 'arp.exe -a 192.168.178.1'
DEBUG    Result: 54-67-51-b8-13-7b

DEBUG    Raw MAC found: 54-67-51-b8-13-7b
54:67:51:b8:13:7b


(.venv) C:\src\getmac>arp -a

Interface: 192.168.178.53 --- 0x8
  Internet Address      Physical Address      Type
  192.168.178.1         54-67-51-b8-13-7b     dynamic
  ...


(.venv) C:\src\getmac>getmac -dd -6 fe80::56bf:64ff:fea3:6614
DEBUG    Trying: 'arp.exe -a fe80::56bf:64ff:fea3:6614'
DEBUG    Exception: Command 'C:\Windows\system32\arp.exe -a fe80::56bf:64ff:fea3:6614' returned non-zero exit status 1.
DEBUG    Traceback (most recent call last):
  File "C:\src\getmac\.venv\lib\site-packages\getmac\getmac.py", line 581, in _try_methods
    found = _search(m[0], _popen(m[2], arg), m[1])
  File "C:\src\getmac\.venv\lib\site-packages\getmac\getmac.py", line 280, in _popen
    return _call_proc(executable, args)
  File "C:\src\getmac\.venv\lib\site-packages\getmac\getmac.py", line 289, in _call_proc
    output = check_output(cmd, stderr=DEVNULL, env=ENV)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'C:\Windows\system32\arp.exe -a fe80::56bf:64ff:fea3:6614' returned non-zero exit status 1.

DEBUG    Raw MAC found: None

Please let me know if I can provide more information.

StevenLooman avatar Apr 12 '22 16:04 StevenLooman

Thanks for the testing! It appears there weren't any breaking changes going from 10=>11 in terms of basic commands, so I'll update the supported platforms list.

GhostofGoes avatar Apr 13 '22 21:04 GhostofGoes