如何查找网站是否使用HSTS

Den*_*oss 10 https curl header

我完全不知道卷曲,并试图确定网站是否使用Strict-Transport-Security.

我正在逃避建议.我被告知要检查Chrome的预加载列表并运行

curl -D - https://www.example.com | head -n 20
Run Code Online (Sandbox Code Playgroud)

检查Strict-Transport-Security标头.

但是'head'命令产生了一个错误并且未知.

有任何想法吗?

ATM我正在运行Win XP,几天后就会有一个Linux发行版.

谢谢.

Fau*_*aux 23

那方法很好.

$ curl -s -D- https://paypal.com/ | grep Strict
Strict-Transport-Security: max-age=14400
Run Code Online (Sandbox Code Playgroud)

正如您所注意到的,一些网络服务器只是拒绝接受HEAD请求. curl将打印GET请求的标题-v:

$ curl -s -vv https://paypal.com/ 2>&1 | grep Strict
< Strict-Transport-Security: max-age=14400
Run Code Online (Sandbox Code Playgroud)

<意味着标头是服务器返回给您的标头.

实际情况example.com,如您的示例所示,将无法正常工作,因为它根本不会监听https://:

$ curl -D- https://www.example.com
curl: (7) couldn't connect to host
Run Code Online (Sandbox Code Playgroud)

由于Strict-Transport-Security标题仅在交付时受到尊重https://,因此可以非常安全地假设任何未响应的站点https://未使用STS,尤其是因为它没有理由这样做.