Reputation: 1283
i want to get network interface name using device GUID.
i have a answer using "ipconfig /all"
with parsing interface name
but "ipconfig /all"
is very complex...
so i want to get like Getting friendly device names in python
but this only show usb driver..
i can find the GUID(actually i exalty don't know) followed code:
import netifaces as ni
x=ni.interfaces()
print x
this show like this ['{CDC97813-CC28-4260-BA1E-F0CE3081DEC7}']
i want to convert friendly device name like "local area connection"
Upvotes: 3
Views: 2105
Reputation: 56688
Instead of ipconfig /all
which is quite complex indeed, consider these much simpler, as far as output goes, commands:
>netsh interface show interface
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Connected Dedicated Wireless Network Connection
Enabled Disconnected Dedicated Local Area Connection
or
>netsh interface ip show interfaces
Idx Met MTU State Name
--- ---------- ---------- ------------ ---------------------------
13 25 1500 connected Wireless Network Connection
12 5 1500 disconnected Local Area Connection
These should be almost trivial to parse for an interface name
Upvotes: 4