0

我们如何在单独的终端窗口中使用 torify 命令获得不同的 Tor 电路?具体来说,如果我在终端 1 窗口中键入命令

torify curl http://icanhazip.com

我收到我的 IP 地址作为回应。

但是如果我同时在另一个终端窗口中尝试它,我会得到相同的 IP,这是正常行为。

我想要实现的是在每个新的终端窗口中使用不同的配置文件,以便在不同的终端窗口中获​​取不同的 IP 地址。

4

1 回答 1

1

使用-i( --isolate) 选项或--userand--pass来获得流隔离

来自man 1 torsocks

-u, --user
      Set username for the SOCKS5 authentication. Use for circuit isolation in Tor.
      Note that you MUST have a password set either by the command line,
      environment variable or configuration file (torsocks.conf(5).

-p, --pass
      Set  password  for the SOCKS5 authentication. Use for circuit isolation in
      Tor.  Note that you MUST have a username set either by the command line,
      environment variable or configuration file (torsocks.conf(5)).

-i, --isolate                                                                                                                                                                          
      Automatic tor isolation. Set the username and password for
      the SOCKS5 authentication method to a PID/current time based value
     automatically. Username and Password MUST NOT be set.

例子:

torify --user foo --pass password curl https://example.com/

然后,使用一组不同的凭据将为您提供不同的电路和出口继电器:

torify --user foo2 --pass password2 curl https://example.com/

您可以直接使用 Tor 的 socks 代理和 curl 来实现相同的目的,并指定唯一的代理用户名/密码组合来获得流隔离。

例子:

curl -Lv --socks5-hostname 127.0.0.1:9050 \
  --proxy-user foo:password \
  https://example.com/

然后,使用一组不同的凭据将为您提供不同的电路和出口继电器:

curl -Lv --socks5-hostname 127.0.0.1:9050 \
  --proxy-user foo2:password2 \
  https://example.com/
于 2021-02-16T22:58:03.933 回答