Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tor-Request #2898

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 58 additions & 0 deletions examples/README.md
Expand Up @@ -133,3 +133,61 @@ request.get({
console.log(res.body);
});
```
# Tor

How
Tor communicates through the SOCKS Protocol so we need to create and configure appropriate SOCKS Agent objects for Node's http and https core libraries using the socks library.

Installation
from npm

npm install tor-request
from source

git clone https://github.com/talmobi/tor-request
cd tor-request
npm install
Requirements
A Tor client.

Either run it yourself locally (recommended) or specify the address for a publically available one.

Tor is available for a multitude of systems.

On Debian you can install and run a relatively up to date Tor with.

apt-get install tor # should auto run as daemon after install
On OSX you can install with homebrew

brew install tor
tor & # run as background process
On Windows download the tor expert bundle (not the browser), unzip it and run tor.exe.

./Tor/tor.exe # --default-torrc PATH_TO_TORRC
See TorProject.org for detailed installation guides for all platforms.

The Tor client by default runs on port 9050 (localhost of course). This is also the default address tor-request uses. You can change it if needed.

tr.setTorAddress(ipaddress, port); // "localhost" and 9050 by default
(Optional) Configuring Tor, enabling the ControlPort
You need to enable the Tor ControlPort if you want to programmatically refresh the Tor session (i.e., get a new proxy IP address) without restarting your Tor client.

Configure tor by editing the torrc file usually located at /etc/tor/torrc, /lib/etc/tor/torrc, ~/.torrc or /usr/local/etc/tor/torrc - Alternatively you can supply the path yourself with the --default-torrc PATH command line argument. See Tor Command-Line Options

Generate the hash password for the torrc file by running tor --hash-password SECRETPASSWORD.

tor --hash-password giraffe
The last line of the output contains the hash password that you copy paste into torrc

Jul 21 13:08:50.363 [notice] Tor v0.2.6.10 (git-58c51dc6087b0936) running on Darwin with Libevent 2.0.22-stable, OpenSSL 1.0.2h and Zlib 1.2.5.
Jul 21 13:08:50.363 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
16:AEBC98A6777A318660659EC88648EF43EDACF4C20D564B20FF244E81DF
Copy the generated hash password and add it to your torrc file

# sample torrc file
ControlPort 9051
HashedControlPassword 16:AEBC98A6777A318660659EC88648EF43EDACF4C20D564B20FF244E81DF
Lastly tell tor-request the password to use

var tr = require('tor-request')
tr.TorControlPort.password = 'giraffe'