Asynchronous traceroute in python
Project description
Simple asynchronous traceroute
Dead simple module which provides asynchronous traceroute with asynchronous dns resolution.
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)
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.0.tar.gz
(2.4 kB
view details)
File details
Details for the file aiotraceroute-0.1.0.tar.gz
.
File metadata
- Download URL: aiotraceroute-0.1.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d15a7c5af2f2d65c72c895c71af539082240bbe1b3eea5800bdcbdad9ee28a79 |
|
MD5 | e73f41de4893652501ebc15b2fbebd6f |
|
BLAKE2b-256 | 44e72d4ffd9262c71504f2c2afb3f3e02bd0fcc8eaae5a2e7ae08f45bc801898 |