gpt4 book ai didi

curl - 如何查找网站是否使用 HSTS

转载 作者:行者123 更新时间:2023-12-04 02:50:41 27 4
gpt4 key购买 nike

我对 curl 完全陌生,正在尝试确定网站是否使用 Strict-Transport-Security。

我正在逃避建议。我被告知要检查 Chrome's preloaded list并运行

curl -D - https://www.example.com | head -n 20

检查 Strict-Transport-Security header 。

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

有什么想法吗?

ATM 我运行的是 Win XP,几天后会有一个 linux 发行版。

谢谢。

最佳答案

那个方法没问题。

$ curl -s -D- https://paypal.com/ | grep Strict
Strict-Transport-Security: max-age=14400

正如你所注意到的,一些网络服务器只是拒绝尊重 HEAD请求。 curl将打印 GET 的标题请求 -v :
$ curl -s -vv https://paypal.com/ 2>&1 | grep Strict
< Strict-Transport-Security: max-age=14400
<意味着 header 是服务器返回给您的 header 。

实际 example.com ,就像在你的例子中一样,不会工作,因为它不听 https://根本:
$ curl -D- https://www.example.com
curl: (7) couldn't connect to host

Strict-Transport-Security标题仅在通过 https:// 交付时才有效,可以非常安全地假设任何在 https:// 上没有响应的站点不使用 STS,尤其是因为它没有理由这样做。

关于curl - 如何查找网站是否使用 HSTS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11717789/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com