Skip to main content

Asynchronous traceroute in python

Project description

Simple asynchronous traceroute

Dead simple module which provides asynchronous traceroute with asynchronous dns resolution. Needs root privileges to be executed (for raw socket)

Example

import asyncio
from aiotraceroute import AsyncTraceroute

async def main(dest):
	# print hop by hop
	async for n, addr, host in AsyncTraceroute(dest):
		print(n, addr, host)

	# Or run it without iterating
	tr = AsyncTraceroute(dest)
	result = await tr.run()
	print(result)

asyncio.get_event_loop().run_until_complete(main("google.com"))

API

The AsyncTraceroute class takes the following arguments:

  • dest: Traceroute destination, can either be a hostname or an IP address.
  • port: Destination port (optionnal, default: 33333)
  • max_hops: Maximum number of hops before reaching final destination (optionnal, default: 30)
  • timeout: Timeout between each hop (optionnal: default: 1s)
  • packet_size: Pakcte size in bytes to send each time (optionnal: default: 60)

The run() method runs the traceroute and returns a list of tuples containing (hop_number, address or None, hostname or None)

Python versions

Python >= 3.6 are supported

Project details


Download files

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

Source Distribution

aiotraceroute-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file aiotraceroute-0.1.1.tar.gz.

File metadata

  • Download URL: aiotraceroute-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

File hashes

Hashes for aiotraceroute-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ad893950e6e37aad2992dbe176dc7d39dbbd92bdd931b00085e1d8a2b4e5f561
MD5 b13d11eebeac300f57d406348ba551b5
BLAKE2b-256 53fd07ff1c68fefa7d47044a4022b02065f932e8444c30a6e2aa93298c084152

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