Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In Windows this piece of code may be useful:</p> <pre> import os import sys import _winreg def main(): adapter_list_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards') adapter_count = _winreg.QueryInfoKey(adapter_list_key)[0] for i in xrange(adapter_count): sub_key_name = _winreg.EnumKey(adapter_list_key, i) adapter_key = _winreg.OpenKey(adapter_list_key, sub_key_name) (adapter_service_name, _) = _winreg.QueryValueEx(adapter_key, "ServiceName") (description, _) = _winreg.QueryValueEx(adapter_key, "Description") adapter_registry_path = os.path.join(r'SYSTEM\ControlSet001\Services', adapter_service_name, "Parameters", "Tcpip") adapter_service_key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, adapter_registry_path) (subnet_mask, _) = _winreg.QueryValueEx(adapter_service_key, "SubnetMask") (ip_address, _) = _winreg.QueryValueEx(adapter_service_key, "IpAddress") sys.stdout.write("Name: %s\n" % adapter_service_name) sys.stdout.write("Description: %s\n" % description) sys.stdout.write("SubnetMask: %s\n" % subnet_mask) sys.stdout.write("IpAdress: %s\n" % ip_address) if __name__ == "__main__": main() </pre> <p>Get network adapters list from <strong>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards</strong> registry key and than extract more info about each adapter from <strong>HKLM\SYSTEM\ControlSet001\Services{adapter_guid}\Parameters\Tcpip</strong> key. </p> <p>I test it on Windows XP with 2 virtual adapters, it works fine. Should work in 2000,2003, Vista too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload