Torsen is a powerful command-line tool for Linux designed to route all your system's internet traffic through the Tor network. It provides a full-system transparent proxy, ensuring your applications are automatically anonymized without needing individual configuration.
In today's digital world, privacy is paramount. Torsen was created to simplify the complex process of achieving system-wide anonymity. Manually configuring iptables, DNS settings, and the Tor service can be error-prone and can lead to dangerous leaks.
Torsen automates this entire process with two simple commands: connect and disconnect. When you connect, it intelligently backs up your existing network settings, modifies system files (/etc/tor/torrc, /etc/resolv.conf), and applies a strict set of firewall rules to prevent any non-Tor traffic from leaving your machine. When you disconnect, it safely restores your system to its original state, leaving no trace behind.
This tool is perfect for privacy-conscious users, security researchers, and anyone who wants to ensure their digital footprint is protected.
- System-Wide Anonymity: Transparently forces all internet traffic from every application through the Tor network.
- DNS Leak Protection: Hijacks system DNS requests and routes them through Tor's secure DNS resolver, preventing your ISP from logging your browsing activity.
- Strict Firewall Rules: Implements robust
iptablesrules to block any direct connection, ensuring that if the Tor connection fails, your real IP address is not exposed. - Fully Automated: Automatically manages the backup, modification, and restoration of critical network configuration files.
- Safe & Reversible: A built-in cleanup function ensures that your original system settings are perfectly restored upon disconnection (using
Ctrl+Cor thedisconnectcommand). - Connection Monitoring: Actively checks the Tor bootstrap process to confirm a successful connection before enforcing firewall rules.
- Colored Logging: Provides clear, color-coded console output and detailed log files for easy status tracking and debugging.
The project is organized into modular components for clarity and maintainability.
.
├── default-torrc.txt
├── README.md
└── src
├── linux-version
│ ├── config
│ │ ├── bash.sh
│ │ ├── __init__.py
│ │ ├── setting.py
│ │ └── tor-config.template
│ ├── dns
│ │ ├── dns_manager.py
│ │ └── __init__.py
│ ├── iptables
│ │ ├── __init__.py
│ │ └── rules.py
│ ├── logs
│ │ └── logs.log
│ ├── main.py
│ ├── requirements.txt
│ ├── tor
│ │ ├── controller.py
│ │ └── __init__.py
│ └── utils
│ └── logger.py
└── mobile-version
Follow these instructions to get Torsen up and running on your system.
Before you begin, ensure you have the following installed:
-
Root Access: The script must be run with
sudoprivileges. -
Python 3: Version 3.6 or higher.
-
Tor: The Tor service and obfs4proxy must be installed on your system.
# For ArchLinux/Arch-based systems sudo pacman -Syu sudo pacman -S tor sudo pacman -S obfs4proxy# For ubuntu/debian-based systems sudo apt install update sudo apt install tor sudo apt install obfs4proxy -
iptables: Standard on most Linux distributions.
-
Python Libraries: The script depends on
stemandcoloredlogs.
-
Clone the repository (or download the source code):
git clone "https://github.com/awmiriiw/torsen.git" cd torsen
-
Install the required Python packages:
run:
sudo pip3 install -r requirements.txt --break-system-packages
-
Run the script: Navigate to the
src/linux-versiondirectory to run the main script.-
To start the secure connection:
sudo python3 main.py connect
The script will now configure your system. Once connected, it will say "Connection is active."
-
To stop the connection and restore settings: Simply press
Ctrl+Cin the terminal where the script is running. Alternatively, if you need to disconnect from another terminal, you can run:sudo python3 main.py disconnect
-
This project is open-source and available under the GNU AGPLv3 License.
Thanks for visiting! ☕