https-mitm-proxy-handbook icon indicating copy to clipboard operation
https-mitm-proxy-handbook copied to clipboard

基于Node.js的HTTPS MITM(中间人)代理的原理和实现

Results 9 https-mitm-proxy-handbook issues
Sort by recently updated
recently updated
newest added

代码中已经用当前服务器名称的 key 和 cert 启动了一个 https 服务器,直接 listen 绑定一个端口返回即可。 SNICallback 是主要为了支持虚拟主机提供支持,可以使一个 IP 针对不同的 servername 同时部署多个证书。 如果中间人是一个固定的端口,这样可以使用 SNICallback,在此回调函数中处理不同域名的证书逻辑,这样做的好处是中间人服务器仅需绑定一个端口。

创建证书如果做一个文件缓存就好了,效率更高 感觉作者 我已经通过 chapter1 chapter2 chapter2 chapter4 做出了一个https抓包工具了 var fakeServer = new https.Server({ key: fakeCertObj.key, cert: fakeCertObj.cert, //此处代码是不是没的用? 去掉了好像也没什么问题 SNICallback: (hostname, done) => { let certObj = createFakeCertificateByDomain(caKey, caCert, hostname)...

我启动了一下Chapter4,有连接请求,但这个fakeServer.on('request'似乎没有任何反应: ```javascript fakeServer.on('request', (req, res) => { // 解析客户端请求 var urlObject = url.parse(req.url); let options = { protocol: 'https:', hostname: req.headers.host.split(':')[0], method: req.method, port: req.headers.host.split(':')[1] || 80, path: urlObject.path, headers:...

第2节跑得通,第4节请求没发出去的样子??

hello,我试着跑了一个chapter4的代码,碰到了以前错误,请问是什么情况? CONNECT v10.events.data.microsoft.com:443 _tls_common.js:61 throw new ERR_INVALID_ARG_TYPE( ^ TypeError [ERR_INVALID_ARG_TYPE]: The "options.cert" property must be one of type string, Buffer, TypedArray, or DataView. Received type object at validateKeyCert (_tls_common.js:61:11) at...

![image](https://user-images.githubusercontent.com/1677247/58534330-8fd0d080-821d-11e9-83c0-593e0005c6ca.png)

在代码Chapter4中只实现了返回伪造的响应内容,要如何才能获取到真实请求地址的响应HTML代码呢? 如果可以希望你指点一下,非常感谢。 还有一处疑问,为什么这在SNICallback回调中又要重新再生成一次证书呢?不能直接使用上文的fakeCertObj证书吗? ```javascript var fakeServer = new https.Server({ key: fakeCertObj.key, cert: fakeCertObj.cert, SNICallback: (hostname, cback) => { let certObj = createFakeCertificateByDomain(caKey, caCert, hostname); cback(null, tls.createSecureContext({ key: pki.privateKeyToPem(certObj.key), cert: pki.certificateToPem(certObj.cert)...

既然已经使用proxyRes.pipe(res)了,为什么还要在前面加个res.writeHead(proxyRes.statusCode);呢?

https-mitm-proxy-handbook/doc/Chapter3.md 是否能加个 OpenSSL 的演示代码呢 ?网上很少正确而且完整的示例。谢谢!

enhancement