Add a separate script for injecting values into scripts
This commit is contained in:
parent
90675f3e14
commit
be4ee90f7d
|
@ -1,5 +1,8 @@
|
|||
#!/bin/pwsh
|
||||
. "$PSScriptRoot/../Scripts/Scripting.ps1";
|
||||
|
||||
function Start-Setup {
|
||||
. "$PSScriptRoot/../Scripts/Scripting.ps1";
|
||||
$Global:InformationPreference = "Continue";
|
||||
$Global:ErrorActionPreference = "Inquire";
|
||||
$null = $env:WIN_COMPUTER_NAME;
|
||||
|
@ -53,14 +56,8 @@ function Start-Setup {
|
|||
Join-Path $env:REMOTE_PROJECT_PATH $relativePath;
|
||||
}
|
||||
|
||||
function Get-Injection($value) {
|
||||
"([System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String('$(
|
||||
[System.Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes($value))
|
||||
)')))"
|
||||
}
|
||||
|
||||
function Get-PathInjection($path) {
|
||||
"(Join-Path `$env:SystemDrive $(Get-Injection $path))"
|
||||
"(Join-Path `$env:SystemDrive $(ConvertTo-Injection $path))"
|
||||
}
|
||||
|
||||
function Get-ScriptPathInjection($path) {
|
||||
|
|
16
scripts/Windows/Scripts/Scripting.ps1
Normal file
16
scripts/Windows/Scripts/Scripting.ps1
Normal file
|
@ -0,0 +1,16 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Converts the specified value into a form to safle inject it into a script.
|
||||
|
||||
.PARAMETER value
|
||||
The value to convert for injection.
|
||||
#>
|
||||
function ConvertTo-Injection {
|
||||
param(
|
||||
$Value
|
||||
)
|
||||
|
||||
"([System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String('$(
|
||||
[System.Convert]::ToBase64String([System.Text.Encoding]::Default.GetBytes($value))
|
||||
)')))"
|
||||
}
|
Loading…
Reference in a new issue