In the new Tor browser bundle is there any way to change new identity programmatically, since there is no Vidalia bundle?
-
2Do you mean how to request creation of a new Tor circuit using a command line tool or API?– pabouk - Ukraine stay strongCommented Feb 2, 2014 at 22:36
-
yes exactly thats what I am looking for– Vijay kudalCommented Feb 3, 2014 at 4:49
-
2You also asked a similar question here: tor.stackexchange.com/q/1414/88 Please don't ask the same question more than one time. It might take some time until one finds an answer.– Jens KubiezielCommented Feb 3, 2014 at 23:07
-
1You can download Vidalia yourself in Tor website– user3092Commented Jul 5, 2014 at 6:12
3 Answers
I'm not aware of some ready-made solution. However you could write an expect script for your shell:
The first part reads out the cookie file and calls the expect
script
#!/bin/sh
COOKIEFILE=/var/lib/tor/control_auth_cookie
if [ -f $COOKIEFILE ]; then
COOKIE=$(hexdump -e '32/1 "%02x""\n"' $COOKIEFILE)
else
echo "Cookie not found"
return 1
fi
expect -f tor-newnym.exp $COOKIE
The expect
script is just an idea. Maybe you'll need to set some additional values later:
#!/usr/bin/expect -f
set cookie [lindex $argv 0]
spawn telnet 127.0.0.1 9050
expect -exact "Trying 127.0.0.1...\r
Connected to 127.0.0.1.\r
Escape character is '^]'.\r
"
send -- "AUTHENTICATE $cookie\r"
expect -exact "250 OK\r
"
send -- "signal NEWNYM\r
"
expect -exact "250 OK\r
"
send -- "quit\r"
expect eof
This takes the cookies and sends it to the Tor process. However please be aware that the port of your Tor process might be another one. Furthermore the chain of command might be too fast, so you have to slow it down.
-
-
Tor
uses now aControlSocket
by default. Replace thespawn
and firstexpect
command above withspawn nc -U {$HOME/Library/Application Support/TorBrowser-Data/Tor/control.socket}
(if you haveBSD
'snetcat
) or usetelnet -u [socket]
.– 1.61803Commented Apr 1, 2017 at 13:47
You can change identity using green Tor button. This is the best choice. However, you still can activate Vidalia manually and change identity that way. (not recommended)
-
1Thanks but i want to change progmatically means thru script or command line Commented Feb 3, 2014 at 4:48
-
On GNU/Linux, there is the tor
command and we can change the country exit node with a single command tor -ExitNodes {fr}
for France or tor -ExitNodes {de}
for Germany (Deutschland) for example. But to create a new circuit to change the IP address, I have to press Ctrl+C and start the command again.
I don't think there is an interactive shell, or command parameter to create a new circuit. If you do it programmatically, you will have to kill the process and start it again, so if someone has an easier solution to change the identity, your welcome.
A cleaner method would be to use the NEWNYM signal like @Jens Kubieziel said but it would be easier if it was available as a command parameter like tor -new-identity
or tor -new-circuit
.