
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Python port of the Localtunnel Client with enhancements
Expose your localhost to the 🌎 for easy testing and sharing:
A Python client for LocalTunnel, enabling developers to expose their local servers to the internet with minimal setup. Designed for ease of use, flexibility, and lightweight integration, this library supports both CLI and programmatic APIs.
LocalTunnel provides a simple way to make a local development server accessible to anyone on the internet. Unlike similar tools like Ngrok, this library is lightweight, open-source, and Python-native, making it perfect for developers who prefer seamless integration into their Python projects.
Install using a package manager 📦:
pip
pip install localtunnel-py
uv
uv add localtunnel-py
poetry
poetry add Localtunnel-py
For contributors or advanced users, clone the repository and install in editable mode:
git clone https://github.com/gweidart/localtunnel-py.git
cd localtunnel-py
pip install -e .
Expose Local Servers Effortlessly:
Custom Subdomains:
https://my-custom-subdomain.loca.lt
Robust Retry Mechanisms:
Monitoring and Lifecycle Management:
Flexible Header Transformations:
HeaderTransformer
.Lightweight CLI Tool:
Seamless Integration:
Extensive Logging:
Here’s how to expose a local server programmatically:
import asyncio
from localtunnel.tunnel_manager import TunnelManager
async def main():
manager = TunnelManager()
manager.add_tunnel(port=8000, subdomain="my-subdomain")
try:
await manager.open_all()
for tunnel in manager.tunnels:
print(f"Tunnel open at URL: {tunnel.get_tunnel_url()}")
# Keep running
await asyncio.Event().wait()
finally:
await manager.close_all()
asyncio.run(main())
Expose a local server directly from the command line:
lt --port 3002 -s my-subdomain
Available arguments:
Argument | Description |
---|---|
-p, --port | Local port to expose via the tunnel (required). |
-s, --subdomain | Optional subdomain for the tunnel. |
-t, --host | LocalTunnel server URL (default: https://localtunnel.me ). |
-m, --monitor | Enable monitoring of the tunnel. |
import asyncio
from localtunnel.tunnel_manager import TunnelManager
async def main():
manager = TunnelManager()
manager.add_tunnel(port=8000, subdomain="my-subdomain")
try:
await manager.open_all()
for tunnel in manager.tunnels:
print(f"Tunnel open at URL: {tunnel.get_tunnel_url()}")
# Keep running
await asyncio.Event().wait()
finally:
await manager.close_all()
asyncio.run(main())
Modify headers dynamically using HeaderTransformer
:
from localtunnel.header_transformer import HeaderTransformerFactory
transformer = HeaderTransformerFactory.create_transformer(
transformer_type="host", host="my-custom-host"
)
headers = {"Authorization": "Bearer token"}
transformed_headers = transformer.transform(headers)
print(transformed_headers)
Implement robust retry mechanisms for tunnel connections:
from localtunnel.utils import ExponentialBackoffRetryTemplate
retry_strategy = ExponentialBackoffRetryTemplate(base_delay=1.0, max_delay=10.0)
retry_strategy.retry(some_function, retries=5)
Use TunnelManager
to handle multiple tunnels seamlessly:
from localtunnel.tunnel_manager import TunnelManager
manager = TunnelManager()
manager.add_tunnel(port=8000, subdomain="app1")
manager.add_tunnel(port=8001, subdomain="app2")
await manager.open_all()
Issue: Tunnel connection drops frequently.
TunnelManager
.Issue: Custom subdomain not working.
add_tunnel()
.We welcome contributions! Here's how you can get involved:
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
Python port of the localtunnel.me Client | Expose localhost to the world!
We found that localtunnel-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.