我想在 CentOS 机器上使用Tor作为 curl 或 wget HTTP请求的代理。我使用了这个方法,并在stackexchange和stackoverflow上寻找了一些答案。https://medium.com/the-sysadmin/using-tor-for-your-shell-script-fee9d8bdef5c#.9ixz30jbn
如果我在shell中输入'tor',我会得到这样的结果:
Aug 31 21:01:29.871 [notice] Tor v0.2.8.6 running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2h and Zlib 1.2.8.
Aug 31 21:01:29.871 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Aug 31 21:01:29.871 [notice] Read configuration file "/home/wmjio5f6/.linuxbrew/etc/tor/torrc".
Aug 31 21:01:29.909 [warn] ControlPort is open, but no authentication method has been configured. This means that any program on your computer can reconfigure your Tor. That's bad! You should upgrade your Tor controller as soon as possible.
Aug 31 21:01:29.937 [notice] Opening Socks listener on 127.0.0.1:9050
Aug 31 21:01:29.939 [notice] Opening Control listener on 127.0.0.1:9151
Aug 31 21:01:29.000 [notice] Parsing GEOIP IPv4 file /home/wmjio5f6/.linuxbrew/Cellar/tor/0.2.8.6/share/tor/geoip.
Aug 31 21:01:30.000 [notice] Parsing GEOIP IPv6 file /home/wmjio5f6/.linuxbrew/Cellar/tor/0.2.8.6/share/tor/geoip6.
Aug 31 21:01:30.000 [notice] Bootstrapped 0%: Starting
Aug 31 21:01:31.000 [notice] Bootstrapped 80%: Connecting to the Tor network
Aug 31 21:01:32.000 [notice] Bootstrapped 85%: Finishing handshake with first hop
Aug 31 21:01:32.000 [notice] Bootstrapped 90%: Establishing a Tor circuit
Aug 31 21:01:32.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Aug 31 21:01:32.000 [notice] Bootstrapped 100%: Done
我的错误在哪里,或者说,哪个命令才是正确的?
2条答案
按热度按时间fbcarpbf1#
你没有犯错。该输出表明Tor已启动,连接到网络并正在运行。您可能需要弄清楚如何将其作为守护进程,或者在后台运行它(
nohup tor &
)。行
Opening Socks listener on 127.0.0.1:9050
告诉您它的SOCKS(代理)端口正在侦听端口9050。这是您希望curl或wget等应用程序通过其进行代理的端口。如您链接的文章所示,您只需要使用Tor的SOCKS端口运行curl。
nukf8bse2#
在RHEL/RHEL克隆中,
tor
软件包可从a torproject repository中获得。启用后,您可以像这样安装并启动tor服务:请注意,tor服务提供了一个SOCKS代理,用于通过Onion网络路由TCP流量。因此,每个程序的TCP流量,你要发送通过或你必须配置,这样它显式地使用该代理。
使用curl,可以使用
--proxy
选项,如下所示:注意:
socks5h
中的“h”意味着curl发出的DNS请求也会通过tor网络。对于不支持socks 5 h代理的程序,比如wget,你可以这样使用torsocks:
FWIW,Fedora,一种RHEL上游发行版,在其主存储库中包含了
tor
包。