forked from rgl/frp-github-actions-reverse-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-frpc.ps1
executable file
·33 lines (30 loc) · 1.12 KB
/
run-frpc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
trap {
Write-Output "ERROR: $_"
Write-Output (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$','ERROR: $1')
Exit 1
}
# when running in CI override the frpc tls files.
if (Test-Path env:FRPC_TLS_CA_CERTIFICATE) {
Write-Output 'Configuring certificates...'
mkdir -Force ca | Out-Null
Set-Content -Encoding Ascii ca/github-key.pem $env:FRPC_TLS_KEY
Set-Content -Encoding Ascii ca/github.pem $env:FRPC_TLS_CERTIFICATE
Set-Content -Encoding Ascii ca/ca.pem $env:FRPC_TLS_CA_CERTIFICATE
}
# set password when requested.
if (Test-Path env:RUNNER_PASSWORD) {
Write-Output "Setting the $env:USERNAME user password..."
Get-LocalUser $env:USERNAME `
| Set-LocalUser `
-Password (
ConvertTo-SecureString `
-AsPlainText `
-Force `
$env:RUNNER_PASSWORD
)
}
Write-Output 'Running frpc...'
./frp/frpc -c frpc-windows.ini 2>&1 | Select-Object {$_ -replace '[0-9\.]+:6969','***:6969'}; cmd /c exit 0