Skip to main content

Python module to, serve files in physical memory to localhost and tunnel to a public endpoint.

Reason this release was yanked:

Test Version

Project description

Versions Supported

Python

Language Stats

Language count Code coverage

Repo Stats

GitHub GitHub repo size GitHub code size LOC

Code Stats

Modules Python

Activity

GitHub Repo created GitHub commit activity GitHub last commit

File Server

Set up a file server to access files in local machine from anywhere on the internet.

Setup

Environment Variables Required:

username Username which will be required to access the server.
password Password to confirm identity.
port Port number using which the endpoint is to be accessed.

Note: Uses the port number 4443 by default.

Another important variable:
host_path - Path which is to be hosted.

Note: Hosts the entire home page by default.

Environment Variables Optional:

To get notified when a client connects to your server.

gmail_user Username for a gmail account.
gmail_pass Password for the gmail account.
recipient Recipient email address to whom the notification has to be sent.

LOGOUT button and its functionality requires some changes to SimpleHTTPRequestHandler
http > server.py > SimpleHTTPRequestHandler > list_directory()
1. Create a button within the html body.
2. Create a script that does a POST call to the source endpoint.
3. Add a message in the POST call to read 'LOGOUT'

:bulb:   You can add more custom buttons by including JS, CSS in the HTML part in list_directory()

Steps to host on the internet:

Setup ngrok:

  • Download, Install and Setup ngrok

Initialize ngrok:

Option 1:

  • ngrok http $port

    Uses a random port number if env var for port.

Option 2:

  • python3 ngrok.py

    Uses the port number 4443 by default if env var for port.

Run-book:

https://thevickypedia.github.io/file-server/

Generated using sphinx-autogen

Coding Standards:

Docstring format: Google
Styling conventions: PEP 8
Clean code with pre-commit hooks: flake8 and isort

Pre-Commit

pre-commit will run flake8 and isort to ensure proper coding standards along with docs_generator to update the runbook

pip install --no-cache --upgrade sphinx pre-commit recommonmark

pre-commit run --all-files

License & copyright

© Vignesh Sivanandha Rao

Licensed under the MIT License

Change Log

0.0.1 (04/20/2021)

  • Initial commit

0.0.2 (04/20/2021)

  • update README.md

0.0.3 (04/20/2021)

  • add .gitignore

0.0.4 (04/20/2021)

  • host current directory on a desired port

0.0.5 (04/20/2021)

  • solve port busy issue and implement logging

0.0.6 (04/20/2021)

  • handle busy port errors gracefully with more information to user

0.0.7 (04/20/2021)

  • choose a repository you would like to share on internet

0.0.8 (04/21/2021)

  • implement function level logging for visibility and restructure code

0.0.9 (04/21/2021)

  • handle port in use exception

0.1.0 (04/21/2021)

  • basic html page for the front end

0.1.1 (04/21/2021)

  • add some styling in there

0.1.2 (04/21/2021)

  • change font, size and background for login form

0.1.3 (04/21/2021)

  • add background and adjust margin

0.1.4 (04/21/2021)

  • disable scrolling and set no wrap for heading

0.1.5 (04/21/2021)

  • gray out verify button if unsername and password fields are empty

0.1.6 (04/21/2021)

  • disable caching

0.1.7 (04/21/2021)

  • handle broken pipe errors and remove log file during port busy

0.1.8 (04/21/2021)

  • add basic auth check using hyperlink from index file

0.1.9 (04/21/2021)

  • log more information on incorrect or empty credentials

0.2.0 (04/21/2021)

0.2.1 (04/21/2021)

  • redirect to home page in case the auth header is lost in url

0.2.2 (04/21/2021)

  • reduce page refresh time for reload button

0.2.3 (04/22/2021)

  • onboard blocker html page

0.2.4 (04/22/2021)

  • add some meta tags

0.2.5 (04/22/2021)

  • display a timer to redirect to login page

0.2.6 (04/22/2021)

  • make sure the timer doesn't reset on page refresh

0.2.7 (04/22/2021)

  • add some detailing to the timer

0.2.8 (04/22/2021)

  • block on failed auth and unblock after timed wait

0.2.9 (04/22/2021)

  • add a runbook/user guide

0.3.0 (04/22/2021)

  • add todos for future iteration

0.3.1 (04/22/2021)

  • add LICENSE and update README.md

0.3.2 (04/22/2021)

  • update todos.py with a new long term plan

0.3.3 (04/22/2021)

  • refresh page on first visit to avoid unauth access while using multiple sessions

0.3.4 (04/23/2021)

  • onboard a handy script to kill volume usage

0.3.5 (04/23/2021)

  • use lsof to find appropriate volume usage

0.3.6 (04/23/2021)

  • brute force lsof for much quicker results

0.3.7 (04/23/2021)

  • get disk info post killing usage

0.3.8 (04/23/2021)

  • unmount disk automatically

0.3.9 (04/23/2021)

  • mound and unmount disk programmatically

0.4.0 (04/23/2021)

  • make it complex

0.4.1 (04/24/2021)

  • add another layer of page refresh from server
  • increase width of username and password fields

0.4.2 (04/24/2021)

  • remove thread for kick off and add logger for re-auth wait time

0.4.3 (04/24/2021)

  • brute force to exit threads, add display statements for startup and shutdown

0.4.4 (04/24/2021)

  • avoid unnecessary repetition in logs and add |bypass| to get access using right creds

0.4.5 (04/26/2021)

  • split js from html and update .gitignore

0.4.6 (04/26/2021)

  • avoid using socket module repeatedly

0.4.7 (04/26/2021)

  • stop volume usage gracefully

0.4.8 (04/29/2021)

  • basic ngrok integration

0.4.9 (04/29/2021)

  • add logger and more end to end socket connection

0.5.0 (04/29/2021)

  • kill ngrok and close socket properly upon exit

0.5.1 (04/29/2021)

  • add requirements.txt

0.5.2 (04/29/2021)

  • write url to a file to help Jarvis trigger ngrok

0.5.3 (04/30/2021)

  • update README.md and requirements.txt

0.5.4 (04/30/2021)

  • improve logging with respect to function name and file name

0.5.5 (04/30/2021)

  • improve logging to generic way instead of module based

0.5.6 (05/20/2021)

  • minor bug fixes

0.5.7 (06/29/2021)

  • parse url to read credentials

0.5.8 (07/04/2021)

  • fix imports

0.5.9 (07/04/2021)

  • onboard auth server

0.6.0 (07/04/2021)

  • Add logger
  • Add doc strings
  • Log unauthenticated username & password

0.6.1 (07/05/2021)

  • Prompt SSL cert creation
  • Use HTTPServer instead of test in http module
  • Wrap socket to ssl cert
  • Include line number in print statements

0.6.2 (07/05/2021)

  • Exit if username and password is not set
  • Use a default port
  • Fix logging on 404

0.6.3 (07/05/2021)

  • Add no-cache and clear-site-data headers

0.6.4 (07/05/2021)

  • Reset server side auth headers after timeout
  • Provoke client side authentication

0.6.5 (07/06/2021)

  • Better logging
  • Minor performance tweaks

0.6.6 (07/06/2021)

  • Run without SSL if .pem files are not found
  • Handle BrokenPipeError and log it
  • Check for len(args) in log_message to make it simple

0.6.7 (07/06/2021)

  • Use os.path.sep instead of '/'

0.6.8 (07/07/2021)

  • Write html to request handler

0.6.9 (07/07/2021)

  • Create html files to serve in case of login issues
  • Encode html files' data to be written on server
  • Remove write operation for incorrect creds, as this never gets written

0.7.0 (07/07/2021)

  • Onboard a welcome screen before showing files content
  • Add optional host_dir method for server_function

0.7.1 (07/07/2021)

  • fix the mess on host_dir

0.7.2 (07/07/2021)

  • Serve html file from its source instead of copying

0.7.3 (07/07/2021)

  • Add _TEMP to index files to avoid page hosting
  • Revert changes to index.html files when server is stopped

0.7.4 (07/07/2021)

  • If target_path is dir instead of endswith html

  • This will also avoid FileNotFoundError and NotADirectoryError

0.7.5 (07/08/2021)

  • Add multiple log handlers - file, console and root

  • fileLogger: Writes the log information only to the log file.

  • consoleLogger: Writes the log information only in stdout.

  • rootLogger: Logs the entry in both stdout and log file.

0.7.6 (07/09/2021)

  • Get IP info of clients who lands on any html page
  • Store client IP info in a yaml file
  • do_AUTHHEAD() -> do_AUTH()
  • Update docstrings, .gitignore and requirements.txt

0.7.7 (07/09/2021)

  • Onboard Emailer to notify client information
  • Add direct access to logs in the email footer

0.7.8 (07/09/2021)

  • Avoid multiple notifications for same action type

0.7.9 (07/09/2021)

  • Add an ultimate guide to check the ngrok public url
  • Remove manual url file creation from ngrok.py
  • Update .gitignore

0.8.0 (07/09/2021)

  • Sunset legacy TCP connection and all code references

0.8.1 (07/09/2021)

  • Remove hard coded IP urls from JavaScript

0.8.2 (07/09/2021)

  • Remove redundancy on socket module

0.8.3 (07/09/2021)

  • Automatically fetch global (ngrok) endpoint
  • authserver.py to work with ngrok.py and ngrok_fetcher.py
  • Set default port in ngrok.py
  • Remove logging from ngrok_fetcher.py and make get_ngrok module to help authserver.py

0.8.4 (07/09/2021)

  • update README.md

0.8.5 (07/09/2021)

  • refactor files and update file refs

0.8.6 (07/10/2021)

  • rename templates to html and move auth_server.html within

0.8.7 (07/10/2021)

  • Read html and write content instead of serving file

0.8.8 (07/10/2021)

  • Do not notify if connected from same public ip
  • Add dummy function to explain file_gatherer

0.8.9 (07/10/2021)

  • Log response when connected from same IP
  • move volume.py to helper_functions

0.9.0 (07/10/2021)

  • Update docstrings to onboard docs

0.9.1 (07/10/2021)

  • Update docstrings to onboard docs

0.9.2 (07/10/2021)

  • Onboard docs

0.9.3 (07/10/2021)

  • update README.md

0.9.4 (07/10/2021)

  • Use url file creation to support functionalities in Jarvis

0.9.5 (07/10/2021)

  • Check for stringified None for volume_name
  • Fix upper case por in ngrok.py

0.9.6 (07/10/2021)

  • Restart ngrok.py in case of an active session found.
  • Write url file before exiting
  • On board restart.py

0.9.7 (07/10/2021)

  • add hyperlinks on docstrings

0.9.8 (07/11/2021)

  • add badges

0.9.9 (07/11/2021)

  • Add an option to logout from session
  • Remove Helper class from volume.py
  • Change env var name for host_path
  • Update docs and README.md

1.0.0 (07/12/2021)

  • Log https endpoint instead of http
  • Update README.md

1.0.1 (07/12/2021)

  • Log when a logout has been requested
  • Add attachment content in body of the email

1.0.2 (07/12/2021)

  • Check if directory exists before serving host_path
  • Include link to logs in email body only if logs are reachable

1.0.3 (07/22/2021)

  • Sunset emailer.py and use self built module instead
  • Reload logging module since gmail-connector uses logging
  • Replace lstrip, rstrip with a generic strip
  • Update docs

1.0.4 (07/24/2021)

  • Add markdown support for sphinx documentation

1.0.5 (07/29/2021)

  • Add a button with funny alert for session and no auth

1.0.6 (07/30/2021)

  • Auto upgrade sphinx before generating docs

1.0.7 (07/30/2021)

  • Add <noscript> for JavaScript disabled browsers
  • Remove hard-coded version for gmail-connector

1.0.8 (07/31/2021)

  • Update docs with code-block

1.0.9 (10/10/2021)

  • Use custom ngrok auth token if the config yaml is present and authtoken is in env vars
  • Check if an existing ngrok is running and whether to use the self-signed cert
  • Create _static dir if not found

1.1.0 (10/12/2021)

  • Avoid proxy server and use local machine IP to serve instead of localhost
  • This allows access to the server within the Network range without any tunnelling

1.1.1 (10/17/2021)

  • Use non-routable address only when ngrok is running
  • Using local IP allows usage without internet access
  • Attempt notification only for login success or undefined

1.1.2 (11/14/2021)

  • Upgrade sphinx and gmailconnector version

1.1.3 (01/27/2022)

  • Force port number to be an integer
  • Take username from OS module

1.1.4 (02/13/2022)

  • Generate SSL certificate automatically
  • Remove restart script

1.1.5 (02/13/2022)

  • Update project name in docs

1.1.6 (02/20/2022)

  • Move all modules under a controller
  • Move files into fileserver directory
  • Use env.py to handle global env vars

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

fileware-0.0.1.tar.gz (25.4 kB view hashes)

Uploaded Source

Built Distribution

fileware-0.0.1-py2.py3-none-any.whl (17.2 kB view hashes)

Uploaded Python 2 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