Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tsubame-0.8.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file tsubame-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: tsubame-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.2

File hashes

Hashes for tsubame-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34e4735f6a6f3df864f554bb92cb816312e351f12298453f2b10d7fd6d0b2e8d
MD5 2d354ec771970465b7213078e7cc108b
BLAKE2b-256 2581149ca1be0bf97cea9104d918ce814b9085070f5a55de294e57826f9c714f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page