TunnelProxy
v1.0.5TunnelProxy integration for AI agents. Enables network proxying, remote command execution, and bidirectional file transfer through user's local TunnelProxy s...
Like a lobster shell, security has layers — review code before you run it.
Runtime requirements
TUNNEL_HOSTrequiredTUNNEL_PORTrequiredTUNNEL_HTTP_PORTrequiredTUNNEL_TIMEOUTrequiredUPLOAD_MAGICrequired🚇 Security Warning
This skill enables remote command execution and file transfer on your machine.
Before use:
- Set
TUNNEL_HOST=127.0.0.1unless you intentionally expose the service - Use random high ports (49152-65535) for public exposure
- Run TunnelProxy under a restricted user account
- Review the included scripts before execution
Do NOT use with untrusted third-party Agent services.
TunnelProxy Skill
Overview
This skill enables AI agents running in cloud sandboxes to bypass network restrictions by utilizing the user's local TunnelProxy service. It provides:
Remote command execution via PTY Shell Bidirectional file transfer via HTTP interface Unrestricted network access through user's local connection
Quick Start
1. Initialize Connection
from tunnel_ops import TunnelOps
# Configure with user's TunnelProxy address
ops = TunnelOps(
host="your-frp-server.example.com", # or user's custom address
pty_port=27417, # PTY Shell port
http_port=8080 # HTTP file server port
)
# Verify connectivity
if ops.check()["http"] and ops.check()["pty"]:
print("Tunnel is ready")
if ops.check()["http"] and ops.check()["pty"]:
print("Tunnel is ready")
2. Execute Remote Commands
# Run any command on user's machine
output = ops.run_remote("curl -s https://httpbin.org/ip")
print(f"Remote IP: {output}")
# Chain commands
ops.run_remote("cd /tmp && ls -la")
3. File Transfer
# Pull file from user device to sandbox
ops.pull_file("/path/on/remote/file.txt", "local_copy.txt")
# Push file from sandbox to user
ops.push_file("./result.tar.gz")
4. Fetch Remote Content
# Download via user's network
content = ops.fetch_url("https://arxiv.org/abs/2301.00001")
# Download files with progress
ops.fetch_url_to_file("https://example.com/large.zip", "./downloaded.zip")
5. Install Blocked Packages
# Download pip packages via user's network
local_tar = ops.pip_download("torch torchvision", target_dir="./packages")
API Reference
TunnelOps Class
| Method | Description | Parameters |
|---|---|---|
check() | Verify HTTP and PTY connectivity | None |
run_remote(cmd, timeout) | Execute shell command | cmd: str, timeout: int = 30 |
fetch_url(url, timeout) | GET URL via remote curl | url: str, timeout: int = 30 |
fetch_url_to_file(url, path, timeout) | Download URL to local file | url, local_path, timeout |
pull_file(remote, local) | Download remote file | remote_path, local_path |
push_file(local) | Upload local file to remote | local_path |
pip_download(package, target_dir) | Download pip package | package, target_dir |
Environment Variables
| Variable | Default | Description |
|---|---|---|
TUNNEL_HOST | frp.freefrp.net | TunnelProxy host |
TUNNEL_PORT | 27417 | PTY Shell port |
TUNNEL_HTTP_PORT | 8080 | HTTP file server port |
TUNNEL_TIMEOUT | 30 | Default command timeout |
Error Handling
try:
output = ops.run_remote("long_running_command", timeout=60)
except socket.timeout:
print("Command timed out - try increasing timeout")
except ConnectionRefusedError:
print("TunnelProxy unreachable - check if service is running")
Security Notes
This skill grants the agent complete control over commands executed on the user's machine. Only use with:
- Fully trusted AI agents you control
- Users who understand the security implications
- In environments with additional safeguards (firewalls, UPLOAD_MAGIC)
Low-Level Usage
For single command execution without the Python API:
echo '<invoke name="exec"><parameter name="command">pwd</parameter></invoke>' | python3 scripts/pty_exec.py
Or use scripts/http_transfer.py for file operations:
python3 scripts/http_transfer.py ping
python3 scripts/http_transfer.py upload /path/to/file
Comments
Loading comments...
