howtothings.co.uk
WorkInProgress.. Use a new Identity in Tor every X minutes - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Programming Support, Graphic Design and Tutorials (https://www.howtothings.co.uk/forumdisplay.php?fid=14)
+--- Thread: WorkInProgress.. Use a new Identity in Tor every X minutes (/showthread.php?tid=1234)



WorkInProgress.. Use a new Identity in Tor every X minutes - Mark - 07-05-2012

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.



RE: WorkInProgress.. Use a new Identity in Tor every X minutes - latch - 07-05-2012

If Drumm doesn't smack you around for using vb, I'm fairly certain Pack3t will.


RE: WorkInProgress.. Use a new Identity in Tor every X minutes - Pack3t SynAck3r - 10-05-2012

(07-05-2012, 10:30 PM)latch Wrote: If Drumm doesn't smack you around for using vb, I'm fairly certain Pack3t will.

LMAO, ya, pretty much. Why the fuck aren't you using C? Do you prefer to have leaks and a lack of control of your programs in general? See Drumm. I have spent enough time teaching him the correct way of doing things he will easily be able to fix your broken philosophy. C works in linux AND Winblows. VB works only in Winblows. Way to paint yourself into a corner. Every 1337 uses Windows as their hack box.....:doh:


RE: WorkInProgress.. Use a new Identity in Tor every X minutes - Drumm - 10-05-2012

I already did. Now, time to go re-purpose some programs to do this. I wonder if I can get it in even less lines..


RE: WorkInProgress.. Use a new Identity in Tor every X minutes - Mark - 10-05-2012

Drumm has no time for a very occasional, lacking programmer and Windows admin.. he lol'ed at me for using VB then went off... he may still be rolling about on the floor.


RE: WorkInProgress.. Use a new Identity in Tor every X minutes - latch - 11-05-2012

So the real question is, "Why did you choose to code in VB knowing you would get walloped for it?" And be honest because this is for posterity.