A lightweight directory indexing and password protection tool for static file servers.
This script generates index.html files for all directories and subdirectories, with password protection for the top-level directory.
- Recursively generates index.html files for any directory structure
- Password protects the main index.html while keeping subdirectories accessible
- Mobile-friendly, responsive design
- "Remember me" functionality for 7 days
- Works on any static hosting platform (Google Cloud Storage, S3, GitHub Pages, etc.)
- No server-side dependencies - pure HTML, CSS, and JavaScript
- Optional file filtering to include only specific file types
# Clone the repository
git clone https://github.com/yourusername/python-fileserver.git
cd python-fileserver
# Install dependencies
pip install pycryptodome
python encrypt_indexpage.py /path/to/directory --password YOUR_PASSWORD
--password, -p Password for accessing the top-level directory (required)
--filter, -f Only include files matching glob pattern (e.g., "*.jpg")
--verbose, -v Show detailed processing information
--dryrun, -d Test without writing any files
--footer Custom footer text for the login page
# Create index files for your Documents folder with password protection
python encrypt_indexpage.py ~/Documents --password mysecret --verbose
# Only include PDF files in the listings
python encrypt_indexpage.py ~/Documents --password mysecret --filter "*.pdf"
# Add custom footer
python encrypt_indexpage.py ~/Documents --password mysecret --footer "© 2025 My Company"
Use the included landingpage_upload.sh
script for a one-command process:
# Make the script executable
chmod +x landingpage_upload.sh
# Run the script with your password
./landingpage_upload.sh mysecret
The script:
- Removes any existing index.html files
- Generates new index files with password protection
- Syncs everything to your Google Cloud Storage bucket
-
Generate your index files:
python encrypt_indexpage.py ./my_files --password mysecret
-
Upload to your GCS bucket:
gsutil -m rsync -r -d . gs://your-bucket-name/
-
Set bucket permissions and enable website hosting in the Google Cloud Console.
-
Access your file server at the GCS website URL.
- The script traverses your directory structure and creates index.html files in each folder
- The top-level index.html contains a password protection mechanism
- Subdirectory navigation links point to each folder's index.html file
- Password verification happens entirely client-side using JavaScript
- Login status is remembered using browser local storage
This tool uses simple client-side protection and is suitable for casual use or internal sharing. It is not intended for highly sensitive data, as the content is only base64-encoded, not encrypted with strong cryptography.
MIT