A module for working with network interfaces in Linux
Project description
linux-networkinterfaces (v0.2.0) [https://github.com/newdaynewburner/linux-networkinterfaces]
By Brandon Hammond newdaynewburner@gmail.com
A module for working with network interfaces in Linux. It provides objects for controlling and getting information from the network interfaces on your system, using subprocess to execute system calls behind the scenes.
Quick Start Guide
Currently it supports working with wired and wireless interfaces, through the WiredInterface and WirelessInterface objects respectively, and there is also a superclass called Interface that is the parent of the WiredInterface and WirelessInterface objects, and it contains methods that are not specific to any particular interface type, and it can be used to create custom objects for other interface types like bridges and what not, although support for those will be added in the future. Below is a short usage example:
from linuxnetworkinterfaces import WiredInterface, WirelessInterface
wired = WiredInterface("eth0") # Controls the 'eth0' wired interface
wireless = WirelessInterface("wlan0", manager="networkmanager") # Controls the 'wlan0' wireless interface, which is controlled by the NetworkManager network manager
# Change the interfaces state
wired.set_state("up") # Bring it up
wired.set_state("down") # Take it down
# Show some attributes
state = wired.state # Current state
flags = wired,device_flags # Device flags that are currently set
print(state)
for flag in flags:
print(flag)
# Putting a wireless interface into and taking it out of monitor mode (NetworkManager friendly!)
# Starting monitor mode
wireless.stop_management() # FOR NETWORKMANAGER COMPATABILITY
wireless.set_state("down")
wireless.set_mode("monitor")
wireless.set_state("up")
# Stopping monitor mode
wireless.set_state("down")
wireless.set_mode("managed")
wireless.start_management() # FOR NETWORKMANAGER COMPATABILITY
Issues
If you have any problems, feature requests, or anything else just shoot me an email or open an issue on the module's GitHub page, typically I'll respond quickly.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linux_networkinterfaces-0.2.0.tar.gz.
File metadata
- Download URL: linux_networkinterfaces-0.2.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c825e5b0fe466f25041b1d5385269f2f4abdebada343849db4b2f971215c780
|
|
| MD5 |
0d45f129a4285c1ba40bfef8790bb305
|
|
| BLAKE2b-256 |
b4cb3f2159362775029c5cbbab5a66b659331232e8783be7a9cc3e340f13a1a4
|
File details
Details for the file linux_networkinterfaces-0.2.0-py3-none-any.whl.
File metadata
- Download URL: linux_networkinterfaces-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51982e3d01c2a54d3474e02648dc24e6373476b793ffa532c894d954727729ef
|
|
| MD5 |
51a99f6f1fe797470c8d76800f84bc22
|
|
| BLAKE2b-256 |
d47761ca0e83aec4877c9d6ab856386101f40096f631e3db65e3aa335e88f020
|