Skip to content

est/trpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trpy - Traceroute in Python

A modern, fast, and feature-rich traceroute tool written in Python. It supports both IPv4 and IPv6, provides real-time jitter statistics, and includes IP geolocation.

Features

  • Interactive UI: A sleek curses-based interface that respects your terminal theme (transparent background).
  • Dual Stack: Smart A/AAAA record resolution with a priority for IPv4 (configurable via -6).
  • Jitter Statistics: Displays real-time average RTT and standard deviation (avg ms ± sd) for every hop.
  • Smart Path Discovery: Automatically hides redundant trailing hops once the target is reached.
  • Multi-IP Support: Handles multiple IP addresses per TTL hop with a clean multi-line display.
  • Geolocation: Integrated IP geolocation using the IPIP (17mon) database.
  • Streaming Mode: Use the -c flag to print every individual ICMP response in real-time.

Installation & Requirements

The tool requires raw socket access to send/receive ICMP packets.

Linux

Grant raw socket capabilities to the Python interpreter:

sudo setcap cap_net_raw+ep $(which python3)

macOS

Run with sudo or an equivalent privilege escalator:

sudo python cli.py google.com

Geolocation Database

To enable location lookups, ensure 17monipdb.dat is present in the project directory.

Usage

# Interactive mode (Continuous updates)
python cli.py google.com

# Force IPv6 trace
python cli.py -6 google.com

# Streaming/Batch mode (Send N pings per TTL and exit)
python cli.py -c 5 jd.com

Arguments

  • target: The host or IP to trace.
  • -c, --count: (Optional) Number of samples per TTL. If specified, the tool prints every ICMP and exits when done.
  • -6: (Optional) Force IPv6 resolution and traceroute.

Core Components

  • cli.py: The user interface, handling both Curses and streaming output.
  • core.py: The high-performance traceroute engine (ICMP packet construction, IPv4/v6 parsing, and path management).
  • ipip.py: IPIP database lookup utility.

Created as a lightweight, Pythonic alternative to MTR.

About

Traceroute in python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages