routeparser: A route command output text parser
- It provides:
Reading text output of routes into Python objects
Simple identification of routes that match hosts or networks
- Installation:
pip install routeparser
- Usage:
example (where netstat_rn.txt is full output from ‘netstat -rn’ on Linux):
import routeparser # read lines from a file with open('netstat_rn.txt', 'r') as file_handle: lines = file_handle.readlines() # You can just get objects representing the routes if you wish: routes = routeparser.Route.from_linux_netstat_lines(lines) # These have attributes such as gateway, interface and network. # Some example values as in-line comments: routes[0].gateway # ipaddress.IPv4Address('192.168.1.1') routes[0].interface # 'eth0' routes[0].network # ipaddress.IPv4Network('10.10.0.0/16') # Route objects support membership testing: '10.10.10.1' in routes[0] # would return True, given the above example route # You can get a RoutingTable object from the lines: table = routeparser.RoutingTable.from_linux_netstat_lines(lines) # which you can then use to check for specific route matches: table.match('10.10.10.1') # would result in a matching Route object, if any # It supports string or Address/Network objects from the ipaddress module: import ipaddress table.match(ipaddress.ip_network('10.10.10.0/24')) # You can even get a list of all matching routes: table.matches('10.10.10.10') # Currently supported outputs and associated methods (for Route and RoutingTable) # Windows: # - 'route print': from_windows_route_print_lines # Linux: # - 'ip route': from_ip_route_lines # - 'netstat -r[nv]': from_linux_netstat_lines # - 'route [-n]': from_linux_route_lines
Metadata
Release files for routeparser 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| routeparser-0.1.0.tar.gz | 6.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| routeparser-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.1 kB
Release files / routeparser-0.1.0.tar.gz
| Download URL | routeparser-0.1.0.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
236ccc8de84000dcb577417336c47e1e908eb16215cce877ea24c2b4584b2147
|
|
BLAKE2b-256 checksum How to use checksums |
2f389ecda4cc0bd174d5bf9fff277d1499af94a4d47f5cbc896b9e7a47cf29d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Release files / routeparser-0.1.0-py3-none-any.whl
| Download URL | routeparser-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0e767af3f8619629fcb633c0ee3ca820d3e1b5e78f6927676700c7a6296bb28
|
|
BLAKE2b-256 checksum How to use checksums |
bf5bd630a2e8e01b3af4b86361ad70f35e85397e142aa9b7c1a38835bbc4d010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Security for routeparser 0.1.0
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.