Tag: wireshark

读取savefiles时,linktype 1上不支持入站/出站

从pcap文件获取传入数据包。 我在pcap_compile()中设置了“入站”filter,这里是部分代码。 pcap = pcap_open_offline(“test.pcap”, errbuf); if (pcap == NULL) { fprintf(stderr, “error reading pcap file: %s\n”, errbuf); exit(1); } char filter_exp[] = “inbound”; struct bpf_program pgm; if (pcap_compile(pcap, &pgm, filter_exp, 0, PCAP_NETMASK_UNKNOWN) == -1) { printf(“Bad filter – %s\n”, pcap_geterr(pcap)); return 1; } if (pcap_setfilter(pcap, &pgm) == -1) { printf(“Error setting filter – %s\n”, […]

设计EAP-TLS客户端问候消息

我正在尝试设计启动EAP-TLS握手的第一个数据包。 这就是我的数据包当前的样子: 我通过在C中手动填充具有相应信息的缓冲区来设计EAP部分。 我使用OpenSSL派生的TLS部分,如本问题所示。 然后我去了RFC并在数据包中添加了4个八位字节长度字段和TLS标志。 但wireshark拒绝接受它! 我尝试逐字节地将TLS数据与通过TCP发生的TLS连接进行比较,我可以看到客户端hello(hex为16),TLS版本(0x0301:TLS 1.0)的字段顺序相同。 你能帮我辨别我哪里出错吗? 谢谢! 此外,如果有人知道一个客户端可以生成这些消息,所以我可以比较它们,这也是有益的。 谢谢!

使用libpcap读取纳秒pcap文件

我有一个纳秒的libpcap(nanosec.pcap)文件,并且可以使用Wireshark显示纳秒时间戳(例如2.123456789)。 现在我想用C语言打开纳秒级libpcap文件,源代码如下。 当我尝试使用pcap_open_offine()打开nanosec.pcap时,它将返回“未知文件格式”错误。 此外,通过将nanosec.pcap标头处的幻数更改为普通pcap(0x1A2B3C4D)的幻数,我从终端(Ubuntu)获得了分段错误。 这里的任何专家都可以建议如何使用libpcap显示时间戳的纳秒部分? 提前致谢! 以下是代码: #include #include #include #include #include #include #include #include struct UDP_hdr { u_short uh_sport; /* source port */ u_short uh_dport; /* destination port */ u_short uh_ulen; /* datagram length */ u_short uh_sum; /* datagram checksum */ }; /* Some helper functions, which we define at the end of this […]

如何使用基于OpenSSL的客户端提取预主密钥?

我有一个使用OpenSSL 1.0.2的应用程序,我想用Wireshark检查流量。 Wireshark可以(据称)解密TLS对话,前提是您提供了预主密钥。 如果我使用像TLS_RSA_WITH_AES_256_CBC_SHA256这样的密码套件; 任何人都可以告诉我如何从SSL或SSL_CTX结构中获取pre-master秘密? 我可以在SSL对象中破解不透明的结构 – 这不适用于产品中的任何产品; 我只是想知道如何为Wireshark填充一个pre-master密文件。