Skip to main content

A secure, zero-config CLI file server with upload capabilities and encrypted transport

Project description

๐Ÿช Skyhook

A secure, zero-config CLI file server with upload capabilities and encrypted transport

Skyhook is a modern replacement for python -m http.server with authentication, HTTPS support, and file upload capabilities. Perfect for quickly sharing files between machines or within a local network.

โœจ Features

  • ๐Ÿ” Secure by Default: Optional HTTP Basic Auth and self-signed SSL certificates
  • ๐Ÿ“ค Upload Support: Drag-and-drop file uploads via web interface
  • โšก Fast: Quick startup for ad-hoc sharing
  • ๐ŸŽจ Modern UI: Responsive web interface that works on mobile
  • ๐Ÿงพ File Previews: Preview text, JSON, Markdown, CSV, images, PDFs, and videos
  • ๐Ÿ” Search & Filter: Quickly find files in large directories
  • ๐Ÿ›ก๏ธ Security Hardened: Path sanitization prevents directory traversal attacks
  • ๐Ÿ“ฑ Mobile Friendly: Upload files from your phone's browser

๐Ÿš€ Quick Start

PyPI Python

Installation

pip install skyhook-rayan

Or install from source:

git clone https://github.com/rayan-1005/skyhook.git
cd skyhook
pip install -e .

Basic Usage

# Serve current directory on port 8000
skyhook

# Serve a specific directory
skyhook /path/to/files

# Custom port
skyhook --port 8080

# Enable authentication
skyhook --auth username:password

# Enable HTTPS with self-signed certificate
skyhook --ssl

# Full configuration
skyhook /data --port 8443 --auth admin:secret --ssl

๐Ÿ“– Usage Examples

Simple File Sharing

Share files in the current directory:

skyhook

Then visit http://localhost:8000 in your browser.

Secure File Transfer

Enable authentication and HTTPS for secure transfers:

skyhook --auth myuser:mypass --ssl

Access via https://localhost:8000 (you'll need to accept the self-signed certificate warning).

Remote Access

Bind to all interfaces to allow remote connections:

skyhook --host 0.0.0.0 --port 8000 --auth user:pass

Now accessible from other devices on your network at http://YOUR_IP:8000.

Quick File Upload

Upload files to a specific directory:

cd /tmp/uploads
skyhook --auth upload:secret

Open the URL in your browser and drag files to upload.

๐ŸŽฏ Use Cases

  • Dev Workflow: Quickly share build artifacts between machines
  • Network Transfers: Move files between computers without USB drives
  • Mobile Uploads: Upload photos from your phone to your computer
  • Team Collaboration: Share files within a local network
  • Remote Work: Securely transfer files to/from a remote server

๐Ÿ”’ Security Features

Authentication

HTTP Basic Authentication protects your files from unauthorized access:

skyhook --auth username:password

Credentials are checked using constant-time comparison to prevent timing attacks.

SSL/TLS Encryption

Enable HTTPS to encrypt all traffic:

skyhook --ssl

Skyhook automatically generates a self-signed certificate. For production use, configure a proper certificate with a reverse proxy like nginx.

Path Sanitization

All file paths are strictly validated to prevent directory traversal attacks. Attempts to access files outside the served directory are blocked:

# These attacks are automatically prevented:
../../../etc/passwd  โŒ Blocked
../../secret.txt     โŒ Blocked
/etc/hosts           โŒ Blocked

๐Ÿ”ง CLI Reference

Usage: skyhook [PATH] [OPTIONS]

Arguments:
  PATH  Directory to serve [default: current directory]

Options:
  -p, --port INTEGER       Port to bind to [default: 8000]
  -h, --host TEXT          Host interface to bind to [default: 0.0.0.0]
  -a, --auth TEXT          Enable auth (format: username:password)
  --ssl                    Enable HTTPS with self-signed certificate
  --reload                 Enable auto-reload for development
  --help                   Show this message and exit

Commands:
  run    Start the file server (default command)
  version  Show Skyhook version

๐ŸŒ API Endpoints

Skyhook provides a RESTful API:

Endpoint Method Description
/ GET List root directory
/browse/{path} GET List specific directory
/download/{path} GET Download a file
/preview/{path} GET Preview a file
/raw/{path} GET Inline file for previews
/upload POST Upload files
/health GET Health check

Upload via curl

# Upload single file
curl -F "files=@myfile.txt" http://localhost:8000/upload

# Upload with authentication
curl -u username:password -F "files=@myfile.txt" http://localhost:8000/upload

# Upload multiple files
curl -F "files=@file1.txt" -F "files=@file2.txt" http://localhost:8000/upload

# Upload to subdirectory
curl -F "files=@myfile.txt" -F "path=subdir" http://localhost:8000/upload

๐Ÿงช Development

Running Tests

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run security tests specifically
pytest tests/test_skyhook.py::TestSecurity -v

Project Structure

skyhook/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ skyhook/
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ main.py          # CLI entrypoint
โ”‚       โ”œโ”€โ”€ server.py        # FastAPI application
โ”‚       โ”œโ”€โ”€ security.py      # Auth & SSL logic
โ”‚       โ””โ”€โ”€ templates/
โ”‚           โ””โ”€โ”€ index.html   # Web UI
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_skyhook.py      # Test suite
โ”œโ”€โ”€ pyproject.toml           # Project metadata
โ””โ”€โ”€ README.md

๐Ÿ“Š Performance

  • Streaming I/O: Uploads and downloads are chunked to avoid loading entire files in memory
  • Startup: Typically fast for small directories (exact time depends on machine and disk)
  • Concurrency: Supports multiple simultaneous uploads and downloads
  • Preview limit: Previews are limited to 1 MB per file to keep pages responsive

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

MIT License - see LICENSE file for details

๐Ÿ™ Acknowledgments

โš ๏ธ Security Notes

  • Self-signed SSL certificates will trigger browser warnings (this is expected)
  • For production use, configure proper SSL certificates via reverse proxy
  • Always use authentication when exposing to untrusted networks
  • Keep dependencies updated for security patches

๐Ÿ“ž Support


Made with โค๏ธ by Rayan

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

skyhook_rayan-1.2.1.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

skyhook_rayan-1.2.1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file skyhook_rayan-1.2.1.tar.gz.

File metadata

  • Download URL: skyhook_rayan-1.2.1.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for skyhook_rayan-1.2.1.tar.gz
Algorithm Hash digest
SHA256 fc607c828452edcde3d42aa5203cb03812383ee8b7e50fe0a675646a4b553741
MD5 94ad6766bdf9ab92017669d92ff79c62
BLAKE2b-256 08017e4de54531eaefd6a2949e0e76bb7a138bac53c272e4db9645a7e6a1d302

See more details on using hashes here.

File details

Details for the file skyhook_rayan-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: skyhook_rayan-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for skyhook_rayan-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2e29cb7a051aaa54c459ab28e3be0fe7e983281467b78f56c1b6ca5d94bc89
MD5 ffafa3fe99120d90dfbd5a420ed6ae0b
BLAKE2b-256 1d36dd604b94f45048b38f2842c16212038593553b42f432048fb70cf176ff70

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