scapy 和 pcapy 帮助
我是 scapy 和 pcapy 的新手。作为一个项目,我必须使用 scapy 发送 ICMP 数据包并使用 pcapy 捕获它。我必须比较发送者和接收者之间的时间戳来计算网络延迟。
我不知道我该怎么做。任何帮助将不胜感激。
谢谢。
我使用以下命令将 ICMP 数据包发送到我使用类型 13 作为时间戳的目的地。
a=IP(dst="172.24.50.76")/ICMP(类型=13)
<块引用> <块引用>sr1(a) 开始发射: 已发送 1 个数据包。收到 1 个数据包,得到 1 个答复,剩余 0 个数据包
ts_ori=22:40:35.556 ts_rx=526:4:13.700 ts_tx=526:4:13.700
1) 上面的 ts_rx 和 ts_tx 时间戳显示的是同一时间,那么如何计算延迟呢? 2)其次,当我计算不同数据包大小的延迟时,如何增加数据包的大小。
我希望你清楚。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上,将发送方的当前时间插入到您的有效负载中,然后将其与接收数据包的时间进行比较。这将需要两台计算机上的时钟同步(例如,使用 NTP)。您还需要考虑发送方操作系统从代码中获取数据包并实际发送所需的时间,以及接收方解析传入数据包并将其提供给您的代码所需的时间。
或者,您也可以使用 ICMP Timestamp 消息执行某些操作。
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.