Quick Traceroute
Project description
Overview
This is a traceroute module written in Python. The module sends speculative probe packets and gets the results immediately. Currently, only IPv4 ICMP echo requests are supported as probe packets.
Installation
$ sudo pip install tsubame
Usage
Permission
You need to have super user privileges or set CAP_NET_RAW capability to the Python interpreter binary.
Programing Interface
from tsubame import traceroute
host = 'example.com'
tr = traceroute()
results = tr.probe(host, hop_limit=8, count=1, timeout=1.0, ident=None)
host
A target host name string or an IP address string.
hop_limit
Maximum number of hops. It must be an integer from 1 to 64.
count
The number of probe packets for each hop. It must be an integer from 1 to 4.
ident
Identifier for parallel execution. The size must be 2 bytes. A unique value must be set for each traceroute context. By default, the PID will be set.
Result Structure
Nested structure
[
[ first_probe, second_probe, ..., nth_probe ], # hop 1
[ first_probe, second_probe, ..., nth_probe ], # hop 2
...
[ first_probe, second_probe, ..., nth_probe ], # hop n
]
Each result item
If received a response,
(from_addr, delay_sec, is_target)
e.g.
('192.168.1.1', 0.0011992454528808594, False)
else
None
Example
Simple traceroute command
You can use as a traceroute command as follows.
$ sudo tsubame example.com
traceroute to example.com (93.184.216.34), 32 hops max
1 192.168.1.1 1.146 ms 1.374 ms 1.616 ms
2 * * *
3 * * *
4 * * *
5 * * *
6 111.87.3.234 118.376 ms 118.503 ms 119.928 ms
7 62.115.180.213 123.618 ms 123.894 ms 125.392 ms
8 62.115.155.89 120.319 ms 121.756 ms 122.066 ms
9 152.195.85.133 121.776 ms 123.551 ms 123.544 ms
10 93.184.216.34 127.130 ms 127.199 ms 129.053 ms
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 Distributions
Built Distribution
File details
Details for the file tsubame-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: tsubame-0.8.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 735cb846fe88290913102f9b18247b18ee2d667fc72ed34d0e3d0f8462954548 |
|
MD5 | 7203b35c8fcc6c5f8fb0f788ab0eb1e4 |
|
BLAKE2b-256 | 355f21980d79af3e56bedea05bb2c6103ee4ba5378cf1d253eaf8ee01d4fe470 |