Tor "talk with Russia" stuck in 45 - 50%

when I try to follow the tutorial ( https://stem.torproject.org/tutorials/to_russia_with_love.html ) on how to start Tor. I continue to get stuck at 45% and sometimes at 50%. I am using Windows 8, python 3.4 and the ideal of LiClipse.

[1mStarting Tor: [0m [34mApr 26 12: 47: 21.000 [notification] Bootable 0%: Startup [0m [34mApr 26 12: 47: 21.000 [notification] 45% downloaded: Request relay descriptors [0m [34mApr 26 13: 04 : 00.000 [notification] 50% downloaded: Relay descriptor loading [0m

The script looks like this: the change I made here is to use the requestslibrary instead urllibto rquest the data from the source, but I don’t get to this part of the code here anyway, It’s basically a copy of the code on the manual 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 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 also tried moving the TorConnector.py script file to a folder C:\Python34\Lib\site-packagesand running it from the command line using python TorConnector.py, but the same thing happens, I still stick to 45%.

Also, if I terminate the Tor.exe process when it is stuck at 45%, it tells me the following:

Traceback ( ): "C:\Users\gatsu\My \ LiClipse\TorCommunicator\TorConnector.py", 53,     init_msg_handler = print_bootstrap_lines, "C:\Python34\lib\site-packages\stem\process.py", 246, launch_tor_with_config     return start_tor (tor_cmd, args, torrc_path, complete_percent, init_msg_handler, timeout, take_ownership) "C:\Python34\lib\site-packages\stem\process.py", 136, launch_tor      OSError ( " :% s" % last_problem) OSError: : GEOIP C:\Users\Gatsu\AppData\Roaming\\geoip6. ( ) , , , .

, , .

: C:\Users\gatsu\AppData\Roaming\tor\geoip6

+4
3

geoip geoip6 tor (D:\Program\Tor Browser\Browser\TorBrowser\Data\Tor) C:\Users\gatsu\AppData\Roaming 100%.

[1mStarting Tor: [0m [34mMay 01 23: 28: 53.000 [] 0%: [0m [34mMay 01 23: 28: 53,000 [] 80%: Tor [0m [34mMay 01 23: 28: 54.000 []] 85%: [0m [34mMay 01 23: 28: 54.000 [] 90%: Tor [0m [34mMay 01 23: 28: 55.000 [] 100%: [0m [1m : [0m [34mUnable https://www.atagar.com/echo.php [0m

+2

, geoip geoipv6 . . TOR .

tor_process = stem.process.launch_tor_with_config(
  config = {
    'SocksPort': str(SOCKS_PORT),
    'ExitNodes': '{ru}',
    'GeoIPFile': r'C:\Program Files (x86)\tor-win32-0.2.8.9\Data\Tor\geoip',
    'GeoIPv6File' : r'C:\Program Files (x86)\tor-win32-0.2.8.9\Data\Tor\geoip6'
  },
  init_msg_handler = print_bootstrap_lines,
)

, . TOR, 45%, ( , / 'tor)'

+1

Associated with the answer provided by @Alter . On MacOs Sierra, the tor_process configuration, which works (solving this problem),

tor_process = stem.process.launch_tor_with_config(
    tor_cmd = '/Applications/TorBrowser.app/Contents/MacOS/Tor/tor.real',
    config = {
        'SocksPort': str(SOCKS_PORT),
        'ExitNodes': '{ru}',
        'GeoIPFile': r'/Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/geoip',
        'GeoIPv6File' : r'/Applications/TorBrowser.app/Contents/Resources/TorBrowser/Tor/geoip6'
    },
    init_msg_handler = print_bootstrap_lines,
)
+1
source

Source: https://habr.com/ru/post/1584724/


All Articles