cmd telnet 浏览 https 网页

今天幼稚的尝试了用 telnet 访问https网页,结果表明这个是不可能的。

但是google了一下发现还是有办法在命令行下浏览https网站。

大家都知道https是加密的,针对这个大家都知道有一个叫openssl的开源库,用这个就能做到cmd或者shell下浏览https网页。

下面用例子说明:(linux下的)

都知道https的默认端口是443,

openssl s_client -connect stunnel.org:443
# openssl s_client -connect stunnel.org:443
CONNECTED(00000003)
depth=0 /C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
verify error:num=18:self signed certificate
verify return:1
depth=0 /C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
verify return:1
---
Certificate chain
 0 s:/C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
   i:/C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFMDCCBBigAwIBAgIJAIGZrWMt6uVJMA0GCSqGSIb3DQEBBQUAMIHAMQswCQYD
VQQGEwJQTDEZMBcGA1UECBMQd29qLiBNYXpvd2llY2tpZTERMA8GA1UEBxMIV2Fy
c3phd2ExIzAhBgNVBAoTGk1vYmktQ29tIFBvbHNrYSBTcC4geiBvLm8uMR4wHAYD
VQQLExVDZXJ0aWZAY2F0ZSBBdXRob3JpdHkxFTATBgNVBAMTDHd3dy5taXJ0Lm5l
dDEnMCUGCSqGSIb3EQEJARYYTWljaGFsLlRyb2puYXJhQG1pcnQubmV0MB4XDTA4
MTIxNDE3NTA1N1oXDTE4MTIxMjE3NTA1N1owgcAxCzAJBgNVB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4IBAQCvoCcm88PPAs7LeDozWyyqekqrN3+CuEBWjtIZ
ajBivgYc3aqv7usXy1FwJCoOa5Vs9/WutBTHGRzK0Y3aiCWbjxjd8OlmhUTSjgtn
hrvhp/5fnxcKfl9trR0rQ/MM3D99gRPfPw+fBFzOetn4O32oEI58uz3wIFQRHJGy
qj4HSLtb9ByUhBEM10jFLthimploZdwoTgBzqcpHy/EmAZWPXy7HiR40HZZ9U9W6
q/2x95rHAmFvGD6wMGF/HHiTIKe+lCrXsSt90ZsfR2Zvf37hxkPaYMzygUoAMsqO
SlghIUApnSqDXHynxpV3r847coUQSASl1U9b0GzCsDXhcBQc
-----END CERTIFICATE-----
subject=/C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
issuer=/C=PL/ST=woj. Mazowieckie/L=Warszawa/O=Mobi-Com Polska Sp. z o.o./OU=Certificate Authority/CN=www.mirt.net/emailAddress=Michal.Trojnara@mirt.net
---
No client certificate CA names sent
---
SSL handshake has read 2031 bytes and written 319 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : DHE-RSA-AES256-SHA
    Session-ID: 34ED2C7A6D4285DCDC9F67EF9417D9298C6E9BFC1B2F7DBF0E2BA8D8A820CF43
    Session-ID-ctx: 
    Master-Key: 7997B83BB7626B9CB3F94A3AAE22EACB2FA7F6B6FE16EF7AA1B8C72E2918BF24978C4B7E9AE21120B4BEB1D8B4CA7D70
    Key-Arg   : None
    Krb5 Principal: None
    Start Time: 1380033616
    Timeout   : 300 (sec)
    Verify return code: 18 (self signed certificate)
---
//到这里就停住了,下面是用telnet浏览网页一摸一样。
GET /index.html HTTP/1.1
HOST: www.stunnel.org
//两个回车

HTTP/1.1 200 OK
Date: Tue, 24 Sep 2013 14:43:09 GMT
Server: Apache
X-Powered-By: PHP/5.4.4-14+deb7u4
Content-Length: 6439
Content-Type: text/html

一堆html代码,跟telnet一样。

One thought on “cmd telnet 浏览 https 网页

  1. Pingback: 请教https协议,443端口的网站如何开? - Apache - 开发者第2341986个问答

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>