简体   繁体   English

如果使用https协议,是否可以使用libpcap查看标头/数据包中的内容

[英]Is it possible to see what is in header/packet using libpcap in case of https protocol

I am using iptables string match + libnetfilter_queue library to monitor http requests and responses. 我正在使用iptables字符串匹配+ libnetfilter_queue库来监视http请求和响应。 But later on I realized that string match fails in case of https protocol as iptable captures packets at layer 3. Now, i am reimplementing it using libpcap. 但是后来我意识到在https协议的情况下字符串匹配会失败,因为iptable会在第3层捕获数据包。现在,我正在使用libpcap重新实现它。 So, is it possible to see what is in header/packet using libpcap in case of https protocol 因此,在使用https协议的情况下,是否可以使用libpcap查看标头/数据包中的内容

HTTPS uses the SSL protocol which encrypts information at the application layer (the highest layer in the OSI model). HTTPS使用SSL协议,该协议在应用程序层(OSI模型中的最高层)对信息进行加密。 As such, the answer is no, libpcap will not help you see the contents. 因此,答案是否定的,libpcap不会帮助您查看内容。 If it were possible, it would pretty much defeat the purpose of using SSL in the first place. 如果可能的话,这将首先破坏使用SSL的目的。

否。如果可能,HTTPS将不安全,这是它存在的唯一原因。

If you're watching the traffic between your machine and another machine, you may be able to decrypt the SSL traffic (after all, the browser on your machine can do so), but it's not easy - Wireshark can do it if it has the necessary key information , but the code to do that is somewhat complicated (I won't be able to help you figure it out, so you're on your own there), and it might not always be able to do the decryption. 如果您正在观察一台计算机与另一台计算机之间的流量,则可以解密SSL流量(毕竟,计算机上的浏览器可以解密),但这并不容易-Wireshark可以解密必要的关键信息 ,但是执行该操作的代码有些复杂(我将无法帮助您解决问题,因此您只能靠自己在那儿),并且它可能并不总是能够进行解密。

If you're watching the traffic between two other machines, you'd need to get the keys from those machines (if you could do it without those keys, then, as others have noted, SSL wouldn't be very useful, as its whole purpose is to hide traffic from other people). 如果您正在观察其他两台计算机之间的通信,则需要从这些计算机上获取密钥(如果没有这些密钥就可以这样做,那么,正如其他人所指出的那样,SSL并不是很有用,因为整个目的是为了掩盖其他人的访问量)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM