wuchangming / https-mitm-proxy-handbook

基于Node.js的HTTPS MITM(中间人)代理的原理和实现
MIT License
445 stars 97 forks source link

chapter4 #3

Open nangua509 opened 6 years ago

nangua509 commented 6 years ago

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 Object.createSecureContext (_tls_common.js:122:7) at Server (_tls_wrap.js:867:27) at new Server (https.js:62:14) at createFakeHttpsWebSite (C:\Users\Administrator\Desktop\code\https-mitm-proxy-handbook\code\chapter4\createFakeHttpsWebSite.js:41:22) at Server.httpTunnel.on (C:\Users\Administrator\Desktop\code\https-mitm-proxy-handbook\code\chapter4\simpleHttpsProxy.js:34:3) at Server.emit (events.js:182:13) at onParserExecuteCommon (_http_server.js:535:14) at onParserExecute (_http_server.js:482:3)

在44行加了打印,并没有打印出来

SNICallback: (hostname, done) => { console.log(123) let certObj = createFakeCertificateByDomain(caKey, caCert, hostname) console.log(certObj);

我run在windows环境上 $ node -v v10.8.0

RonnieDuck commented 5 years ago

你可以参照第三节,可以发现他在创建伪https站点的时候,传入的cert参数没有通过pki.certificateToPem方法转换,key也是。转换一下就可以了

akzhou commented 4 years ago

你可以参照第三节,可以发现他在创建伪https站点的时候,传入的cert参数没有通过pki.certificateToPem方法转换,key也是。转换一下就可以了

转换一下确实不报错了,但是打开https://www.baidu.com,请求貌似没有发出去。

Camusama commented 1 year ago

node 降级到 6 试试