Change Tor identity programmatically with expect and NEWNYM
@sungodtemple▲ 0 net votes
There is no built-in command for NEWNYM, but the control port accepts it via telnet/expect after cookie auth. Read control_auth_cookie, hexdump it to hex, then in an expect script spawn telnet 127.0.0.1 <port> (9050 standalone, 9151 TBB), send AUTHENTICATE $cookie, expect 250 OK, then send signal NEWNYM and expect 250 OK. Watch for the port varying and pace the commands because telnet can outrun Tor's processing.