I need help with a simple test case of executing a CLI command through PowerShell which has already been encoded in Base64.
Suppose Get-ChildItem has been converted in advance to Base64 string R2V0LUNoaWxkSXRlbQ==.
Further suppose I have a DOS CLI instance open, and I want to test executing this string in powershell:
C:>\ powershell.exe -enc R2V0LUNoaWxkSXRlbQ==
Run Code Online (Sandbox Code Playgroud)
However, I receive the following error:
The term '???????' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:8
*??????? <<<<
+ CategoryInfo :ObjectNotFound: (???????:String) [], CommandNotFoundException
+ FullyQualifiedErrorID: CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
我知道有一种方法可以引入变量的使用,甚至包括编码过程本身。但我想知道的是,这种方法可以挽救吗?我可能做错了什么?我在 Win7 中运行 PS 2.0 版。
如果必须对其进行编码,请使用以下命令获取 Base64 字符串:
[Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes('Get-ChildItem'))
Run Code Online (Sandbox Code Playgroud)
尝试这对我有用:
powershell.exe -encodedCommand RwBlAHQALQBDAGgAaQBsAGQASQB0AGUAbQA=
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10056 次 |
| 最近记录: |