【问题标题】:How do I pass a blank proxy username/password using curl?如何使用 curl 传递空白代理用户名/密码?
【发布时间】:2016-09-16 15:35:40
【问题描述】:

我在 Mac El Capitan 上使用 bash shell。如何使用 curl 为代理服务器传递空白用户名/密码?我试过这个

localhost:tmp davea$ curl http://www.google.com --proxy localhost:9050 --proxy-user "":""
514 Authentication required.

我正在使用这个命令在我的机器上运行一个 Tor 守护进程

tor --CookieAuthentication 0 --HashedControlPassword "" --ControlPort 9050 --SocksPort 50001

我可以通过 Telnet 连接而无需像这样输入密码

localhost:tmp davea$ telnet localhost 9050
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
AUTHENTICATE
250 OK

所以我知道我的密码至少是正确的。

【问题讨论】:

  • 为什么不直接连接到socks端口? curl -vvvv http://www.google.com --socks5 localhost:50001

标签: bash curl proxy passwords tor


【解决方案1】:

请注意,当从命令行使用 curl 时,--proxy 选项专门用于 HTTP 代理,而 Tor 不是,它是一个 SOCKS 代理。

要解决这个问题,请使用 Nehal 在 cmets 中建议的使用 SOCKS 代理(您可能希望使用 --socks5-hostname 代替,以便也通过 Tor 执行 DNS 解析,否则您会在本地泄漏 DNS 请求)。

所以你的电话看起来像:

curl http://www.google.com -L --socks5-hostname localhost:50001

旁注:控制端口 (9050) 仅用于向控制器传达命令。此端口根本不用于代理请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-24
    • 2011-06-23
    • 1970-01-01
    • 2015-02-18
    • 2012-06-25
    • 1970-01-01
    相关资源
    最近更新 更多