Closed lynxthecat closed 2 years ago
I will need to look further into this
After having looked into this, the issue is not strictly related with pythonping. Starting with Python 3.8, the way to use timestamps and also converting integers to bytes have changed. I have updated the documentation on the website accordingly, here's a snippet.
import time
ping('8.8.8.8', payload=int(round(time.time())).to_bytes(10, 'little'))
# Use this instead for Python prior to 3.8
ping('8.8.8.8', count=1, payload=bytes(time.clock())
But that does not appear to send an ICMP type 13 request - this gives:
19:08:14.380960 IP (tos 0x0, ttl 64, id 62775, offset 0, flags [DF], proto ICMP (1), length 38)
XX > dns9.quad9.net: ICMP echo request, id 14902, seq 256, length 18
0x0000: 4500 0026 f537 4000 4001 4f91 0a03 d9f9 E..&.7@.@.O.....
0x0010: 0909 0909 0800 9042 3a36 0100 0e24 1e63 .......B:6...$.c
0x0020: 0000 0000 0000 ......
19:08:14.440312 IP (tos 0x28, ttl 55, id 1898, offset 0, flags [none], proto ICMP (1), length 38)
dns9.quad9.net > XX: ICMP echo reply, id 14902, seq 256, length 18
0x0000: 4528 0026 076a 0000 3701 8637 0909 0909 E(.&.j..7..7....
0x0010: 0a03 d9f9 0000 9842 3a36 0100 0e24 1e63 .......B:6...$.c
0x0020: 0000 0000 0000 0000 0000 2020 2020 ..............
Can pythonping be used to send ICMP type 13 and obtain response? Such a request and response looks like:
19:08:26.793928 IP (tos 0x0, ttl 64, id 49458, offset 0, flags [none], proto ICMP (1), length 40)
XX > dns9.quad9.net: ICMP time stamp query id 10357 seq 1, length 20
0x0000: 4500 0028 c132 0000 4001 c394 0a03 d9f9 E..(.2..@.......
0x0010: 0909 0909 0d00 ca89 2875 0001 0000 0000 ........(u......
0x0020: 0000 0000 0000 0000 ........
19:08:26.867474 IP (tos 0x28, ttl 55, id 7782, offset 0, flags [none], proto ICMP (1), length 40)
dns9.quad9.net > XX: ICMP time stamp reply id 10357 seq 1: org 00:00:00.000, recv 18:08:26.837, xmit 18:08:26.837, length 20
0x0000: 4528 0028 1e66 0000 3701 6f39 0909 0909 E(.(.f..7.o9....
0x0010: 0a03 d9f9 0e00 c016 2875 0001 0000 0000 ........(u......
0x0020: 03e4 80d5 03e4 80d5 0000 2020 2020 ..............
The example given here:
https://www.ictshore.com/python/python-ping-tutorial/
ping('8.8.8.8', count=1, payload=bytes(time.clock())
No longer works.
What is the up to date equivalent?
I am trying to see if I can use pythonping to send ICMP type 13 requests and then read the responses to ascertain one way delays.
Is this possible?