Remote Desktop Coded in PowerShell
github.com
github.com
Last I checked the reverse VNC shellcode was literally part of the Metasploit suite, so not really any easier there either.
No idea about low level details, but it does perform much better than X Windows ever did.
But if you have xrdp[0] server on any Linux device, the client might be useful to connect to it. But the client must be Windows in this scenario too.
[0] http://xrdp.org/
``` function Get-ResolutionScaleFactor { <# .SYNOPSIS Return the scale factor of target screen to capture. #>
$hdc = [W.User32]::GetDC(0)
try
{
return [W.GDI32]::GetDeviceCaps($hdc, 117) / [W.GDI32]::GetDeviceCaps($hdc, 10)
}
finally
{
[W.User32]::ReleaseDC(0, $hdc) | Out-Null
}
}
```
https://github.com/DarkCoderSc/PowerRemoteDesktop/blob/main/...It is possible to a cross platform or at least a Linux version, but it's not this one.
``` $primaryDesktop = [System.Windows.Forms.Screen]::PrimaryScreen
$size = New-Object System.Drawing.Size(
($primaryDesktop.Bounds.Size.Width * $ScaleFactor),
($primaryDesktop.Bounds.Size.Height * $ScaleFactor)
)
$location = New-Object System.Drawing.Point(
($primaryDesktop.Bounds.Location.X * $ScaleFactor),
($primaryDesktop.Bounds.Location.Y * $ScaleFactor)
)
$bitmap = New-Object System.Drawing.Bitmap($size.Width, $size.Height)
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen($location, [System.Drawing.Point]::Empty, $size)
return $bitmap
```
https://github.com/DarkCoderSc/PowerRemoteDesktop/blob/main/...