Skip to main content

Lantern - A P2P file sharing system with TUI dashboard

Project description

 _             _                
| |   __ _ _ _| |_ ___ _ _ _ _  
| |__/ _` | ' \  _/ -_) '_| ' \ 
|____\__,_|_||_\__\___|_| |_||_|

A peer-to-peer file sharing system with a beautiful terminal UI (TUI) dashboard.

Python Version License

Features

  • P2P File Sharing - Share files directly between computers on the same network
  • Auto Discovery - Automatically discovers peers on the LAN via UDP broadcast
  • Beautiful TUI - Modern terminal interface built with Textual
  • Dual Mode - Both CLI and TUI modes available
  • Light/Dark Themes - Toggle between color schemes
  • Progress Bars - Visual feedback for large file transfers
  • Notifications - Toast notifications for operation completion
  • Path Safety - Built-in protection against path traversal attacks

Installation

From PyPI

pip install lantern-p2p

From Source

git clone https://github.com/shx-dow/lantern.git
cd lantern
pip install -e .

Usage

TUI Mode (Default)

Launch the terminal dashboard (beautiful visual interface):

lantern

CLI Mode

Use command-line interface (text-based commands):

lantern --cli

Available CLI commands:

  • peers - Show discovered peers
  • list <host[:port]> - List files on remote peer
  • download <host[:port]> <file> - Download a file
  • upload <host[:port]> <path> - Upload a file
  • myfiles - List your shared files
  • help - Show help
  • quit - Exit

Custom Port

lantern --port 6000

Key Bindings (TUI Mode)

Key Action
F1 Show help
F5 Refresh files
t Toggle theme
u Upload file
d Download file
Tab Cycle focus
q Quit

Configuration

Shared files are stored in ~/Downloads/Lantern/ by default. This directory is created automatically on first run and persists across restarts.

Security Notice

Lantern is designed for trusted local area networks only (e.g. your home network). It has no encryption and no peer authentication.

  • Do not run Lantern on public or untrusted networks (coffee shops, offices, university Wi-Fi, etc.). Anyone on the same network can see your shared files and upload arbitrary content to your machine.
  • The shared directory is world-readable by any Lantern peer on the LAN — only share files you are comfortable with all LAN participants seeing.

Requirements

  • Python 3.10 or higher
  • textual >= 0.50.0
  • psutil >= 5.9.0

Architecture

lantern/
├── config.py      # Configuration constants
├── protocol.py    # Message framing & file transfer protocol
├── discovery.py   # UDP peer discovery
├── server.py      # TCP file server
├── client.py      # TCP client operations
├── peer.py        # CLI entry point
├── tui.py         # Textual TUI dashboard
├── main.py        # Package entry point
└── styles/        # CSS stylesheets
    └── lantern.css

Development

Install with dev dependencies:

pip install -e ".[dev]"

Run linting:

black lantern/
ruff check lantern/

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please open an issue or pull request.

Acknowledgments

Built with Textual for the TUI.

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

lantern_p2p-1.1.1.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

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

lantern_p2p-1.1.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file lantern_p2p-1.1.1.tar.gz.

File metadata

  • Download URL: lantern_p2p-1.1.1.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lantern_p2p-1.1.1.tar.gz
Algorithm Hash digest
SHA256 697a751a9642d9615ffb295df37d9f6bcdba954d2c1b0f7a9ea79e3f0791211d
MD5 8f04b7d7973dc3c7f2ce3b187658084a
BLAKE2b-256 a74acf6e8bd2f5972ba718f82e9b86ecceae385a1c011b3b55b1ca5edceaae5b

See more details on using hashes here.

File details

Details for the file lantern_p2p-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: lantern_p2p-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lantern_p2p-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4d5e9780bf5b52a60864c8d0c4ce1617bf9b333c0527268594e7d1b9146e24ae
MD5 fd19d09a456f010d520df6c4b5262817
BLAKE2b-256 e2fc8deb1ce3b6bda20eebbc72400f18bbaf627f7420a111768ccd09bc18bc64

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