0

I am new to scapy and pcapy. As a project I have to send an ICMP packet using scapy and capture it using pcapy. I have to compare timestamp between sender and receiver to calculate delay in network.

I have no clue how can I do this. Any help will be greatly appreciated.

Thank you.

Following command i used to send ICMP packet to destination where i have used type 13 for timestamp.

a=IP(dst="172.24.50.76")/ICMP(type=13)

sr1(a) Begin emission: Finished to send 1 packets.Received 1 packets, got 1 answers, remaining 0 packets

ts_ori=22:40:35.556 ts_rx=526:4:13.700 ts_tx=526:4:13.700

1)Above ts_rx and ts_tx timestamp showing the same time, so how can calculate delay? 2)Secondly how can i increase the size of packet as I hv to calculate delay with different packet size.

I hope it is clear to you.

Community
  • 1
  • 1
Chetan
  • 141
  • 1
  • 1
  • 4
  • In general, you'll get better answers here if you actually give it a go and ask specific questions about what problems you have, rather than expecting others to do the basic research for you. Having said that, I've given an answer with a couple of general suggestions of things you could look at. – Blair Jun 18 '11 at 23:20

1 Answers1

2

Basically, insert the current time at the sender into your payload and then compare it with the time when the packet was received. This will require the clocks on the two machines to be synchronised (e.g., with NTP). You will also need to take into account the time it takes the OS on the sender to take the packet from your code and actually send it, and the time for the receiver to parse the incoming packet and give it to your code.

Alternatively, you might be able to do something with the ICMP Timestamp message.

Blair
  • 15,356
  • 7
  • 46
  • 56
  • @ Blair THank you for your reply. I am very sorry for incomplete info, I have done research.I used ICMP timestamp and send it to dst IP address in my school LAN with type13. – Chetan Jun 22 '11 at 23:01
  • a=IP(dst="172.24.50.76")/ICMP(type=13) >>> sr1(a) Begin emission: Finished to send 1 packets.Received 1 packets, got 1 answers, remaining 0 packets – Chetan Jun 22 '11 at 23:04
  • @Chetan I'm not sure off the top of my head, its not something I've ever played with myself. Instead of putting extra information in comments (where the code is practically impossible to read) you should edit your original question and put it there. – Blair Jun 22 '11 at 23:49