Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting friendly device names in python with windows

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"

like image 564
Somputer Avatar asked Sep 24 '26 15:09

Somputer


1 Answers

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

like image 149
Andrei Avatar answered Sep 27 '26 05:09

Andrei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!