PowerShell Pro Obfuscator na PowerShell Gallery

Natywny moduł dla PowerShell Pro Obfuscator, opublikowany na PowerShell Gallery, umożliwiający wykorzystanie obfuscatora bezpośrednio w kodzie PowerShell.

https://www.powershellgallery.com/packages/PowerShellProObfuscator/1.0.0

Obfuskacja PowerShell z PowerShell

###############################################################################
#
# PowerShell Pro Obfuscator WebApi interface usage example.
#
# In this example we will obfuscate sample source with custom options.
#
# Version        : v1.0.0
# Language       : PowerShell
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

# install once:
# Install-Module -Name PowerShellProObfuscator -Scope CurrentUser

Import-Module PowerShellProObfuscator

#
# source code in PowerShell format
#
$scriptSourceCode = @'
function Get-Greeting {
    param([string]$Name)
    Write-Host "Hello World from $Name!"
}
Get-Greeting "PowerShell Pro Obfuscator"
'@

#
# select obfuscation strategies explicitly (only listed switches are enabled)
#
try
{
    $output = Invoke-PowerShellProObfuscate `
        -Source $scriptSourceCode `
        -ActivationCode 'ABCD-ABCD-ABCD-ABCD' `
        -EnableCompression:$false `
        -SelfDefending `
        -ProtectionLinker `
        -RenameVariables `
        -RenameParameters `
        -RenameFunctions `
        -ShuffleFunctions `
        -ControlFlowFlatten `
        -StateMachine `
        -VmStrategy `
        -EncryptIntegers `
        -SplitStrings `
        -EncryptStrings `
        -IntegersToArrays `
        -FloatsToArrays `
        -InsertDeadCode `
        -ComplexifyBooleans `
        -IntegersToFloating `
        -EncryptFloating `
        -DecoyFunctions `
        -DetectDebugger `
        -FakeDotSourceMarkers `
        -OpaqueBranches `
        -ScriptblockDecoys `
        -LiteralPadding `
        -ReflectInvokeCommands `
        -StringCharArrayVault `
        -TryFinallyNoise `
        -AffineIntegerMask `
        -EventStub `
        -RemoveComments

    Write-Host $output
}
catch
{
    throw "An error occurred while trying to obfuscate the code: $_"
}

Dodaj komentarz