Skip to main content

TorRunner is designed to facilitate the deployment of Tor hidden services.

Project description

🧅 𝙏𝙤𝙧𝙍𝙪𝙣𝙣𝙚𝙧

TorRunner is a Python package designed to facilitate the deployment of Tor hidden services. It simplifies the process by allowing you to set up and run a hidden service that listens on a specified port. This package automates the installation and configuration of the Tor software, removing the need for manual setup and making it easier to get started.

Github PyPI Libraries.io


Examples

On the command line

tor_runner --help

Output:

usage: tor_runner [-h] [-p PORT] [-s [HIDDEN_SERVICE_DIRS ...]] [-b [BRIDGES ...]] [-d DEFAULT_BRIDGE_TYPE] [-q BRIDGE_QUANTITY] [--quiet]

Run as Tor hidden service

options:
  -h, --help            show this help message and exit
  -p PORT, --port PORT  Port to listen
  -s [HIDDEN_SERVICE_DIRS ...], --hidden-service-dirs [HIDDEN_SERVICE_DIRS ...]
                        List of hidden service directories
  -b [BRIDGES ...], --bridges [BRIDGES ...]
                        List of bridges for Tor
  -d DEFAULT_BRIDGE_TYPE, --default-bridge-type DEFAULT_BRIDGE_TYPE
                        Default bridge type
  -q BRIDGE_QUANTITY, --bridge-quantity BRIDGE_QUANTITY
                        How many bridges to use
  --quiet               Run in quiet mode (no output)

Without an App

from tor_runner import TorRunner

# Uses 11 default obfs4 bridges to connect
runner = TorRunner(
    hs_dirs = ["/path/to/hs"], bridges = [],
    default_bridge_type = "obfs4", bridge_quantity = 11
)

if __name__ == '__main__':
    # Forwards 80 -> 5000 and 22 -> 22
    runner.run([(80, 5000), (22, 22)], quite = False, wait = True)

For Flask

from flask import Flask
from tor_runner import TorRunner

app = Flask(__name__)

# Uses 11 default obfs4 bridges to connect
runner = TorRunner(default_bridge_type = "obfs4", bridge_quantity = 11)

@app.route('/')
def index():
    """
    Route accessible via the Tor network
    """

    return 'Hello, Anonymous!🖐️'

if __name__ == '__main__':
    runner.flask_run(app, host = '127.0.0.1', port = 9000)

For Sanic

from sanic import Sanic, HTTPResponse
from sanic.response import text
from tor_runner import TorRunner

app = Sanic(__name__)

# Uses 11 default obfs4 bridges to connect
runner = TorRunner(default_bridge_type = "obfs4", bridge_quantity = 11)

@app.route('/')
async def index(request) -> HTTPResponse:
    """
    Route accessible via the Tor network
    """

    return text('Hello, Anonymous!🖐️')

if __name__ == '__main__':
    runner.sanic_run(app, host = '127.0.0.1', port = 8000, workers = 16)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tor_runner-1.2.2.tar.gz (29.2 kB view hashes)

Uploaded Source

Built Distribution

tor_runner-1.2.2-py3-none-any.whl (29.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page