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

Uploaded Source

File details

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

File metadata

  • Download URL: aiotraceroute-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 c88ae09b2a6036ddb3fdb6da25a0433721b45a30583558a4e4d2ea45bd3ea986
MD5 263e19a131e2cbff8efb7b90530f9d39
BLAKE2b-256 57b79cee24476837185d65ee6327cf543d6cdeaeeb24ea5626d17863c323afa7

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