[Python] Get ipconfig result with python in windows

Discussão em 'Python' iniciado por Stack, Agosto 14, 2025.

  1. Stack

    Stack Membro Participativo

    I am new here and just learning python. I need help to get the right mac-address of my network card in windows using python. I tried to search, and found these :


    1. Python - Get mac address


    2. Getting MAC Address


    3. Command output parsing in Python


    4. Parsing windows 'ipconfig /all' output

    If I run "ipconfig /all" from command prompt, I get this :

    Windows-IP-Konfiguration
    Hostname . . . . . . . . . . . . : DESKTOP-CIRBA63
    Primäres DNS-Suffix . . . . . . . :
    Knotentyp . . . . . . . . . . . . : Hybrid
    IP-Routing aktiviert . . . . . . : Nein
    WINS-Proxy aktiviert . . . . . . : Nein

    Ethernet-Adapter Ethernet:
    Verbindungsspezifisches DNS-Suffix:
    Beschreibung. . . . . . . . . . . : Realtek PCIe FE Family Controller
    Physische Adresse . . . . . . . . : 32-A5-2C-0B-14-D9
    DHCP aktiviert. . . . . . . . . . : Nein
    Autokonfiguration aktiviert . . . : Ja
    IPv4-Adresse . . . . . . . . . . : 192.168.142.35(Bevorzugt)
    Subnetzmaske . . . . . . . . . . : 255.255.255.0
    Standardgateway . . . . . . . . . : 192.168.142.1
    DNS-Server . . . . . . . . . . . : 8.8.8.8
    8.8.4.4
    NetBIOS über TCP/IP . . . . . . . : Deaktiviert

    Ethernet-Adapter Ethernet 2:
    Medienstatus. . . . . . . . . . . : Medium getrennt
    Verbindungsspezifisches DNS-Suffix:
    Beschreibung. . . . . . . . . . . : Norton Security Data Escort Adapter
    Physische Adresse . . . . . . . . : 00-CE-35-1B-77-5A
    DHCP aktiviert. . . . . . . . . . : Ja
    Autokonfiguration aktiviert . . . : Ja

    Tunneladapter isatap.{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}:
    Medienstatus. . . . . . . . . . . : Medium getrennt
    Verbindungsspezifisches DNS-Suffix:
    Beschreibung. . . . . . . . . . . : Microsoft ISATAP Adapter
    Physische Adresse . . . . . . . . : 00-00-00-00-00-00-00-A0
    DHCP aktiviert. . . . . . . . . . : Nein
    Autokonfiguration aktiviert . . . : Ja


    I need to get the mac address of my Realtek network card (32-A5-2C-0B-14-D9), not the one created by Norton or windows tunneling. Python gave me another result of mac address if i am using : "uuid.getnode() or "getmac" I think the best way is to get the output of "ipconfig /all", looking at "Realtek" at "Beschreibung" and then get the "Physische Adresse" information to get my real mac address. How to do this in python on windows ? Any help is appreciated. Thanks in advance.

    Continue reading...

Compartilhe esta Página