Skip to content
salmanasmatPublic

Repository files navigation

RemoteLAN

Version Downloads Target Platform UI

A high-performance, custom, LAN-only remote desktop tool for internal office use built with C# / .NET 8 / WPF, designed to work like AnyDesk — every installation can connect out to other machines or accept incoming connections over direct TCP sockets. Zero third-party cloud infrastructure or relay servers required.

RemoteLAN Interface

  • AnyDesk-Style Unified App: Both PC A and PC B install and run the exact same RemoteLAN application.
  • Bidirectional Control: Connect from PC A to PC B, or from PC B to PC A, or simultaneously.
  • Zero Cloud Relay: Direct TCP socket connections between machines on your trusted local area network.
  • Continuous Auto-Discovery & Multi-NIC Deduplication: Automatically discovers active RemoteLAN PCs on your subnet in the background using persistent, stable Machine GUIDs (agent.id). Multi-homed machines (Ethernet + Wi-Fi) are deduplicated into exactly one tile per machine ID, automatically prioritizing wired Ethernet over Wi-Fi with overridable adapter selection.
  • Zero Disk Thrashing & High-Performance Idle Architecture: Eliminates 100% HDD active time. LAN discovery pings update timestamps strictly in-memory, writing to disk only upon structural device changes. Scheduled task verification is cached in-memory, and supervisor process polling uses native Win32 exit codes with exponential backoff.
  • Pre-Logon Lock Screen Remote Access & Headless Server (RustDesk-Aligned): Seamless remote access to headless and locked machines immediately after reboot without requiring prior local Windows logon. Runs a lightweight background daemon (--server) with socket listeners and screen capture ready before user login, with zero GUI overhead and lazy WPF window materialization on demand.
  • In-Session Ephemeral Chat (AnyDesk/TeamViewer Style): Full bidirectional text messaging between controller and agent during an active remote session:
    • Zero-Footprint Ephemeral Lifetime: Pure in-memory architecture (ChatViewModel) with no files, logs, or persistent storage. Completely wiped the instant the session disconnects.
    • Controller Slide-Out Drawer: Collapsible chat panel integrated directly into SessionWindow with unread message badges on the top toolbar and live typing indicators.
    • Agent Floating Desktop Overlay (HostChatWindow): Unobtrusive, topmost, chromeless widget floating on the host PC desktop. Starts as a compact pill, expands on click or incoming message, supports dragging, and self-destructs on disconnect.
    • Input Keyboard Isolation: Complete focus separation ensuring keystrokes typed into chat inputs are never forwarded to the remote host machine.
  • System Tray Minimization: Closing the application window (clicking 'X') hides RemoteLAN to the Windows System Tray notification area, keeping the agent server and discovery listening in the background.
  • Clean Modern Light Mode UI:
    • Left Vertical Sidebar: Displays This PC's identity, IP address, and alphanumeric session access code with one-click copy, regeneration, and custom code assignment, with a quick-access Settings launcher.
    • Top Horizontal Header: Streamlined remote address input with instant reachability validation before requesting authentication.
    • Interactive Device Grid: Discovered LAN machines shown as square cards with machine name, preferred IP, active connection badge (Ethernet / Wi-Fi), and online badge — click to connect.
  • Pre-Logon & Headless Remote Connection After Restart: Seamless remote access to headless and locked machines immediately after reboot without requiring prior local Windows logon. Registers an elevated system startup task (RemoteLAN_Autostart) triggering at boot (/SC ONSTART) under NT AUTHORITY\SYSTEM with dual boot and logon triggers. A lightweight Session 0 supervisor detects active interactive sessions even on headless PCs without display monitors, elevates privileges (SeAssignPrimaryTokenPrivilege, SeIncreaseQuotaPrivilege, SeTcbPrivilege), spawns into the console session via native CreateProcessAsUserW with environment block creation, binds discovery and socket listeners, captures the sign-in screen, and accepts unattended connections.
  • Centralized Machine-Wide Configuration Storage: Settings (settings.json) and Machine ID (agent.id) persist centrally in C:\ProgramData\RemoteLAN with automatic migration from user AppData, ensuring identical host credentials and unattended passwords before and after user logon.
  • Diagnostic File Logging: Thread-safe persistent file logger in C:\ProgramData\RemoteLAN\service.log tracking boot events, supervisor transitions, child process spawning, and server lifecycle across system restarts.
  • Fast Screen Streaming & Real-Time Lock Screen Control: High-performance DXGI Desktop Duplication engine with automatic GDI fallback and dynamic desktop switching (DesktopManager). Gracefully handles session locks, UAC prompts, and lock screens across session boundaries.
  • Windows OS Password Save & Automated Sign-In Screen Unlock: Save remote Windows user passwords per computer. Credentials resolve across stable Machine GUIDs, hostnames, and IP addresses, surviving DHCP changes and multi-NIC adapter transitions. Lock screen unlock employs native Secure Attention Sequence (SendSAS), CapsLock normalization, and hardware scan code synthesis to reliably wake and unlock the Windows logon screen without keystroke drops.
  • Persistent Device History & Live Status Indicators: Discovered LAN machines remain saved in device history even when powered down or disconnected. Cards feature real-time status indicators (vibrant green #22C55E when online, slate gray #94A3B8 with card dimming and last-seen timestamp when offline). A 3-dots kebab menu allows configuring OS passwords, forgetting saved credentials, and removing entries from history.
  • Automatic Administrator Elevation & Secure Desktop Control: Built-in application manifest and startup elevation routines automatically launch RemoteLAN with Administrator privileges (and seamless transition to SYSTEM token via Winlogon duplication) without requiring manual in-app restart clicks, ensuring full access to the Windows Secure Desktop and sign-in screen.
  • Unified Actions Control Center: Consolidated ⚡ Actions ▾ menu in the remote viewer toolbar containing Send Ctrl+Alt+Del, 🔑 OS Login, Send remote input toggle, Lock Remote PC on Session End (off by default), and remote power management (Lock Workstation, Sleep / Suspend, Restart PC..., and Shut Down PC...).
  • Interactive Incoming Connection Approval (AnyDesk-Style): When connecting without a saved PIN, the controller PC presents the PIN prompt while concurrently requesting approval in the background. The remote PC displays an incoming connection request dialog with ✓ Accept and ✕ Dismiss buttons. Clicking Accept on the remote PC establishes the session immediately without requiring the controller to enter the access code.
  • Intelligent Connection IP Selector with Adapter Prioritization & Offline Indicator: The local IP address selector and multi-NIC endpoint dropdown intelligently prioritize active network adapters. If both Ethernet and Wi-Fi are available, Ethernet is selected as the default connection; if only one is available, that adapter is chosen. Dropdown items clearly display the actual adapter type (Ethernet in blue, Wi-Fi in green). When no network connection is detected, the access code is automatically removed (------), action buttons (Copy, New, Custom..., Connect) are disabled, and a prominent red offline indicator is displayed. Dynamic Windows network event listeners (NetworkChange) automatically restore connectivity and regenerate/display access codes the instant a network cable or Wi-Fi reconnects.
  • True Borderless Fullscreen with Peek Toolbar: Fullscreen mode completely expands the remote desktop to fill the screen while hiding toolbars and status bars; hovering near the top edge smoothly reveals the floating peek toolbar.
  • Natural Mouse Pointer & Dynamic Resolution: Standard mouse arrow pointer in the remote desktop viewport (eliminating awkward + crosshair cursors), with live dynamic resolution adaptation and aspect-ratio preservation.
  • Resilient Input State Management & Bi-directional Input Control: Remote mouse movement, clicks, wheel scrolling, and keyboard keystrokes via Win32 SendInput with letterbox/pillarbox coordinate mapping and scancode keyboard synthesis.
  • Modern Rounded App Icon & Full Taskbar Integration: Custom antialiased squircle application icon bundled as multi-resolution .ico (16x16 to 256x256) embedded in the Win32 executable, window taskbar, and installer.
  • Dedicated Settings & Security Interface: Comprehensive, modern Light Mode settings window accessible via the ⚙️ Settings button in the left sidebar or system tray context menu:
    • Security PIN Auto-Rotation: Configurable automatic generation of a fresh host PIN after a specified time interval (Never by default, 15m, 30m, 1h, 4h, 8h, 24h). Active sessions remain uninterrupted.
    • Unattended Access Control: Toggle unattended access, configure permanent passwords, and reveal/hide password inputs with dynamic card collapsing.
    • Scrollable & Responsive Content Layout: Smooth vertical scrolling containers across Security, General, and About tabs ensuring zero card cropping regardless of screen resolution or DPI scaling.
    • Unauthorized Access & Brute-Force Protection: Automatic rate-limiting and temporary IP lockout after repeated failed PIN/password attempts, configurable thresholds, lockout durations, and live status countdown.
  • RemoteLAN WebBridge (Browser Remote Access): Control this PC directly from any web browser on your LAN (iOS Safari, Android Chrome, tablet, or secondary PC) with zero client app installations:
    • Zero-Typing QR Code Instant Access: Launch 📱 Connect Phone (QR) from the main window, system tray menu, or Settings to immediately display a high-resolution, scannable QR code in an expanded, scroll-free dialog with active adapter selection. Pointing your iPhone / Android camera at the QR code automatically opens the secure session in Safari or Chrome.
    • Embedded Kestrel Server: Runs a high-performance, lightweight HTTPS + WebSocket server embedded directly in the RemoteLAN host process (configurable port, default 8443).
    • Mobile Touch & Full-Screen Trackpad Engine with Live Pointer:
      • Direct Interactive Touchscreen Mode (Default): Intuitive direct interaction where tapping any desktop element clicks it immediately, double-tapping opens folders or apps, long-pressing (550ms) triggers right-click with haptic feedback, and two-finger pinching zooms in and out.
      • Visible Mouse Pointer: Crisp SVG arrow cursor rendered directly over the remote desktop canvas, tracking exact coordinates with instant touch position and click feedback ripples.
      • Full-Screen Trackpad Mode: Optional mode where the entire mobile display (including top and bottom letterbox areas) functions as a laptop trackpad with relative delta steering, tap-to-click, and quick thumb action buttons (Left Click, ✊ Hold Drag, Right Click).
      • Pinch-to-Zoom & Pan: Smooth two-finger pinch-to-zoom (1.0x to 4.0x) with panning and one-tap zoom reset badge.
      • Anti-Crop Visual Viewport Keyboard Adaptation: Seamlessly detects mobile software keyboards using window.visualViewport, dynamically shrinking and shifting the desktop viewport above the keyboard so inputs and taskbars are never cropped.
      • Unicode Typing & Special Keys: Direct mobile keyboard character input via Unicode injection, plus floating toolbar keys (Ctrl+Alt+Del with lock screen wake and Task Manager launch, Esc, Tab, Win, Enter, Backspace, Arrow keys).
      • Zero-Blackscreen Engine: Throttled touch events and thread-safe persistent capture buffers preventing black screens during active mobile touch interaction.
    • Modern Application-Wide Light Mode Dropdowns: Refined dropdown controls across all main, settings, and modal dialogs with rounded borders, smooth hover animations, expanded column widths, and zero text truncation.
    • Apple Safari TLS & SAN Compliance: Automatically generates and manages self-signed X.509 certificates with Subject Alternative Names (SAN) for all local IPv4 addresses and 365-day validity limits (complying strictly with Apple iOS 13+ / macOS 10.15+ TLS rules), plus one-tap /cert profile download.
    • Windows Firewall Integration: Automatically checks and configures inbound TCP firewall rules for port 8443 across all network profiles (including Public Wi-Fi) with one-click in-app elevation.
    • Unified Security & Lockout: Directly shares RemoteLAN's PinManager (PIN rotation & permanent unattended password) and SettingsManager brute-force lockout rules.
  • About Section & Developer Credentials: Built-in About view providing project details (v1.4.0, GPL-3.0 open source license, technical architecture) and developer credentials (Salman Asmat).
  • Semantic Versioning: Adheres strictly to SemVer 2.0.0 (Current version: 1.4.0).

Architecture

RemoteLAN/
├── RemoteLAN.slnx                    # Solution file
├── src/
│   ├── RemoteLAN/                    # Primary Unified AnyDesk-style Application (Host + Client Viewport + WebBridge)
│   └── RemoteLAN.Protocol/           # Shared wire protocol, framing, messages, discovery models
└── tests/
    └── RemoteLAN.Tests/              # Automated unit, discovery, security, power, input pipeline, and WebBridge test suite (125 tests)

Network Protocols

1. LAN Auto-Discovery (UDP Port 9192)

  • Probe: Broadcasts REMOTELAN_DISCOVER_V1 across active local network subnets.
  • Response: Replies with REMOTELAN_AGENT_V1|{MachineName}|{TcpPort}|{Version}|{MachineId}|{InterfaceType}|{AdapterIp}.

2. Streaming & Control (TCP Port 9191)

All authentication, desktop video frames, and remote mouse/keyboard inputs multiplex over a single TCP connection:

┌─────────────────┬───────────────────────────────┬──────────────────────────────┐
│ MessageType(1B) │ PayloadLength (4B Big-Endian) │ Payload Bytes (Length bytes) │
└─────────────────┴───────────────────────────────┴──────────────────────────────┘
Message Types
  • 0x01 — AuthRequest (PIN verification)
  • 0x02 — AuthResponse (Handshake result & remote screen resolution)
  • 0x10 — ScreenFrame (JPEG-compressed desktop frame)
  • 0x20 — MouseMove (Normalized coordinates 0.0–1.0)
  • 0x21 — MouseButton (Left, Right, Middle / Down, Up)
  • 0x22 — MouseWheel (Wheel scroll delta)
  • 0x30 — KeyboardKey (Virtual Key Code, KeyDown/KeyUp, extended flag)
  • 0x35 — SendCtrlAltDel (Remote CAD / wake sign-in screen command)
  • 0x36 — PowerAction (Remote system Lock, Sleep, Restart, Shutdown)
  • 0x37 — UnlockWithOsPassword (Windows OS lock screen auto-unlock with hardware scan code keystroke injection)

3. WebBridge Browser Access (HTTPS / WSS Port 8443)

  • HTTP GET / & /index.html: Serves the touch-first responsive HTML5/JS single-page web client.
  • HTTP GET /health: Returns JSON service health and port configuration.
  • HTTP GET /cert: Downloads self-signed TLS certificate public authority (.crt) for mobile browser trust setup.
  • WebSocket /ws: High-performance bi-directional binary frame streaming (JPEG) and JSON input control protocol (auth, mouse, scroll, key, special).

Quick Start

Prerequisites

Build

# Build entire solution in Release configuration
dotnet build RemoteLAN.slnx -c Release

Run Tests

# Execute full test suite including bidirectional and discovery tests
dotnet test tests/RemoteLAN.Tests/RemoteLAN.Tests.csproj --verbosity normal

Create Installer (Inno Setup)

To compile and package the standalone Windows installer:

# Execute automated packaging script
.\build-installer.ps1

The compiled installer is output to: dist/RemoteLAN_Setup_v1.4.0.exe

  • Fully Self-Contained (.NET 8 Runtime Included): Bundles the complete .NET 8 desktop runtime and CoreCLR libraries directly inside the installer — no separate .NET installation or download required.
  • Clean Upgrades: Automatically terminates running processes, cleans old version binaries, and preserves user credentials in %ProgramData%\RemoteLAN.
  • Post-Install Launch Option: Includes a checkbox on the final installer page to launch RemoteLAN immediately into the foreground (unchecked by default).
  • Automatic Background Startup: Configures an elevated Windows Scheduled Task (RemoteLAN_Autostart with /RL HIGHEST at logon) synchronized with the Windows Run registry key (--background), allowing silent, unattended startup on boot without UAC prompts even when running on battery.
  • Single-Instance Management: Prevents duplicate processes; manual launch signals and brings the active background instance to the foreground.
  • System Tray Integration: Closing the window hides to the notification tray; right-click tray icon to open or exit.
  • Connection Alert: Main window automatically reveals itself upon incoming remote connection.

Launching RemoteLAN (Works on Any PC)

Run the unified app on both PC A and PC B:

dotnet run --project src/RemoteLAN/RemoteLAN.csproj

How it Works:

  1. On PC A:
    • The left sidebar displays PC A's IP address, an alphanumeric session access code (e.g. 7K2M9X), and a Settings button for unattended access and security configuration.
  2. On PC B:
    • The left sidebar displays PC B's IP address and its own access credentials.
  3. To connect PC A → PC B:
    • On PC A, PC B automatically appears as a square device tile in the discovered devices grid.
    • Click PC B's tile (or enter PC B's IP in the top header and click Connect ➔).
    • RemoteLAN automatically tests reachability. If reachable, it presents the authentication modal with a "Remember password for this device" toggle (or connects instantly if already remembered).
    • Enter PC B's session access code or permanent unattended password and click Connect ➔.
    • A dedicated remote desktop session window opens with full mouse and keyboard control!
  4. To connect PC B → PC A:
    • Exact same process in reverse!

Security

RemoteLAN adheres to strict security standards including constant-time authentication verification (CryptographicOperations.FixedTimeEquals), automated brute-force IP lockouts, command-injection prevention, and isolated memory pipelines for input synthesis and credentials. For complete details, audit findings, supported versions, and vulnerability reporting procedures, see SECURITY.md.

Releases

Packages

Contributors

Languages