WINDOWS TOKEN RDP #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WINDOWS TOKEN RDP | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| increment: | |
| type: string | |
| description: 'ngrok token' | |
| required: false | |
| default: '' | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| timeout-minutes: 9999 | |
| steps: | |
| - name: π½ Download Files | |
| run: | | |
| Invoke-WebRequest https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-windows-amd64.zip -OutFile ngrok.zip | |
| Invoke-WebRequest https://raw.githubusercontent.com/Riders004/rdp/master/start.bat -OutFile start.bat | |
| Invoke-WebRequest https://raw.githubusercontent.com/Riders004/rdp/master/wallpaper.bat -OutFile wallpaper.bat | |
| Invoke-WebRequest https://raw.githubusercontent.com/Vip3rLi0n/Ngrok-RDPs/main/resources/loop.ps1 -OutFile loop.ps1 | |
| - name: π¦ Extract Ngrok | |
| run: Expand-Archive ngrok.zip | |
| - name: π Set Ngrok Authtoken | |
| shell: pwsh | |
| run: | | |
| $inputToken = '${{ github.event.inputs.increment }}' | |
| $envToken = $Env:NGROK_AUTH | |
| $defaultToken = '316WRV55lXVjwT4mXHuMYskqxiu_4bMAdBptaGPiZMBiZz82s' | |
| if ($inputToken) { | |
| $token = $inputToken | |
| } elseif ($envToken) { | |
| $token = $envToken | |
| } else { | |
| $token = $defaultToken | |
| } | |
| #Write-Host "Using ngrok token: $($token.Substring(0,[Math]::Min(6,$token.Length)))***" | |
| .\ngrok\ngrok.exe config add-authtoken $token | |
| env: | |
| NGROK_AUTH: ${{ secrets.TAKEN }} | |
| - name: π§ Enable RDP & Configure Firewall | |
| run: | | |
| Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0 | |
| Enable-NetFirewallRule -DisplayGroup "Remote Desktop" | |
| Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name "UserAuthentication" -Value 1 | |
| Copy-Item wallpaper.bat D:\a\wallpaper.bat | |
| - name: π Start Ngrok Tunnel (Hidden Window) | |
| run: Start-Process -WindowStyle Hidden PowerShell -ArgumentList './ngrok/ngrok.exe tcp --region ap 3389' | |
| - name: π Verify Ngrok process is running | |
| shell: pwsh | |
| run: | | |
| $proc = Get-Process -Name ngrok -ErrorAction SilentlyContinue | |
| if ($proc) { | |
| Write-Host "β Ngrok process is running (PID: $($proc.Id))" | |
| } else { | |
| Write-Host "β Ngrok process NOT found!" | |
| exit 1 | |
| } | |
| - name: π Wait for Ngrok to Initialize | |
| shell: pwsh | |
| run: Start-Sleep -Seconds 10 | |
| - name: βοΈ Run Setup Script (start.bat) with NGROK URL + credentials | |
| shell: pwsh | |
| run: | | |
| $retries = 10 | |
| $url = $null | |
| while ($retries -gt 0 -and -not $url) { | |
| try { | |
| $tunnels = Invoke-RestMethod -Uri 'http://localhost:4040/api/tunnels' -ErrorAction Stop | |
| if ($tunnels.tunnels.Count -gt 0) { | |
| $url = $tunnels.tunnels[0].public_url | |
| } | |
| } catch {} | |
| if (-not $url) { Start-Sleep -Seconds 3 } | |
| $retries-- | |
| } | |
| if (-not $url) { | |
| Write-Host "β Could not fetch Ngrok URL. Check ngrok process and authtoken." | |
| exit 1 | |
| } | |
| Write-Host "β Ngrok Public URL: $url" | |
| $escapedUrl = $url.Replace('"', '\"') | |
| $escapedUser = 'administrator'.Replace('"','\"') | |
| $escapedPass = 'OLDUSER#06'.Replace('"','\"') | |
| $cmd = "start.bat `"$escapedUrl`" `"$escapedUser`" `"$escapedPass`"" | |
| #Write-Host "Running: $cmd" | |
| cmd.exe /c $cmd | |
| - name: π Debug Ngrok API response raw | |
| shell: pwsh | |
| run: curl.exe -s http://localhost:4040/api/tunnels | Write-Host | |
| - name: π Keep Runner Alive | |
| shell: pwsh | |
| run: pwsh -ExecutionPolicy Bypass -File .\loop.ps1 |