Metadata-Version: 2.4
Name: anywhereinput
Version: 1.2.7
Summary: Remote control your PC from any browser.
Author: Z-Hussein
License: MIT
Keywords: remote-control,screen-sharing,websocket,remote-desktop,cross-platform
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyautogui==0.9.54
Requires-Dist: aiohttp==3.14.1
Requires-Dist: requests==2.34.2
Requires-Dist: qrcode[pil]==8.2
Requires-Dist: mss==10.2.0
Requires-Dist: Pillow==12.3.0
Requires-Dist: pyyaml==6.0.3
Requires-Dist: PyQt6==6.11.0
Provides-Extra: dev
Requires-Dist: pytest==9.1.1; extra == "dev"
Requires-Dist: pytest-asyncio==1.4.0; extra == "dev"
Requires-Dist: black==26.5.1; extra == "dev"
Requires-Dist: flake8==7.3.0; extra == "dev"
Requires-Dist: mypy==2.1.0; extra == "dev"
Dynamic: license-file

# AnywhereInput

**Control your Windows, Linux, or macOS PC from any browser.** No app install, no account, no cloud dependency.

Run a Python server on your PC and control it from any browser - mouse, keyboard, scrolling, real-time screen capture, with zero-config tunnel support.

---

## ⚡ Quick Install

```bash
pip install anywhereinput
anywhereinput --tunnel cloudflare   # or: tailscale, pinggy, zrok2, local
```

**Ubuntu (recommended via pipx):**
```bash
sudo apt install pipx && pipx ensurepath
pipx install anywhereinput
anywhereinput --tunnel cloudflare
```

---

## 🖥️ Desktop Admin App (Optional)

```bash
pip install anywhereinput[app]    # includes PyQt6
anywhereinput --app               # visual GUI - no terminal needed
```

The desktop app lets you start/stop the server, pick tunnel providers, manage access tokens with IP allowlists, and monitor connected clients - all from a visual window.

---

## Why AnywhereInput?

| Tool | The Friction |
|------|-------------|
| TeamViewer / Chrome Remote Desktop | Account creation, bloated client, corporate telemetry |
| VNC / RDP | Port forwarding, firewall rules, VPN setup |
| **AnywhereInput** | `pip install` → paste link → control your PC |

---

## ✨ Features

- **Mouse** - move, click (left/right/middle), double-click, scroll
- **Keyboard** - key press, text typing, hotkey combos (Ctrl+C, Ctrl+Alt+Del, etc.)
- **Screen Capture** - real-time JPEG stream to browser, up to 120 FPS
- **Touchpad Gestures** - two-finger scroll, long-press right click, tap-to-click
- **Screen Overlay Click** - tap anywhere on the live stream to move the cursor there
- **Multi-monitor** - auto cursor tracking across all detected displays
- **Tunnels** - Cloudflare (free, auto-download), Tailscale P2P, Pinggy.io SSH, Zrok2, or LAN-only
- **Security** - per-token input permissions, IP allowlists (CIDR), auto-rotating tokens

---

## 🚀 Usage

### Interactive Menu (Default)
```bash
anywhereinput
# Select tunnel provider from the menu
```

### Direct Start with Tunnel
```bash
anywhereinput --tunnel cloudflare    # Fastest global access
anywhereinput --tunnel tailscale       # Peer-to-peer on your tailnet
anywhereinput --tunnel pinggy          # SSH tunnel, works behind firewalls
anywhereinput --tunnel zrok2           # Open source, zero-trust
anywhereinput --tunnel local           # Same WiFi/LAN only
```

### Full Configuration
```bash
anywhereinput   --host 127.0.0.1   --port 8008   --fps 60   --quality 80   --scale 0.75   --monitor 1   --tunnel cloudflare
```

| Flag | Default | Description |
|------|---------|-------------|
| `--host` | `127.0.0.1` | Server bind address |
| `--port` | `8008` | HTTP/WebSocket port |
| `--fps` | `120` | Screen capture FPS (1–120) |
| `--quality` | `85` | JPEG quality (1–95) |
| `--scale` | `1.0` | Stream scale factor (0.1–1.0) |
| `--no-capture` | off | Disable screen capture entirely |
| `--monitor` | `0` | Monitor index (0=auto-track, 1+=fixed) |
| `--tunnel` | interactive | Provider or `local` |
| `--help-tunnels` | - | Show tunnel provider quick help |
| `--version` | - | Show installed version |

---

## 🔒 Security

- **Auto-generated** 32-character access token on every server start
- **Per-token permissions** - grant/restrict `move`, `click`, `scroll`, `keyboard`, `screen_toggle`, `ping`
- **IP allowlists** per token - CIDR ranges and single-host support
- **Token rotation** - press `n` + Enter or Ctrl+N to invalidate all previous tokens
- **HTTPS/WSS** encryption when using any tunnel provider
- **Zero data** stored on external servers

> ⚠️ Designed for personal/trusted environments. For production exposure, add a reverse proxy (nginx/Traefik) with OAuth or mTLS.

---

## 📡 WebSocket API

### Authenticate
```json
{"type": "auth", "token": "***"}
```

### Send Commands
```json
{"type": "move", "mode": "relative", "dx": 10, "dy": 15}
{"type": "move", "mode": "absolute", "dx": 0.5, "dy": 0.5}
{"type": "click", "button": "left", "clicks": 1}
{"type": "scroll", "amount": 15}
{"type": "key", "key": "enter"}
{"type": "hotkey", "keys": ["ctrl", "c"]}
{"type": "screen_toggle", "enabled": true}
{"type": "ping"}
```

### Receive Events
```json
{"type": "screen", "data": "<base64-jpeg>"}
{"type": "screen_status", "status": "rebuilding", "message": "Reconnecting to display..."}
{"error": "capture_error", "message": "Input engine is recovering.", "recovering": true}
```

### HTTP Endpoints
| Endpoint | Description |
|----------|-------------|
| `GET /api/screen` | Screen dimensions |
| `GET /api/engine` | Input engine + screen engine health |
| `GET /api/monitors` | All monitors + current selection |
| `POST /api/monitor/{index}` | Switch capture monitor |
| `GET /api/tokens` | List tokens (masked values) |
| `POST /api/tokens` | Create token with custom permissions |
| `PATCH /api/tokens/{token}` | Update token name/permissions |
| `DELETE /api/tokens/{token}` | Revoke a token |
| `GET /api/clients` | Connected WebSocket clients with IPs |

---

## 🧰 Troubleshooting

| Problem | Fix |
|---------|-----|
| Tunnel URL not showing | Check internet; verify provider status; try another provider |
| Can't connect from device | Check firewall allows port 8008; test `http://localhost:8008` on PC first |
| Connection timeout | Verify both devices have internet; check tunnel provider status |
| Mouse lag | Reduce drag distance; try local network; lower `--fps` |
| Black cursor on capture | Install `mss`; on Linux ensure X11 display is accessible |
| Blank screen stream | Check server logs; try `--no-capture`; ensure Pillow is installed |
| Keyboard double-typing | 50ms debounce active; check mobile keyboard autocorrect |
| Zrok2 "not enabled" | Run `zrok2 enable <TOKEN>` or use `zrok2_repair.py` |
| Cloudflared missing | Auto-downloads on first run; or install manually via winget/brew |
| Python not found | Install Python 3.9+ from python.org, ensure it's on PATH |

---

## 📋 System Requirements

| Component | Minimum |
|-----------|---------|
| **Server OS** | Windows 10/11, Linux, macOS 12+ |
| **Python** | 3.9–3.12 |
| **Client** | Any modern browser with WebSocket + Pointer/Touch Events |
| **Internet** | Required on both devices for remote tunnel access |

---

## 📦 Dependencies

```toml
pyautogui==0.9.54
aiohttp==3.14.1
requests==2.34.2
qrcode[pil]==8.2
mss==10.2.0
Pillow==12.3.0
pyyaml==6.0.3
PyQt6==6.11.0
```

---

## 🔗 Links

- **Website:** https://www.anywhereinput.com
- **GitHub:** https://github.com/Z-Hussein/AnywhereInput
- **PyPI:** https://pypi.org/project/anywhereinput/
- **Issues:** https://github.com/Z-Hussein/AnywhereInput/issues
- **License:** MIT

---

*Built with ❤️ for developers who value simplicity over complexity.*
