• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WorkInProgress.. Use a new Identity in Tor every X minutes
#1
WorkInProgress.. Use a new Identity in Tor every X minutes

Well.. It's bank holiday Monday here in the UK which means I've got the day off work so I had a go at automating getting a new Identity / IP address in Tor every X minutes.

I'm using Windows and running Tor Portable.

Below is my working prototype that does work but has many flaws.. *cough* Drumm has already shouted at me... For the sendkeys command to work the window that it's sending to has to be in focus which means whenever you're doing something the telnet session will pop up so it can send commands to it. I also gave up trying to get the loop to end meaning even if you close the telnet session the script is still sending text to anything that will except it meaning you have to kill the wscript process. I may or may not have forkbombed myself in testing.

[code=vb]
' A Visual Basic Script to use a new identity in tor every x minutes
' use dim to create a variable, our variable is called objShell
' The SendKeys method is used to send keystrokes to the currently active window as if they where typed from the keyboard
' AppActive.. Activates an application that is already running bringing it in to focus
dim objShell
dim password
dim endloop
Set objShell = CreateObject("WScript.Shell")
' set the password variable equal to the password for telnet &Chr(34) is ANSI for "
password = "passwordhere"&Chr(34)
' Set the value of endloop for the loop below
endloop = "0"
' opens a command prompt / whatever program you tell it to below
objShell.Run "%SystemRoot%\system32\cmd.exe"
' sleeps for x milliseconds 1000 = 1 seconds
Wscript.Sleep 1000
' sends the commands to the cmd window.. connects and authenticates to the control port over telnet
objShell.sendkeys "telnet 127.0.0.1 9051"
objShell.SendKeys "{ENTER}"
Wscript.Sleep 1500
objShell.sendkeys "authenticate "&Chr(34) & password
objShell.SendKeys "{ENTER}"
Wscript.Sleep 3000
' Do...Loop: Loops while or until a condition is True.
Do Until endloop=1
If endloop=1 Then Exit Do
' contents of the loop below
objShell.SendKeys "signal newnym"
objShell.SendKeys "{ENTER}"
' sleep for 5 minutes (300000)
Wscript.Sleep 300000
' Activates the running telnet session with the title Telnet 127.0.0.1
objShell.AppActivate("Telnet 127.0.0.1")
Wscript.Sleep 500
' contents of the loop above
Loop
[/code]

Am I allowed to use an excuse? This is my first VBS.. promise!

Edit.. I should add I'm looking to make this work in the background, cycle through a list of URLs and log all output to a file with times, what IP it picked up and what sites it visited under that IP.
  Reply


Messages In This Thread
WorkInProgress.. Use a new Identity in Tor every X minutes - by Mark - 07-05-2012, 07:32 PM

Forum Jump: