You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used Nuget to download and use the official Microsoft.PowerShell.SDK (7.1.0) and System.Management.Automation (7.1.0).
The purpose is to convert a piece of obfuscated code to origianl string. However, this code will truncate part of the execution results.
But when I use PowerShell7 and PowerShell5 to call the invoke method in powershell environment$PowerShell = [powershell]::Create();[void]$PowerShell.AddScript(......);$PowerShell.Invoke(), I can get the correct results. I suspect there are bugs in the officially provided SDK and Autoumation packages for C#.
using System;
using System.Collections.ObjectModel;
using System.Management.Automation;
namespace ClassLibrary2
{
public class Class1
{
static void Main(string[] args)
{
PowerShell psInstance = PowerShell.Create();
string script = "(NeW-oBjeCt MAnaGEment.AUtOmATiOn.pScReDeNtiAL ' ', ( '76492d1116743f0423413b16050a5345MgB8AHIAdgA3AFYATgBoAFMAUwBzAEMATgBRAFEAUgB2AGcASwA2AE4AagBlAEEAPQA9AHwANwBjADAAMgBkADcAYwAyADQANgA5ADUANwBlAGMANwBiAGEANQAwADMANwAzAGMAOQBlADkANwBjAGQAMQBlAGUAZAA3AGIAMQBjADQAYwBhAGMAMQAzADYANgBjADQAYwBjADkAOABmAGUAMABhADgANQBmADAANwBkADQAYQBjAGMAZgBjAGIAMAAyAGUANgBkADQAZAAyAGEAMgBiADkAYwA4ADAAZQA4AGUAYwAwAGMAYwBiAGUAZQA3ADgAZABmADYAYgAwADUAMAA0ADIAYgBjAGYANwA1ADcANwA5ADgAYgAwADAAZgA1ADUAMQAyADMANgBlAGYAOABjADkANwA0ADgANgAzADkANAA5ADQAOQBkAGMAMgAwADcANQA1AGMAMQAwADUANgA2ADEANgBlADYANQA2AGMAMQA='| CoNvertTO-SEcuREStrInG -KEY (216..185))).getNEtWorkCrEdEntIAL().PAsSWord";
psInstance.AddScript(script);
Collection<PSObject> psOutput;
psOutput = psInstance.Invoke();
}
}
}
Expected behavior
hello123456789hi123456789go123456789
Actual behavior
hello123456789hi123456789go12345
Error details
No response
Environment data
Microsoft Windows 10.0.19045
C#
.Net Core 7.0
PowerShell5
Name Value
---------
PSVersion 5.1.19041.4291
PSEdition Desktop
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
BuildVersion 10.0.19041.4291
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PowerShell7
Name Value
---------
PSVersion 7.5.0-preview.2
PSEdition Core
GitCommitId 7.5.0-preview.2
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
The text was updated successfully, but these errors were encountered:
Prerequisites
Steps to reproduce
I used Nuget to download and use the official Microsoft.PowerShell.SDK (7.1.0) and System.Management.Automation (7.1.0).
The purpose is to convert a piece of obfuscated code to origianl string. However, this code will truncate part of the execution results.
But when I use PowerShell7 and PowerShell5 to call the invoke method in powershell environment
$PowerShell = [powershell]::Create();[void]$PowerShell.AddScript(......);$PowerShell.Invoke()
, I can get the correct results. I suspect there are bugs in the officially provided SDK and Autoumation packages for C#.Expected behavior
hello123456789hi123456789go123456789
Actual behavior
hello123456789hi123456789go12345
Error details
No response
Environment data
Visuals
No response
The text was updated successfully, but these errors were encountered: