2010年2月19日星期五

Build PortableTor Yourself #GFW #翻墙

出处:http://wiki.noreply.org/noreply/TheOnionRouter/Portable_Tor

PortableTor

About

This document describes how to install Tor and Privoxy on a USB Flash Drive. This will allow anonymous browsing in a more public location.

I've prebuilt an installer which you can use to install specifically to flash drives, if you don't want to follow these instructions. If you'd like to follow the instructions anyway, more power to you!

Support

This has been proven to work on Windows XP and all versions of Windows Vista. If you should encounter a problem, I'll try to help. Post your information on http://sourceforge.net/projects/portabletor forum.

Installation Procedures

Lets get it Started: Installing

NOTE: My flash drive letter in this guide will be known as E:. You can install to your desktop, another location, etc. though. It really doesn't matter. When you're done, you'll be able to move the installation directory wherever you want.

  • Plug in your flash drive, mount it or do whatever you need to get it working
  • Make a folder (such as Portable Tor) on your flash drive
  • Install Tor. During the install wizard you will be asked where you want to put the files. Point the installer to the folder you just created on your flash drive.
  • Run Privoxy and Tor on the system once, just to make sure configuration files are created successfully. Run Vidalia, open preferences, and hit "Save" to safe the preference file.
  • Copy the following files to the directories as indicated:

Windows XP

  • "C:\Documents and Settings\<username>\Application Data\Tor\torrc" to "E:\PortableTor\Tor\"

  • "C:\Documents and Settings\<username>\Application Data\Vidalia\vidalia.conf" to "E:\PortableTor\Vidalia\"

Windows Vista

  • "C:\Users\<username>\APPDATA\Roaming\Tor\torrc" to "E:\PortableTor\Tor\"

  • "C:\Users\<username>\APPDATA\Roaming\Vidalia\vidalia.conf" to "E:\PortableTor\Vidalia\"

  • Make sure a file named config.txt exists in "E:\PortableTor\Privoxy\". If it doesn't, you need to reinstall to get it.

Editing the Config

Now we have to edit our configuration files to point to the right place.

Creating the Startup Launcher

We now need to create a batch file that will start our programs and load the custom configuration files.

  • Open Notepad, and create the following file. Save it as PortableTor.bat in E:\

 start /min /b .\PortableTor\Privoxy\privoxy.exe ".\PortableTor\Privoxy\config.txt" start /b .\PortableTor\Vidalia\vidalia.exe --datadir ".\PortableTor\Vidalia\"

Running the programs

Just doubleclick PortableTor.bat in E:\. Remember that the program expects the following layout:

 E:\  |-- PortableTor.bat (Main Launcher File)  |  |-- PortableTor      |      |-- Privoxy      |    |-- config.txt (File)      |      |-- Tor      |    |-- torrc (File)      |    |      |    |-- DataDirectory      |    |      |    |-- (Other Files)      |      |-- Vidalia           |-- vidalia.conf (File)

Everything should be working fine now. Make sure you can get Portable Firefox on your flash drive, and configure it with the proxy addresses as outlined in the win32 documentation!

Setting up Browsing

  • Start PortableTor.bat

  • Set your web browser to use a proxy
    • Proxy host = localhost
    • Proxy port = 8118

Extra Things You Can Do

To start, you can parse down documentation to save space. A great thing to do is also use UPX packer on all executables and dll's in the package; makes everything so much smaller. You can make your launcher pretty by using Exescript to first make it into an .exe that doesn't show the DOS box (Silent Mode), then use ResHack to change the icon and UPX to pack it.

Notes

Some libraries have their own proxies setup on their computers, and while they are on Windows XP, which is beneficial for your flash drive's detection in the system, you will not be able to get the computer to use the Tor proxy. The solution to this problem is to get a portable web browser on your flash drive. http://portableapps.com has PortableFirefox, which should do the job just fine! --Silivrenion

Section 2) (its easier than it looks)

  • For people who:
    1. use computers that assign their removable drives different letters (ie, E:\ H:\ G:\ etc) b. only want to donwload the original software (tor and vidalia) c. Do not want to leave any information/files behind on computers used

I. Setting up tor only

  • -install tor to the removable drive location of choice -create a bat such as the one below (ie tor.bat) at the location of tor.exe

             for %%x in (%0) do set BatchPath=%%~dpsx             cd %BatchPath%             echo %BatchPath%>currentpath.txt             for /f "tokens=1 delims=:" %%i in (currentpath.txt) do set letter=%%i             tor -f %letter%:\Applications\Tor_0.1.2.18a\torrc datadirectory %letter%:\Applications\Tor_0.1.2.18a\AppData             cls             exit
  • this .bat file accomplishes a few things
    • :detects the current letter of the drive and stores it as variable %letter% :runs tor using a config file located, in this example, at %letter%:\Applications\Tor_0.1.2.18a\torrc.

      :runs tor using the datadirectory located at %letter%:\Applications\Tor_0.1.2.18a\AppData

    feel free to edit these location to meet your needs. Obviously the locations should be somewhere on the removable drive. Not only does this method prevent tor from writing data to the computer, it has the added benefit of storing previous caches on the removable drive to speed up the rebuilding of a network

II. Setting up Vidalia to use portable tor

  • -install vidalia to the removable drive location of choice -run vidalia at least once, and set up your personal preferences (note that this will store information in Application Data, so youll have to delete it after all this)

    -create an empty text file at the location of vidalia.exe. Open up vidalia.conf (in Application Data) and copy all of the text up to and including ControlPassword="random text here". So, the only text excluded from this file should be the last three lines at the bottom:

            DataDirectory=E:\\Applications\\Tor_0.1.2.18a\\AppData            TorExecutable=E:\\Applications\\Tor_0.1.2.18a\\tor.exe            Torrc=E:\\Applications\\Tor_0.1.2.18a\\torrc
  • -create a .bat file (ie resetVidalia.bat) at the location of vidalia.exe containing the following text:
    • (note that in this example, conf_part1.txt is the text file described in the previous step)

            @echo off            for %%x in (%0) do set BatchPath=%%~dpsx            cd %BatchPath%            echo %BatchPath%>currentpath.txt            for /f "tokens=1 delims=:" %%i in (currentpath.txt) do set letter=%%i            type conf_part1.txt>vidalia.conf            echo DataDirectory=%letter%:\\Applications\\Tor_0.1.2.18a\\AppData>>vidalia.conf            echo TorExecutable=%letter%:\\Applications\\Tor_0.1.2.18a\\tor.exe>>vidalia.conf            echo Torrc=%letter%:\\Applications\\Tor_0.1.2.18a\\torrc>>vidalia.conf            vidalia.exe -datadir "."            cls            exit
  • this .bat file also accomplishes a few things
    • :detects the current letter of the drive and stores it as variable %letter% :rebuilds vidalia.conf using the text in conf_part1.txt and appends the values of tor's torrc file as well as tor's working directory. Note that as above, the actual locations can vary according to taste.

      :Note that vidalia.exe only searches for the text ControlPassword= when starting tor, and at that time will generate it's own random password. So whatever random password is stored in the original text file (ie, conf_part1.txt), each time tor runs a new random password will actually be generated. :the .bat lastly starts tor, defining that working directory as the current location

  • -Now while running vidalia, it can be annoying to have that ugly black dos box open all the time. The solution is as follows: -create a .vbs file (ie invisible.vbs) and paste into it the following:

             CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False
  • -create a .bat file and put into it:

            @echo off            for %%x in (%0) do set BatchPath=%%~dpsx            cd %BatchPath%            wscript.exe "%BatchPath%invisible.vbs" "%BatchPath%resetVidalia.bat"            cls            exit
  • Note that the names can change, just this example follows the same naming scheme as above. -Instead of running resetVidalia.bat, run invisible.bat. Vidalia should now start correctly without a terminal continuously open.
  • II. Conclusion
    • -Now you can easily configure/run tor & vidalia safely(disclaimer) and securely(also disclaimer) from a usb drive. Sit back, relax, and post back here if you actually find files that are being stored on the guest pc. Also, credits to this go to a lot of people and some tedious time spent collecting info here & there.

      • a final note: .bat files modifying program settings (meaning the above) will most likely not work on windows Vista. Havent tested though.

ps. Someone mind formatting this for me?

没有评论:

发表评论