go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/resources/powershell/encode_test.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package powershell_test
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/stretchr/testify/assert"
    10  	"go.mondoo.com/cnquery/providers/os/resources/powershell"
    11  )
    12  
    13  func TestPowershellEncoding(t *testing.T) {
    14  	expected := "powershell.exe -NoProfile -EncodedCommand JABQAHIAbwBnAHIAZQBzAHMAUAByAGUAZgBlAHIAZQBuAGMAZQA9ACcAUwBpAGwAZQBuAHQAbAB5AEMAbwBuAHQAaQBuAHUAZQAnADsAZABpAHIAIAAiAGMAOgBcAHAAcgBvAGcAcgBhAG0AIABmAGkAbABlAHMAIgAgAA=="
    15  	cmd := string("dir \"c:\\program files\" ")
    16  	assert.Equal(t, expected, powershell.Encode(cmd))
    17  }