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 useshping3to probe hosts, parses RTT/timestamp values, and callsicmp-timestamp.sh.
Prerequisites
- Python 3.8+ and
pip(fortimecheck.py). scapyPython package (install viarequirements.txtor directly).hping3for the Bash flow (pry_bar.shand directhping3use).- 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.
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:
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:
hping3requires root privileges — run withsudo.pry_bar.shparseshping3output forround-trip min/avg/max. It prints per-target RTTs and forwards them toicmp-timestamp.sh.icmp-timestamp.shexpects numeric millisecond timestamps (or values parsed bypry_bar.sh) via-O(Originate),-R(Receive),-T(Transmit). Example:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file icmp_timecheck-1.1.3.tar.gz.
File metadata
- Download URL: icmp_timecheck-1.1.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdfc85bf3d23ce3f69fbf979eff3a3624dcf1165816c41ded1c691625ac93082
|
|
| MD5 |
7b0b6d358a09d5d96da7a613b35bd61e
|
|
| BLAKE2b-256 |
8d2623859e233032bfc94c783d340d23c21ad679ac4182853398ad8850c46c4b
|
File details
Details for the file icmp_timecheck-1.1.3-py3-none-any.whl.
File metadata
- Download URL: icmp_timecheck-1.1.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9f99bcce2d8c4868ca0edbd3ceb4c227f86b6471f5736b651f5aa40964b09a
|
|
| MD5 |
6a5ebf15fef03bacc5de7e9317f90766
|
|
| BLAKE2b-256 |
4aedc12d7c0e8ac90560c4d497f02b79a77e9b283ab921ecb85da4b4c5e9c871
|