从Windows命令行请求新的Tor身份 [英] Request new Tor identity from Windows command line
问题描述
我正在尝试使用一个简单的Windows命令行命令来更改TOR身份.我看到了大量针对Linux的示例,但不确定如何在Windows上实现相同的功能.
有人有什么想法吗?
更新:使用流隔离,如
I'm trying to use a simple Windows Command Line command to change TOR identities. I see plenty of examples for Linux, but not sure how to implement the same thing on Windows.
Anyone have any ideas?
UPDATE: Using stream isolation as shown in this answer may be a way to get around needing to use the control port to request a new identity. Using a username & password on the SOCKS connection isolates those requests to a specific circuit and changing the credentials will automatically change the circuit which results in getting a new IP.
To create a new circuit (switch IP addresses) on Windows without stopping and starting Tor, you need to open a connection to Tor's control port to issue a NEWNYM
signal.
Here is a batch file that will achieve this. You also need to download netcat for Windows and put nc.exe
in the same folder as this batch file.
I downloaded the Tor Browser Bundle for Windows, so you will need to put this batch file in the root folder of the browser bundle.
@echo off
REM Read control auth cookie into variable
set /p auth_cookie=<Browser\TorBrowser\Data\Tor\control_auth_cookie
REM Create file with control commands
echo AUTHENTICATE "%auth_cookie%"> commands.txt
echo SIGNAL NEWNYM>> commands.txt
echo QUIT>> commands.txt
REM Connect to control port and issue commands
nc localhost 9151 < commands.txt
REM Delete commands file
del /Q commands.txt
I tested this on Windows and after running the batch file, my circuit changed and I had a new IP each time.
When you run it, you should see the following output:
C:\Users\user\Desktop\Tor Browser>control.bat
250 OK <-- in response to AUTHENTICATE
250 OK <-- in response to SIGNAL NEWNYM
250 closing connection
There is no simple one-liner, you have to connect to the control port and issue this signal. This is what the browser does when you press the new identity button.
Here is the directory structure relative to the Tor Browser Bundle, nc
, and the batch file to create a new circuit.
这篇关于从Windows命令行请求新的Tor身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!