Skip to content

Instantly share code, notes, and snippets.

@anudit
Created December 26, 2019 08:43
Show Gist options
  • Save anudit/913b8e659e21c5eeecf3e4bcbfcf3533 to your computer and use it in GitHub Desktop.
Save anudit/913b8e659e21c5eeecf3e4bcbfcf3533 to your computer and use it in GitHub Desktop.
A Simple File Server with an exposed tunnel using Ngrok
'''
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