-
Notifications
You must be signed in to change notification settings - Fork 0
IPTool TCP Ping
The tcp ping command provided by the iptool utility facilitates continuous monitoring of connection status through TCP/IP. It achieves this by systematically probing any user selected port within the full range of available ports, from 1 to 65535.

Issue the command iptool tcp ping --help to display the help page.
Usage:
iptool tcp ping <destination> [port] [flags]
Flags:
-a, --append append when writing to file with --output-file
-c, --count int number of packets to send (default infinite)
-C, --csv write output in CSV format
-d, --delay int delay between pings, in milliseconds (default 1000)
-h, --help help for ping
-o, --output-file string write output to file
-t, --timeout int time to wait for a response, in milliseconds (default 2000)
-v, --verbose show timestamps and mean round-trip time (mrtt)
The command accepts the following formats for specifying the destination and port:
-
<destination> <port>: Here, you provide the destination and port as separate arguments. For example, commandgithub.com 8080. -
<destination>:<port>: In this format, you specify the destination and port as a single argument, separated by a colon. For example, commandgithub.com:8080. -
<destination>: If you only provide the destination without a port, the command will default to using port 443. For example, commandgithub.com.
You can use the flags to adjust how the program displays the results. This allows you to customize the output to better suit your needs.
By default the command keeps pinging continuously until Ctrl-C is pressed.
Command
iptool tcp ping www.github.com
Output
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 443.
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=1 time=20.92ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=2 time=23.48ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=3 time=20.86ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=4 time=19.19ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=5 time=19.72ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=6 time=26.63ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=7 time=19.8ms
...
Use the --count (or -c) flag to enter the number of pings to run.
Command
iptool tcp ping www.github.com -c 3
Output
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 443.
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=1 time=19.04ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=2 time=20.08ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=3 time=20.25ms
^C
--- www.github.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2.09s
rtt min/avg/max/mdev = 19.04ms/19.79ms/20.25ms/320µs
Use the --delay (or -d) flag to define the amount of time to wait between pings, in milliseconds.
Command
Set the delay to 100 milliseconds, which is 10 pings per second.
iptool tcp ping www.github.com -d 100
Output
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 443.
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=1 time=18.81ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=2 time=20.15ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=3 time=19.17ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=4 time=19.57ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=5 time=19.07ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=6 time=18.63ms
^C
--- www.github.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 730ms
rtt min/avg/max/mdev = 18.63ms/19.24ms/20.15ms/320µs
Use the --timeout (or -t) flag to define the amount of time to wait until consider the packet lost.
Command
Set the timeout to 1000 milliseconds (default is 2000).
iptool tcp ping www.github.com:23 -t 1000
Output
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 23.
Request timeout for 140.82.121.3: port=23 timeout=1s
Request timeout for 140.82.121.3: port=23 timeout=1s
Request timeout for 140.82.121.3: port=23 timeout=1s
^C
--- www.github.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3.41s
rtt min/avg/max/mdev = 0s/0s/0s/0s
Use the --output-file (or -o) flag to save the output of the command to a text file.
Command
Save the output to the file gh.txt while simultaneously displaying the result in the terminal.
iptool tcp ping www.github.com -o gh.txt
Output (Terminal and File)
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 443.
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=1 time=18.27ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=2 time=19.23ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=3 time=19.13ms
^C
--- www.github.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2.14s
rtt min/avg/max/mdev = 18.27ms/18.88ms/19.23ms/240µs
Use the --append (or -a) flag in combination with --output-file (or -o) to append the output of the command to an already existing text file.
Command
Append the output to the file gh.txt while simultaneously displaying the result in the terminal.
iptool tcp ping www.github.com -o gh.txt --append
Use the --csv (or -C) flag in combination with --output-file (or -o) to save the output of the command to a comma-separated (CSV) file.
Command
Save the output to the file gh.csv while simultaneously displaying the result in the terminal.
iptool tcp ping www.github.com -o gh.csv --csv
Output (Terminal)
Initiating 3-way handshakes with www.github.com (140.82.121.3) on port 443.
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=1 time=19.2ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=2 time=20.03ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=3 time=18.48ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=4 time=19.32ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=5 time=19.1ms
Received SYN/ACK from 140.82.121.3: port=443 tcp_seq=6 time=21.35ms
Output (CSV File)
timestamp,host,ip,port,status,response_time_ms
2023-12-27 15:40:20.9837500,www.github.com,140.82.121.3,443,online,19.1982
2023-12-27 15:40:22.0344660,www.github.com,140.82.121.3,443,online,20.0289
2023-12-27 15:40:23.0593602,www.github.com,140.82.121.3,443,online,18.4826
2023-12-27 15:40:24.0875884,www.github.com,140.82.121.3,443,online,19.3159
2023-12-27 15:40:25.1147553,www.github.com,140.82.121.3,443,online,19.1024
2023-12-27 15:40:26.1439522,www.github.com,140.82.121.3,443,online,21.3546
Use the --verbose (or -v) flag to display more detailed output.
Command
iptool tcp ping www.github.com -v
Output
Initiating 3-way handshakes with www.github.com (140.82.121.4) on port 443.
[2023-12-27 15:23:31.1930595] Received SYN/ACK from 140.82.121.4: port=443 tcp_seq=1 time=18.62ms mrtt=18.62ms
[2023-12-27 15:23:32.2414083] Received SYN/ACK from 140.82.121.4: port=443 tcp_seq=2 time=18.74ms mrtt=18.68ms
[2023-12-27 15:23:33.2708860] Received SYN/ACK from 140.82.121.4: port=443 tcp_seq=3 time=20.15ms mrtt=19.17ms
[2023-12-27 15:23:34.2961796] Received SYN/ACK from 140.82.121.4: port=443 tcp_seq=4 time=18.14ms mrtt=18.91ms
...