Using Tor signals on Win32 NT (eg. pseudo-signals)?

°¤¦¦Ç£ówñ_Ðèvï£_ß󥦦¤° clowndevil at gmail.com
Thu Aug 3 17:25:55 UTC 2006


Because your not a progammer and I just so happen to have some free
time I wrote up this small sample for you (should be vbscript but its
been a long time since I used it), it makes use of Toolsack's Socket
(http://www.toolsack.com/products/baseline/  its free and easy to use)
to connect to Tor's control port and send signal hup, which will tell
Tor to reload its config file. Copy and paste from the -- to -- and
save it in a file with the extantion .vbs Run it and Tor should reload
its config. I commented it so you know what everything does. I have
tested it and it works fine. The only thing I didnt add was some kind
of error checking for the connection, but if it cant connect you will
get an error message from the interpreter saying so anyways.

--
'Make torsock out socket name
set torsck = CreateObject("Toolsack.Socket")

'Connect to Tor's control port
torsck.Connect "localhost", 9051

'Auth so we can send commands
torsck.Write "AUTHENTICATE" & vbcrlf

'Read the buffer so we know what to do
chktxt = torsck.ReadLine

if (chktxt = "250 OK") then
  'If we get an OK then send the reload signal
  torsck.Write "SIGNAL HUP" & vbcrlf
else
  'Other wise goto a failed message box
  call failed
end if

'Again read the buffer
chktxt = torsck.ReadLine

if (chktxt = "250 OK") then
  'If we get an OK then Tor reloaded its config
  msgbox "Tor config reloaded."
else
  'Other wise goto failed message box
  call failed2
end if

'Everything went good so finish the connection
call finish

sub failed
  'Message box for failed auth
  msgbox "Failed to authenticate."
  call finish
end sub

sub failed2
  'Message box for failed reload signal
  msgbox "Failed to send reload signal."
  call finish
end sub

sub finish
  'Send a QUIT command to Tor and close the connection
  torsck.Write "QUIT" & vbcrlf

  'Again read the buffer
  chktxt = torsck.ReadLine

  if (chktxt = "250 closing connection") then
    'Do nothing because the Tor closed the connection for us
  else
    'Something happen when trying to clsoe the connection so close it anyway
    torsck.Close
  end if
end sub
--

If you have any questions I will try my best to answer them. You can
contact me via email (below in my sig) if you need to.

-William
clowndevil at gmail.com

On 8/2/06, Anothony Georgeo <anogeorgeo at yahoo.com> wrote:
> Hi eric,
>
> eric.jung at yahoo.com wrote:
>
> >I know some people are averse to installing .NET and, if that's the case
> with Anothony, then I doubt there's a viable (free) scripting solution.
>
> I take this back. I forgot you can invoke COM objects from Windows Script
> Host (WSH) scripts. WSH only requires wscript.exe, not .NET (it predates
> .NET by a number of years). There are countless COM objects that handle
> socket communications.
>
> Let me know if you need more info.
> Any extra info you feel like posting would be *extremely* helpfull as I am
> not a programmer.  I have been reading up on PowerShell but I'm a bit more
> confortable with traditional WSH.
>
> I would prefer to use WSH as .Net is not required and WSH seems a bit easier
> than PowerShell.
>
> I am most comfortable/knowledgeable with batch scripts (eg. .cmd's) but I'm
> willing to study and do what it takes to to learn WSH or PowerShell to
> achive my goal.  I will use which ever you deem the most appropriate and
> efficient.
>
> I really appreciate all the help/guidence you've given me so far but I don't
> want to become a pest.
>
> I intend to post the script here (if Nick and Roger don't mind) as I am sure
> most users of Tor and Win32 NT would love to have access to the final
> script.
>
> Thank you very much for your time, Anogeorgeo :-)
>
>
>  ________________________________
> Do you Yahoo!?
>  Everyone is raving about the all-new Yahoo! Mail Beta.
>
>



More information about the tor-talk mailing list