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.3.tar.gz
(2.5 kB
view details)
File details
Details for the file aiotraceroute-0.1.3.tar.gz
.
File metadata
- Download URL: aiotraceroute-0.1.3.tar.gz
- Upload date:
- Size: 2.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5352f4d4abba54bd62b2071cf3e3329c5348d694d8d862623d742be77b378ceb |
|
MD5 | df5c87adf81dae25011558e4662bb724 |
|
BLAKE2b-256 | 12d5fcc015ae9846642452ff9b0be7e23688708892e2f2d425385ffc3c10ad47 |