Skip to content

Instantly share code, notes, and snippets.

@Winand
Last active September 29, 2023 12:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Winand/414eab7a401d56046ce5e4d54e03dee7 to your computer and use it in GitHub Desktop.
Start cloak client from PowerShell script
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
# $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
# Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Start powershell.exe -Verb RunAs -ArgumentList "cd $pwd; & $($MyInvocation.MyCommand.Path)"
Exit
}
}
route ADD 198.__.___.___ MASK 255.255.255.255 192.168.88.1
try {
.\ck-client-windows-amd64-v2.7.0.exe -u -s 198.__.___.___ -p 443
} finally {
route DELETE 198.__.___.___ MASK 255.255.255.255 192.168.88.1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment