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
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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
- Issues: GitHub Issues
- Documentation: GitHub Wiki
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc607c828452edcde3d42aa5203cb03812383ee8b7e50fe0a675646a4b553741
|
|
| MD5 |
94ad6766bdf9ab92017669d92ff79c62
|
|
| BLAKE2b-256 |
08017e4de54531eaefd6a2949e0e76bb7a138bac53c272e4db9645a7e6a1d302
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f2e29cb7a051aaa54c459ab28e3be0fe7e983281467b78f56c1b6ca5d94bc89
|
|
| MD5 |
ffafa3fe99120d90dfbd5a420ed6ae0b
|
|
| BLAKE2b-256 |
1d36dd604b94f45048b38f2842c16212038593553b42f432048fb70cf176ff70
|