I am totally new to python programming so please be patient with me.
Is there anyway to get the names of the NIC cards in the machine etc. eth0, lo? If so how do you
There is a python package get-nic which gives NIC status, up\down, ip addr, mac addr etc
pip install get-nic
from get_nic import getnic
getnic.interfaces()
Output: ["eth0", "wlo1"]
interfaces = getnic.interfaces()
getnic.ipaddr(interfaces)
Output:
{'lo': {'state': 'UNKNOWN', 'inet4': '127.0.0.1/8', 'inet6': '::1/128'}, 'enp3s0': {'state': 'DOWN', 'HWaddr': 'a4:5d:36:c2:34:3e'}, 'wlo1': {'state': 'UP', 'HWaddr': '48:d2:24:7f:63:10', 'inet4': '10.16.1.34/24', 'inet6': 'fe80::ab4a:95f7:26bd:82dd/64'}}
Refer GitHub page for more information: https://github.com/tech-novic/get-nic-details