How to get meaningful network interface names instead of GUIDs with netifaces under Windows?

前端 未结 6 810
天涯浪人
天涯浪人 2020-12-05 18:52

I use the netifaces module.

import netifaces
print netifaces.interfaces()

but this shows the result below:

 [\         


        
6条回答
  •  孤街浪徒
    2020-12-05 19:50

    Extending on MaxU answer

    More accurate/refined way

    Select Index from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True or (ServiceName<>'' 
                                                        AND ServiceName<>'AsyncMac' 
                                                        AND ServiceName<>'VMnetx' AND ServiceName<>'VMnetadapter' AND ServiceName<>'Rasl2tp' AND ServiceName<>'msloop' AND ServiceName<>'PptpMiniport' 
                                                        AND ServiceName<>'Raspti' AND ServiceName<>'NDISWan' AND ServiceName<>'NdisWan4' AND ServiceName<>'RasPppoe' 
                                                        AND ServiceName<>'NdisIP' AND Description<>'PPP Adapter.') AND MACAddress is not NULL
    

    and then fire a query with respect to

    SELECT * FROM Win32_NetworkAdapter where index= 
    

提交回复
热议问题