It looks like netifaces
leaves it up to us to pull the information out of the Windows Registry. The following functions work for me under Python 3.4 on Windows 8.1.
To get the connection name ...
import netifaces as ni
import winreg as wr
from pprint import pprint
def get_connection_name_from_guid(iface_guids):
iface_names = ['(unknown)' for i in range(len(iface_guids))]
reg = wr.ConnectRegistry(None, wr.HKEY_LOCAL_MACHINE)
reg_key = wr.OpenKey(reg, r'SYSTEM\CurrentControlSet\Control\Network\{4d36e972-e325-11ce-bfc1-08002be10318}')
for i in range(len(iface_guids)):
try:
reg_subkey = wr.OpenKey(reg_key, iface_guids[i] + r'\Connection')
iface_names[i] = wr.QueryValueEx(reg_subkey, 'Name')[0]
except FileNotFoundError:
pass
return iface_names
x = ni.interfaces()
pprint(get_connection_name_from_guid(x))
.. which on my machine produces:
['Local Area Connection* 12',
'Bluetooth Network Connection',
'Wi-Fi',
'Ethernet',
'VirtualBox Host-Only Network',
'(unknown)',
'isatap.{4E4150B0-643B-42EA-AEEA-A14FBD6B1844}',
'isatap.{BB05D283-4CBF-4514-B76C-7B7EBB2FC85B}']
To get the driver name ...
import netifaces as ni
import winreg as wr
from pprint import pprint
def get_driver_name_from_guid(iface_guids):
iface_names = ['(unknown)' for i in range(len(iface_guids))]
reg = wr.ConnectRegistry(None, wr.HKEY_LOCAL_MACHINE)
reg_key = wr.OpenKey(reg, r'SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}')
for i in range(wr.QueryInfoKey(reg_key)[0]):
subkey_name = wr.EnumKey(reg_key, i)
try:
reg_subkey = wr.OpenKey(reg_key, subkey_name)
guid = wr.QueryValueEx(reg_subkey, 'NetCfgInstanceId')[0]
try:
idx = iface_guids.index(guid)
iface_names[idx] = wr.QueryValueEx(reg_subkey, 'DriverDesc')[0]
except ValueError:
pass
except PermissionError:
pass
return iface_names
x = ni.interfaces()
pprint(get_driver_name_from_guid(x))
... which gives me:
['Microsoft Wi-Fi Direct Virtual Adapter',
'Bluetooth Device (Personal Area Network)',
'Dell Wireless 1395 WLAN Mini-Card',
'Broadcom 440x 10/100 Integrated Controller',
'VirtualBox Host-Only Ethernet Adapter',
'(unknown)',
'Microsoft ISATAP Adapter',
'Microsoft ISATAP Adapter']
psutil
. – Dmytro Ovdiienko