如何将 Tor 与 cURL(在 Windows 中)一起使用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7167166/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 17:55:34  来源:igfitidea点击:

How do I use Tor with cURL (in Windows)?

windowscurltor

提问by VolatileRig

I have Vidalia installed, set up Chrome to use port 8118 for the proxy and I've checked my connection through https://check.torproject.org/but I'm having difficulties getting this work with the command-line tool cURL. This is what I try:

我已经安装了 Vidalia,将 Chrome 设置为使用端口 8118 作为代理,并且我已经通过https://check.torproject.org/检查了我的连接,但是我在使用命令行工具 cURL 进行这项工作时遇到了困难。这是我的尝试:

C:\>curl -v --proxy localhost::9050 http://google.com
* About to connect() to proxy localhost port 0 (#0)
* Failed to connect to ?: Address not available
* No error
*   Trying 127.0.0.1... Failed to connect to 127.0.0.1: Address not available
* No error
* couldn't connect to host
* Closing connection #0
curl: (7) Failed to connect to ?: Address not available

Solved:

解决了

curl -v --socks4a localhost:9050 http://check.torproject.org/

采纳答案by Marc B

Use --socks5(two dashes). -socks5is not a valid parameter for curl, so curl is interpreting it as a hostname.

使用--socks5(两个破折号)。-socks5不是 curl 的有效参数,因此 curl 将其解释为主机名。

回答by VolatileRig

Turns out this entire mess was just syntax problems. A proper command is here:

原来这整个混乱只是语法问题。正确的命令在这里:

curl -v --socks4a localhost:9050 http://check.torproject.org/

With TWO dashes before socks4a and ONE colon before the port.

在socks4a 之前有两个破折号,在端口之前有一个冒号。

回答by Luis Rita

More updated response using socks5.

使用socks5.

curl -v --socks5 localhost:9150 http://check.torproject.org/

So, using port 9150for socks 5.

因此,port 9150用于袜子 5。