Parse ifconfig output and retrieve values
Project description
Parse ifconfig output collected from local or remote server and retrive required interface information.
Usage
Install ifconfig-parser:
pip install ifparser
You can access inferface information as below :
>>> import commands
>>> from ifparser import Ifcfg
>>> ifdata = Ifcfg(commands.getoutput('ifconfig -a'))
>>> ifdata.interfaces
['lo', 'docker0', 'eth0']
>>> eth0 = ifdata.get_interface('eth0')
>>> eth0.BROADCAST
True
>> eth0.hwaddr, eth0.mtu, eth0.ip, eth0.UP
('08:00:27:1f:d8:b0', '1500', '10.0.2.15', True)
>> eth0.get_values()
{'BROADCAST': True,
'LOOPBACK': False,
'MULTICAST': True,
'RUNNING': True,
'UP': True,
'bcast': '10.10.2.255',
'hwaddr': 'FF:FF:27:1f:d8:b0',
'interface': 'eth0',
'ip': '10.10.2.15',
'itype': 'Ethernet',
'mask': '255.255.255.0',
'mtu': '1500',
'rxbytes': '547873',
'rxpkts': '628',
'txbytes': '50826',
'txpkts': '424'}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ifparser-0.1.0.tar.gz
(5.0 kB
view details)
File details
Details for the file ifparser-0.1.0.tar.gz.
File metadata
- Download URL: ifparser-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d91a6740bd9b3f762105d7215a886c3dc2a865ed9b5b236ae4520fd4391d82d
|
|
| MD5 |
134824031f460d7b6dad8147fa040eff
|
|
| BLAKE2b-256 |
707811c14c1e56a666061071b2a18f4acbd3bf80e0d18ea0bd372115382160fa
|