This comprehensive guide covers how to use the Tor VPN System for managing Tor connections.
Before using the system, ensure you have:
# Activate virtual environment
source .venv/bin/activate
# Run the GUI application
python tor_vpn_beta.py
python tor_vpn_beta.py
The GUI requires:
The GUI consists of two main tabs:
Connection Status Display
Control Buttons
Server List
Example Country Codes:
us - United Statesde - Germanygb - United Kingdomjp - Japanfr - Francepython tor_vpn_beta.py
Purpose: Launch the graphical interface
Requirements: GUI environment (X11, Wayland, etc.)
python tor_custom_config.py
Purpose: Generate custom Tor configuration with user-specified password
Process:
Output:
~/.tor_config/torrccreate_torrc.log# Use defaults
python tor_auto_torrc_config.py
# Custom directories
python tor_auto_torrc_config.py /custom/data/dir /custom/log/dir /custom/torrc/path
Purpose: Automated Tor setup and configuration
Features:
# Basic usage
python tor_diagnostic_repair.py
# With custom paths
python tor_diagnostic_repair.py --tor-binary /usr/bin/tor --tor-config /etc/tor/torrc
Purpose: Diagnose and repair Tor configuration issues
Features:
Command-line Options:
--tor-binary: Path to Tor binary--tor-config: Path to torrc file--custom-start-command: Custom start command--custom-stop-command: Custom stop commandpython tor_network_test.py
Purpose: Test Tor network connectivity and performance
Output:
Test Results Structure:
{
"connection": bool,
"latency": float or None,
"exit_ip": str or None,
"errors": list
}
sudo python tor_route_traffic_setup.py
Purpose: Configure transparent proxy for system-wide Tor routing
Features:
⚠️ Warning: This routes ALL system traffic through Tor. Use with caution.
python tor_vpn_inclued.py
Purpose: Validate Tor configuration and start Tor manually
Features:
sudo bash setup_tor_custom.sh
Purpose: Bash script for custom Tor configuration setup
Features:
Process:
bash tor_auto_proxy.sh
Purpose: Zenity-based GUI for proxy management
Requirements:
Features:
Menu Options:
enable_proxy - Enable system-wide Tor proxydisable_proxy - Disable proxyopen_chrome - Open Chrome with Toropen_firefox - Open Firefox with Torexit - Exit scriptThe system supports exit nodes in 200+ countries. Some popular options:
| Country | Code | Country | Code |
|---|---|---|---|
| United States | us | Germany | de |
| United Kingdom | gb | France | fr |
| Japan | jp | Canada | ca |
| Australia | au | Netherlands | nl |
| Switzerland | ch | Sweden | se |
| Brazil | br | India | in |
| Singapore | sg | South Korea | kr |
See the SERVERS dictionary in tor_vpn_beta.py for the complete list of 200+ countries.
from tor_vpn_beta import connect_to_tor
connect_to_tor("us") # Connect to US exit node
from stem.control import Controller
from stem import Signal
with Controller.from_port(port=9051) as controller:
controller.authenticate(password="your_password")
controller.set_conf("ExitNodes", "{us}")
controller.signal(Signal.NEWNYM)
To change exit nodes, simply disconnect and reconnect with a different country code, or send a NEWNYM signal:
controller.signal(Signal.NEWNYM)
python tor_network_test.py
Checks process status
Control Port Detection
Validates port accessibility
Authentication Test
Tests default authentication
Connection Test
Successful Test:
INFO - Tor service is running.
INFO - Control Port 9051 is accessible.
INFO - Tor is successfully routing traffic.
INFO - Exit IP detected: 185.xxx.xxx.xxx
Failed Test:
ERROR - Tor service is not running.
ERROR - Control Port 9051 is not accessible.
# Test with curl
curl --socks5 127.0.0.1:9050 https://check.torproject.org
# Test with telnet
telnet 127.0.0.1 9051
python tor_diagnostic_repair.py
Verifies configuration syntax
Password Collection
Secure password handling
Init System Detection
Falls back to manual
Service Restart
Validates restart success
Diagnostic Collection
Diagnostics are saved to diagnostics/ directory:
torrc - Tor configuration snapshotlogfile.log - Collected logssystem_info.txt - System information# Check Tor version
tor --version
# Check Tor configuration
tor --verify-config
# Check Tor process
ps aux | grep tor
# Check Tor ports
netstat -tulnp | grep tor
# Check Tor logs
tail -f /var/log/tor/log
import os
custom_torrc = "/path/to/custom/torrc"
os.environ["TOR_CONFIG"] = custom_torrc
# Multiple countries
controller.set_conf("ExitNodes", "{us},{de},{gb}")
# Exclude countries
controller.set_conf("ExcludeNodes", "{cn},{ru}")
# Strict node selection
controller.set_conf("StrictNodes", "1")
circuits = controller.get_circuits()
for circuit in circuits:
print(f"Circuit {circuit.id}: {circuit.purpose}")
print(f"Build flags: {circuit.build_flags}")
controller.signal(Signal.NEWNYM)
controller.close_circuit(circuit_id)
controller.set_conf("__LeaveStreamsUnattached", "1")
# Then attach stream manually
controller.attach_stream(stream_id, circuit_id)
def circuit_event(event):
print(f"Circuit event: {event}")
controller.add_event_listener('CIRC', circuit_event)
google-chrome --proxy-server="socks5://127.0.0.1:9050"
Install proxy switcher extension:
sudo python tor_route_traffic_setup.py
This configures iptables to route all traffic through Tor.
curl https://check.torproject.org
Should show Tor is being used.
# Flush iptables rules
sudo iptables -F
sudo iptables -t nat -F
# Restore default rules
sudo iptables-restore < /etc/iptables/rules.v4.backup
# First instance
tor -f ~/.tor/torrc1
# Second instance (different ports)
tor -f ~/.tor/torrc2
In torrc:
ControlPort 9051
SocksPort 9050
#!/usr/bin/env python3
from tor_vpn_beta import connect_to_tor, disconnect_tor
# Connect to US
connect_to_tor("us")
# Do work...
# Disconnect
disconnect_tor()
# Cron job to change exit node hourly
0 * * * * /path/to/change_exit_node.sh
# Use countries with typically faster connections
connect_to_tor("nl") # Netherlands
connect_to_tor("de") # Germany
connect_to_tor("se") # Sweden
# Use stable guard nodes
controller.set_conf("EntryNodes", "{us}")
controller.set_conf("GuardLifetime", "30 days")
tor_network_test.pytor_vpn_beta.py# Use with curl
curl --socks5 127.0.0.1:9050 https://example.com
# Use with wget
wget --proxy=on --proxy-type=socks5 --proxy=127.0.0.1:9050 https://example.com
# Use with git
git config --global http.proxy socks5://127.0.0.1:9050
import requests
proxies = {
'http': 'socks5://127.0.0.1:9050',
'https': 'socks5://127.0.0.1:9050'
}
response = requests.get('https://example.com', proxies=proxies)
For common issues and solutions, see the Troubleshooting page.
Last Updated: 2024-04-23
Wiki: Configuration
Wiki: Home
Wiki: Installation
Wiki: Troubleshooting