Skip to content

Instantly share code, notes, and snippets.

@perone
Created October 5, 2012 00:21
Show Gist options
  • Save perone/3837297 to your computer and use it in GitHub Desktop.
Save perone/3837297 to your computer and use it in GitHub Desktop.
Scapy RTT
$~ sudo scapy
>>> from datetime import datetime
>>> pkt = IP(dst="www.google.com", ttl=1) / ICMP()
>>> ans,unans = sr(pkt*3)
Begin emission:
.**Finished to send 3 packets.
*
Received 4 packets, got 3 answers, remaining 0 packets
>>> sent = datetime.fromtimestamp(ans[0][0].sent_time)
>>> received = datetime.fromtimestamp(ans[0][1].time)
>>> print (received-sent)
0:00:00.001820
@Kash-A
Copy link

Kash-A commented Oct 9, 2017

How accurate is this RTT value. I am trying to calculate it via scapy and wireshark both. But values seem to differ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment