when I try to follow the tutorial (https://stem.torproject.org/tutorials/to_russia_with_love.html) about how to start up Tor I keep getting stuck at 45% and sometimes at 50%. I am using windows 8, python 3.4 and the LiClipse ide.
[1mStarting Tor: [0m [34mApr 26 12:47:21.000 [notice] Bootstrapped 0%: Starting[0m [34mApr 26 12:47:21.000 [notice] Bootstrapped 45%: Asking for relay descriptors[0m [34mApr 26 13:04:00.000 [notice] Bootstrapped 50%: Loading relay descriptors[0m
The script looks like this, the change I have made myself here is to use requests
library instead of urllib
to rquest data from a source but I'm not getting to that part of the code here anyway. This is basicly a copy of the code at the tutorial page using SocksiPy.
TorConnector.py:
from io import StringIO
import socket
import requests
import socks # SocksiPy module
import stem.process
from stem.util import term
SOCKS_PORT = 7000
# Set socks proxy and wrap the urllib module
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', SOCKS_PORT)
socket.socket = socks.socksocket
# Perform DNS resolution through the socket
def getaddrinfo(*args):
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
socket.getaddrinfo = getaddrinfo
def query(url):
"""
Uses requests to fetch a site using SocksiPy for Tor over the SOCKS_PORT.
"""
try:
result = requests.get(url)
return result
except:
return "Unable to reach %s" % url
# Start an instance of Tor configured to only exit through Russia. This prints
# Tor's bootstrap information as it starts. Note that this likely will not
# work if you have another Tor instance running.
def print_bootstrap_lines(line):
if "Bootstrapped " in line:
print(term.format(line, term.Color.BLUE))
print(term.format("Starting Tor:\n", term.Attr.BOLD))
tor_process = stem.process.launch_tor_with_config(
config = {
'SocksPort': str(SOCKS_PORT),
'ExitNodes': '{ru}',
},
init_msg_handler = print_bootstrap_lines,
)
print(term.format("\nChecking our endpoint:\n", term.Attr.BOLD))
print(term.format(query("https://www.atagar.com/echo.php"), term.Color.BLUE))
tor_process.kill() # stops tor
I have also tried moving the TorConnector.py script file in to the C:\Python34\Lib\site-packages
folder and run it from a command prompt with python TorConnector.py
but same thing happens, I am still stuck on 45%.
Also, if I end Tor.exe process when its stuck at 45% it tells me this:
Traceback (most recent call last): File "C:\Users\gatsu\My Documents\LiClipse Workspace\TorCommunicator\TorConnector.py", line 53, in init_msg_handler = print_bootstrap_lines, File "C:\Python34\lib\site-packages\stem\process.py", line 246, in launch_tor_with_config return launch_tor(tor_cmd, args, torrc_path, completion_percent, init_msg_handler, timeout, take_ownership) File "C:\Python34\lib\site-packages\stem\process.py", line 136, in launch_tor raise OSError('Process terminated: %s' % last_problem) OSError: Process terminated: Failed to open GEOIP file C:\Users\gatsu\AppData\Roaming\tor\geoip6. We've been configured to use (or avoid) nodes in certain countries, and we need GEOIP information to figure out which ones they are.
I hope it helps to figure out why this is making me get stuck.
I do not even have this file: C:\Users\gatsu\AppData\Roaming\tor\geoip6