Skip to main content

A simple way to run Flask apps on tor from your machine.

Project description

flask-tor

Run your flask website in tor using flask_tor.It doesn’t interfere with other tor processes on your computer, so you can use the Tor Browser or the system tor on their own.

PyPI version Downloads Downloads Python 3.6

Disclaimer:-

Use it only for educational purpose.

Features

  • No need root permission
  • Multiple instances
  • Optional persistent onion address (reuse the same .onion between runs)

Compatability

Python 3.6+ is required.

Installation

pip install flask-tor

Quickstart

  1. Import with from flask_tor import run_with_tor .
  2. call function run_with_tor() , store as variable and give it as port argument in flask app.
# flask_tor_example.py
from flask import Flask
from flask_tor import run_with_tor

app = Flask(__name__)
port = run_with_tor(persistent_key_file='~/.flask_tor/hidden_service_key')

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == '__main__':
    app.run(port=port)

Running the example:

python flask_tor_example.py
connecting_to_tor: 100% - Done                                                       
 * Running on <random_adress>.onion
 * Serving Flask app "main"
 * Debug mode: off
 * Running on http://127.0.0.1:<port>/

If you pass a persistent_key_file path, the first run will create a key file and subsequent runs will reuse it so the onion address stays the same. Set reuse_key=False to force a new address while still updating the stored key.

Tutorial

Watch Here

Credit :- onionshare

Project details


Download files

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

Source Distribution

flask-tor-1.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_tor-1.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file flask-tor-1.1.0.tar.gz.

File metadata

  • Download URL: flask-tor-1.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for flask-tor-1.1.0.tar.gz
Algorithm Hash digest
SHA256 70d7cd99139de19326d7bace3ed837f46c401fb0eaa4b340c3fab6f322b35e84
MD5 149834fee7b18a41e27736c95cf877e5
BLAKE2b-256 69c3751122967d6aa96205af08830af8995995714fc546359fb565d3abdc5968

See more details on using hashes here.

File details

Details for the file flask_tor-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: flask_tor-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for flask_tor-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffd3d4fa8d70982c6276a741ef28908adc931275223ede8156af11be024dca62
MD5 c4453eb2f20855e9ba9c5c6fad3e40e2
BLAKE2b-256 9cc528a07cc78e79f2731ba8b21fc8541dfe38373ed1c10771ebc4f4f054fab4

See more details on using hashes here.

Supported by

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