[Computer Networks] The Packet Sniffing Experiment
- Underlying library:
libpcap
for Unix andwinpcap
for Windows - Java wrapper:
Pap4J
- kaitoy/pcap4j
In order to capture traffic on your network interface, you'll need to set the correct permissions as stated here: Wireshark - you don't have permission to capture on that device mac
We use Maven as our dependency manager. Open the project via Intellij Idea, and let Maven do the rest.
Do note that the version of pcap4j
on Maven Central is bugged, see issues/220. To avoid this, follow the instructions mentioned here: pcap4j - issue 220 "How to use a SNAPSHOT version of the dependency via Maven."
链路层抓包及协议分析
利用 WinPcap 库实现数据链路层帧的捕获,显示分析帧结构及其所封装的各层包的结构。
无
(可以参考 Wireshark 的输出内容和格式)
- 首先屏幕显示当前配置的网络适配器,并要求选择捕获适配器编号;
- 按照捕获帧的层次关系显示以下信息:
- 数据链路层(MAC 子层)层结构及各个字段的值
- 网络层分组的格式及各个字段的值
- 运输层报文段的格式及各个字段的值
- 应用层报文格式及各个字段的值