I have Tor running on my computer, and I need to change the Tor exit node every five minutes. For example, if I start using Tor via some exit node, then in 5 minutes I want
This question seems to come up pretty frequently (1, 2) so I just added a FAQ entry for it. As mentioned earlier you can do this via a NEWNYM signal. Here's an example for doing it via stem...
from stem import Signal
from stem.control import Controller
with Controller.from_port(port = 9051) as controller:
controller.authenticate()
controller.signal(Signal.NEWNYM)
yeah, that's 1 (i mean =true =))) that tor does change ip every 10 minutes but! if i restart tor - i'll get a new ip even in this 10minutes interval. so i was thinking about making tor to send this "change_ip" request manually. see this code (written according to http://en.linuxreviews.org/HOWTO_use_the_Internet_anonymously_using_Tor_and_Privoxy)
procedure ChangeIp;
var
sck:TIdTCPClient;
begin
sck:=TIdTCPClient.Create(nil);
try
sck.Host:='127.0.0.1';
sck.Port:=10051;
sck.Connect;
sck.SendCmd('authenticate','');
if sck.LastCmdResult.Code='250' then
begin
sck.SendCmd('signal newnym','');
end;
finally
sck.Free;
end;
end;
and accornig to [https://tor-svn.freehaven.net/svn/torctl/trunk/doc/howto.txt] i can write a controler that will change tor's conf on the fly. by default it is not enebled (i mean this ability), but i can make tor client listen to some port for accepting commands using torrc...if i'm not mistaken...again=)
!!! where the hell torrc is on my pc?
In C:\Users\geekman\AppData\Roaming\Tor i could,n fing it i got vista.
I've wrote a library to control Tor with PHP. It is installable with Composer and allows to change the exit node.
Of course it's free software: http://dunglas.fr/2013/02/php-torcontrol-a-library-to-control-tor/
You can simply type or insert in your bash script:
service tor reload
I have done something different here... i wrote a PHP program that can communicate with linux shell. The program would restart tor in regular intervals.
So when tor is restarted it gets a new IP.... Yeah.....!!
exec("/etc/init.d/tor restart",$ioOut);
print_r($ioOut); //output from shell after executing the command
sleep(25);
You can also write a shell script to do this.
I am now in search of a windows option to do this. The problem is .. in windows Tor is a service which cannot be restarted.
(echo authenticate '""'; echo signal newnym; echo quit) | nc localhost 9051