Skip to content

Instantly share code, notes, and snippets.

@nullx5
Created December 1, 2023 06:12
Show Gist options
  • Save nullx5/7360ff7ea36dcb3262a9689d1303a97e to your computer and use it in GitHub Desktop.
Save nullx5/7360ff7ea36dcb3262a9689d1303a97e to your computer and use it in GitHub Desktop.

Servidor VNC:

    sudo apt install x11vnc
    sudo ufw allow 5900
    sudo ufw status numbered

    sudo nvim /lib/systemd/system/x11vnc.service
        [Unit]
        Description=x11vnc service
        After=display-manager.service network.target syslog.target

        [Service]
        Type=simple
        ExecStart=/usr/bin/x11vnc
        ExecStop=/usr/bin/killall x11vnc
        Restart=on-failure

        [Install]
        WantedBy=multi-user.target

    sudo systemctl daemon-reload
    sudo systemctl enable x11vnc.service
    sudo systemctl start x11vnc.service
    sudo systemctl status x11vnc.service

Cliente VNC:

    sudo apt install krdc -y
    vnc 192.168.100.112
        vnc://192.168.100.112
@nullx5
Copy link
Author

nullx5 commented Feb 6, 2025

Instalar tightvnc desde powershell

Definir variables

$TightVNC_URL = "https://www.tightvnc.com/download/2.8.81/tightvnc-2.8.81-gpl-setup-64bit.msi"
$InstallerPath = "$env:TEMP\tightvnc.msi"
$InstallDir = "C:\Program Files\TightVNC"
$RegPath = "HKLM:\SOFTWARE\TightVNC\Server"

Definir contraseñas (cambiar según necesidad)

$Password = "admin123" # Cambia esta contraseña
$ViewOnlyPassword = "view123" # Cambia esta contraseña

Descargar TightVNC

Write-Host "Descargando TightVNC..."
Invoke-WebRequest -Uri $TightVNC_URL -OutFile $InstallerPath

Instalar TightVNC en modo silencioso sin ventanas

Write-Host "Instalando TightVNC en modo oculto..."
Start-Process "msiexec.exe" -ArgumentList "/i "$InstallerPath" /quiet /norestart ADDLOCAL=Server" -NoNewWindow -WindowStyle Hidden -Wait

Configurar contraseñas en el registro

Write-Host "Configurando contraseñas..."
New-Item -Path $RegPath -Force | Out-Null

Crear valores encriptados para las contraseñas (en formato TightVNC)

$PasswordBytes = [System.Text.Encoding]::ASCII.GetBytes($Password)
$PasswordEncrypted = [byte[]]::new(8) + $PasswordBytes
Set-ItemProperty -Path $RegPath -Name "Password" -Value $PasswordEncrypted -Type Binary

$ViewPasswordBytes = [System.Text.Encoding]::ASCII.GetBytes($ViewOnlyPassword)
$ViewPasswordEncrypted = [byte[]]::new(8) + $ViewPasswordBytes
Set-ItemProperty -Path $RegPath -Name "PasswordViewOnly" -Value $ViewPasswordEncrypted -Type Binary

Instalar TightVNC como servicio en modo oculto

Write-Host "Instalando TightVNC como servicio..."
Start-Process "$InstallDir\tvnserver.exe" -ArgumentList "-install" -NoNewWindow -WindowStyle Hidden -Wait

Iniciar el servicio de TightVNC en segundo plano

Write-Host "Iniciando TightVNC en modo oculto..."
Start-Process "$InstallDir\tvnserver.exe" -ArgumentList "-start" -NoNewWindow -WindowStyle Hidden

Write-Host "TightVNC instalado y corriendo como servicio en modo oculto."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment