Created
December 26, 2019 08:43
-
-
Save anudit/913b8e659e21c5eeecf3e4bcbfcf3533 to your computer and use it in GitHub Desktop.
A Simple File Server with an exposed tunnel using Ngrok
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A simple file server with ngrok. | |
@requires | |
pip3 install --quiet flask flask-ngrok Flask-AutoIndex | |
Example: python3 ngrok-fileserver.py -d /content/ | |
''' | |
import argparse | |
from os import getcwd | |
from flask import Flask | |
from flask_ngrok import run_with_ngrok | |
from flask_autoindex import AutoIndex | |
app = Flask(__name__) | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-d', '--dir', default=getcwd()) | |
root_dir = vars(parser.parse_args() )['dir'] | |
AutoIndex(app, browse_root=root_dir) | |
run_with_ngrok(app) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment