Skip to main content

Binds an IP-address to a subprocess through network namespaces - Linux only

Tested against Ubuntu / Python 3.11 + 3.10 / Anaconda

pip install pylinuxnetnamespace

Simplifies Network Namespace Management:

This library streamlines the process of creating and managing network namespaces and routing rules, reducing complexity and manual configuration efforts.

Effortless Command Execution:

With this library, executing commands within network namespaces becomes straightforward, allowing users to interact with isolated environments effortlessly.

Automation for Isolated Environments:

It provides a convenient way to automate the setup of isolated network environments, making it ideal for automating testing or development environments.

Streamlined Source NAT Configuration:

The library simplifies the configuration of Source NAT (SNAT) rules, a common requirement for network management.

Args:
	su_password (str): The superuser (sudo) password.
	networkip (str): The IP address to bind to the process.
	networkinterface (str, optional): The network interface to apply NAT rules to (default is 'eth0').
	nameserver (str, optional): The DNS nameserver IP address (default is '8.8.8.8').
	new_ip_start (str, optional): The starting IP address range for creating network interfaces (default is '192.168.').
	virtual_namespace_prefix (str, optional): The prefix for naming network namespaces (default is 'eth').

Returns:
	IpRun: An IpRun instance with the specified configuration.

Usage:
	# Create a bound subprocess that binds an IP address to a process using network namespaces.
	 from pylinuxnetnamespace import get_bound_subprocess_Popen
	bindedsubproc = get_bound_subprocess_Popen(su_password='1',
								   networkip='192.168.9.100',

								   networkinterface='enx344b50000000',
								   nameserver='8.8.8.8',
								   new_ip_start='192.168.',
								   virtual_namespace_prefix=f'eth')
	# bindedsubproc behaves like the subprocess.Popen class
	# you have to create it only once and can use it multiple times
	bindedsubproc('ping 1.1.1.1', shell=True)
	bindedsubproc('ping google.com', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Metadata

Release files for pylinuxnetnamespace 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylinuxnetnamespace 0.10
File Size Uploaded Provenance Actions
pylinuxnetnamespace-0.10.tar.gz 5.4 kB Without provenance Details for pylinuxnetnamespace-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pylinuxnetnamespace 0.10
File Interpreter ABI Platform Actions
pylinuxnetnamespace-0.10-py3-none-any.whl Python 3 none any Details for pylinuxnetnamespace-0.10-py3-none-any.whl

Total release size: 12.5 kB

Release files / pylinuxnetnamespace-0.10.tar.gz

Download URL pylinuxnetnamespace-0.10.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
585e96408ba00a7339ecee8f06f14346ab79738ace1f6d6aa161cd0b7f197099
BLAKE2b-256 checksum
How to use checksums
93fe90af5e203606707b541c15e36b9a08b7be159ed537cc8b9323812c6bc0b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / pylinuxnetnamespace-0.10-py3-none-any.whl

Download URL pylinuxnetnamespace-0.10-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a266817a572e54fae2282fedc6b45fca73f6fa1fdb3a6156df87bcd551aa70a
BLAKE2b-256 checksum
How to use checksums
5ad07f283af3062bdff1bda2baf0ca6fc267d962e4fc2bef1ac6822cb7013b7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for pylinuxnetnamespace 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page