如何使用 libpcap 确定数据包方向? [英] How to determine packet direction using libpcap?
问题描述
我正在使用 libpcap 进行项目.现在,一旦我在回调函数中收到数据包,我就需要知道数据包的方向(入站或出站).我将编写方法来比较客户端之间的 IP 和 MAC 地址以及从数据包中提取的这些信息.我说得对吗?
I am working on project using libpcap. Now, I need to know the direction of packet (inbound or outbound) once I got the packet in callback function. I am going to write the methods to compare IP and MAC address between client and these information extract from packet. Am I right?
您能就这个问题给我一些意见或建议吗?
Could you please help me some comments or advices on this problem?
感谢您抽出宝贵时间.
推荐答案
源或目标 IP 地址就足够了.如果源是本地的,则它是出站的.如果目标是本地的,则它是入站的.如果两者都不是,那就是混杂的嗅探.
The source or target IP address is sufficient. If the source is local, it's outbound. If the target is local, it's inbound. If neither, it's a promiscuous sniff.
这篇关于如何使用 libpcap 确定数据包方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!