Skip to main content

Convert ICMP Timestamp replies into human‑readable times and report clock offsets.

Project description

icmp-timestamp

A small toolkit to convert ICMP Timestamp (type 13/14) replies into human‑readable times and to report clock offsets.

This repository contains:

  • timecheck.py — a Python/Scapy-based tool that queries ICMP Timestamp and reports NTP-style offsets.
  • icmp-timestamp.sh — a Bash helper that converts numeric millisecond timestamps to human-readable UTC datetimes.
  • pry_bar.sh — a small driver that uses hping3 to probe hosts, parses RTT/timestamp values, and calls icmp-timestamp.sh.

Prerequisites

  • Python 3.8+ and pip (for timecheck.py).
  • scapy Python package (install via requirements.txt or directly).
  • hping3 for the Bash flow (pry_bar.sh and direct hping3 use).
  • Elevated privileges (root / sudo) are typically required to send/receive raw ICMP packets.

Install system packages (examples):

Debian / Ubuntu (For bash script using hping3)

sudo apt update
sudo apt install -y hping3

macOS (Homebrew)

brew install hping

Python (For Python script using scapy)

python3 -m pip install -r requirements.txt

With Pip

pip install icmp-timestamp

Using the Python tool (timecheck.py)

timecheck.py uses Scapy (AF_PACKET) to send ICMP Timestamp requests. It usually requires sudo.

Examples:

Query hosts from a file (one host per line)

sudo python3 timecheck.py hosts.txt

With a 3 second timeout and verbose per-host timing

sudo python3 timecheck.py hosts.txt --timeout 3 --verbose

Write results to CSV

sudo python3 timecheck.py hosts.txt --csv results.csv

timecheck.py prints a compact table of remote times, offsets vs local clock, RTTs, and a simple assessment.

Pythonversion

Using the Bash flow (hping3 + pry_bar.sh + icmp-timestamp.sh)

icmp-timestamp.sh can be used standalone to convert numeric millisecond timestamps into human-readable times. For example:

icmptimestamp

pry_bar.sh drives hping3, extracts round-trip min/avg/max values, and calls icmp-timestamp.sh which converts numeric millisecond timestamps into human-readable times.

Notes:

  • hping3 requires root privileges — run with sudo.
  • pry_bar.sh parses hping3 output for round-trip min/avg/max. It prints per-target RTTs and forwards them to icmp-timestamp.sh.
  • icmp-timestamp.sh expects numeric millisecond timestamps (or values parsed by pry_bar.sh) via -O (Originate), -R (Receive), -T (Transmit). Example:

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

icmp_timecheck-1.1.4.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icmp_timecheck-1.1.4-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file icmp_timecheck-1.1.4.tar.gz.

File metadata

  • Download URL: icmp_timecheck-1.1.4.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for icmp_timecheck-1.1.4.tar.gz
Algorithm Hash digest
SHA256 50091c6ebfb9ef7403053f0778152e101b35adafacb4b5909379022b589767db
MD5 9b3a9c46b8466a54b4642941e99e2a9d
BLAKE2b-256 8aaae70c6947947cd27af0f547415af0e1fa751be09b46b754abab1759c32c7a

See more details on using hashes here.

File details

Details for the file icmp_timecheck-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: icmp_timecheck-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for icmp_timecheck-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 664cefdccc1f82feb9f9b6ef778a103610b82bce94aa39fbf6ed06b9f8fd4709
MD5 4e4cf9c10b1235bdd2efcd27d59c2c45
BLAKE2b-256 d6c53290c75378c3e0c75fa22c35205d47aebef84a6f9bc56fdbc9a27370970c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page