如何在c/c++/命令行中访问需要http验证的url?

发布于 2024-09-29 13:02:07 字数 508 浏览 1 评论 0原文

http://admin:[email protected]/videostream.cgi

要访问不需要 http 身份验证的 url,非常简单:

telnet 192.168.1.178 80
Get /videostream.cgi HTTP/1.1
Accept: text/html;text/plain

User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13
Connection: close

但是如何指定 admin:123456 呢?

http://admin:[email protected]/videostream.cgi

To access a url that doesn't require http authenticate it's quite easy:

telnet 192.168.1.178 80
Get /videostream.cgi HTTP/1.1
Accept: text/html;text/plain

User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13
Connection: close

But how to specify admin:123456?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏至、离别 2024-10-06 13:02:07

请参阅 RFC这篇维基百科文章

使用 Wireshark 或其他 LAN 嗅探器来观察浏览器和服务器在您执行操作时执行的操作可能具有教育意义。访问带有嵌入凭据的 URL,例如您的 http://admin:[电子邮件受保护]/videostream.cgi

See the RFC or This Wikipedia article.

It can be educational to use Wireshark, or some other LAN sniffer, to watch what a browser and server do when you access a URL with embedded credentials such as your http://admin:[email protected]/videostream.cgi

楠木可依 2024-10-06 13:02:07

对于基本身份验证,您将用户名和密码指定为用户名:密码 ,然后对其进行 Base64 编码并将其用作 Authentication 标头的参数:

Authorization: Basic YXNkZjoxMjM0

YXNkZjoxMjM0 解码为 asdf:1234;我使用curl -u adsf:1234(指定用户名“asdf”和密码“1234”)来产生此结果。

For basic authentication, you specify the username and password as username:password, then Base64-encode it and use it as an argument to the Authentication header:

Authorization: Basic YXNkZjoxMjM0

YXNkZjoxMjM0 decodes to asdf:1234; I used curl -u adsf:1234 (specifying the username "asdf" and password "1234") to produce this result.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文