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.4.tar.gz (2.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: aiotraceroute-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 e987ef26fb41436a7e8ab82a6964309d0251d3f8c9ab132ecc018b1fe1922e92
MD5 d9f5f59b586a0ab7b63dac559f3bdd24
BLAKE2b-256 4fabbf56f0ce5fd60439369d464a1560203be73315fe867e3d000a161ea48ff2

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