8

使用 nc 分析 HTTP 代理协议

 3 years ago
source link: https://phuker.github.io/netcat-http-proxy-protocol.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

最近洒家搞了一个代理服务器(参见折腾阿里云笔记)。以前 ƒɋ 的时候代理服务器都是开在 127.0.0.1,浏览器到代理服务器之间不会有中间人监听问题。现在代理服务器不在本机,洒家就突然想到了这些问题:HTTP 协议的代理服务器没有 HTTPS 站点的证书,无法和代理服务器建立 HTTPS 连接。但是浏览器成功地建立了 HTTPS 连接,代理服务器应该是一种透明代理的角色,那么 HTTP 协议是怎么实现透明代理的呢?使用 HTTP 的代理服务器,HTTPS 的通信安全吗?

以前洒家只知道 GET 方法的 HTTP 代理,如下图所示:

HTTP proxy protocol

洒家的困惑就在于这种方法无法建立 HTTPS 连接。因为这不是透明代理而是让代理服务器代为请求,由于代理服务器没有证书,显然无法建立 SSL/TLS 连接。

查了资料洒家了解到,还有一种方法是 CONNECT,这种方式可以访问 HTTPS 资源:

HTTP proxy protocol

总结

  1. 关于代理服务器的原理的文章、书籍满天飞,洒家就不复制粘贴了。

  2. nc、Burp Suite 手动发包和 Wireshark 抓包一样,都是学习原理的不错的实验方法。

文章推荐

为了避免复制粘贴制造重复多余的数据,洒家找到了一个博客,在介绍科普 HTTP 代理、HTTPS 证书等方面写得不错。


Advertisements

Comments


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK