Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Tor without browser in python?

I have a client raw socket app that I want to connect to a server on a .onion address. Everything is working fine, except that I have to open Tor Browser in order to connect to the server via client script. I think this happens because tor opens when Tor Browser starts. I tried to start tor without browser using tor.exe -f "torrc-defaults path". In task manager, it seems like tor is running but my client script give me an error like tor is not open. So How do I connect to Tor without having Tor installed in my pc? Here is my client error:

Traceback (most recent call last):
  File "client_onion.py", line 10, in <module>
    s.connect((onion_address,port))
  File "C:\Python27\lib\site-packages\socks.py", line 96, in wrapper
    return function(*args, **kwargs)
  File "C:\Python27\lib\site-packages\socks.py", line 813, in connect
    negotiate(self, dest_addr, dest_port)
  File "C:\Python27\lib\site-packages\socks.py", line 477, in _negotiate_SOCKS5
    CONNECT, dest_addr)
  File "C:\Python27\lib\site-packages\socks.py", line 552, in _SOCKS5_request
    raise SOCKS5Error("{0:#04x}: {1}".format(status, error))
socks.SOCKS5Error: 0x04: Host unreachable
like image 367
Raul Stepan Avatar asked Sep 12 '25 09:09

Raul Stepan


1 Answers

Use "Expert Bundle" to get the Tor binary without any browser.The expert bundle connects to the Tor network and allows you to make SOCKS5 connections and control port connections. You can control everything it does via the config file or through a 'Tor controller'.
You can download it from Download | Mirror 1

like image 105
Joshua Avatar answered Sep 14 '25 00:09

Joshua