Skip to content

Commit 20e937a

Browse files
committed
Add project files.
1 parent 38ebf7c commit 20e937a

16 files changed

+125
-0
lines changed

InsecurePowerShellHost.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2010
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InsecurePowerShellHost", "InsecurePowerShellHost\InsecurePowerShellHost.csproj", "{02C46B23-F2A7-4A64-B96F-92C86B31CBD6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{02C46B23-F2A7-4A64-B96F-92C86B31CBD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{02C46B23-F2A7-4A64-B96F-92C86B31CBD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{02C46B23-F2A7-4A64-B96F-92C86B31CBD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{02C46B23-F2A7-4A64-B96F-92C86B31CBD6}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {41F8445F-5F33-492B-B5E2-35B21C960843}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Management.Automation;
3+
4+
public class InsecurePowerShellHost
5+
{
6+
public static int Main(string[] args)
7+
{
8+
using (PowerShell ps = PowerShell.Create())
9+
{
10+
if (args.Length == 2)
11+
{
12+
String command = "";
13+
if (args[0].ToLower() == "-e" || args[0].ToLower() == "--enc" || args[0].ToLower() == "--encodedcommand")
14+
{
15+
byte[] commandBytes = Convert.FromBase64String(args[1]);
16+
command = System.Text.Encoding.UTF8.GetString(commandBytes);
17+
}
18+
else if (args[0].ToLower() == "-c" || args[0].ToLower() == "--com" || args[0].ToLower() == "--command")
19+
{
20+
command = args[1];
21+
}
22+
else
23+
{
24+
Console.Error.WriteLine("usage: InsecurePowerShellHost.exe [--EncodedCommand encoded_command | --Command command]");
25+
}
26+
var results = ps.AddScript(command + " | Out-String").Invoke();
27+
Console.WriteLine(results[0].ToString());
28+
ps.Commands.Clear();
29+
}
30+
else
31+
{
32+
Console.Error.WriteLine("usage: InsecurePowerShellHost.exe [--EncodedCommand encoded_command | --Command command]");
33+
}
34+
}
35+
36+
return 0;
37+
}
38+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
10+
<SpecificVersion>False</SpecificVersion>
11+
<HintPath>.\Newtonsoft.Json.dll</HintPath>
12+
</Reference>
13+
<Reference Include="System.Text.Encoding.CodePages, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
14+
<SpecificVersion>False</SpecificVersion>
15+
<HintPath>.\System.Text.Encoding.CodePages.dll</HintPath>
16+
</Reference>
17+
<Reference Include="System.Text.Encoding, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
18+
<SpecificVersion>False</SpecificVersion>
19+
<HintPath>.\System.Text.Encoding.dll</HintPath>
20+
</Reference>
21+
<Reference Include="Microsoft.WSMan.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
22+
<SpecificVersion>False</SpecificVersion>
23+
<HintPath>.\Microsoft.WSMan.Runtime.dll</HintPath>
24+
</Reference>
25+
<Reference Include="Microsoft.WSMan.Management, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
26+
<SpecificVersion>False</SpecificVersion>
27+
<HintPath>.\Microsoft.WSMan.Management.dll</HintPath>
28+
</Reference>
29+
<Reference Include="Microsoft.PowerShell.Security, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
30+
<SpecificVersion>False</SpecificVersion>
31+
<HintPath>.\Microsoft.PowerShell.Security.dll</HintPath>
32+
</Reference>
33+
<Reference Include="Microsoft.PowerShell.ConsoleHost, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
34+
<SpecificVersion>False</SpecificVersion>
35+
<HintPath>.\Microsoft.PowerShell.ConsoleHost.dll</HintPath>
36+
</Reference>
37+
<Reference Include="Microsoft.PowerShell.Commands.Diagnostics, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
38+
<SpecificVersion>False</SpecificVersion>
39+
<HintPath>.\Microsoft.PowerShell.Commands.Diagnostics.dll</HintPath>
40+
</Reference>
41+
<Reference Include="Microsoft.PowerShell.Commands.Utility, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
42+
<SpecificVersion>False</SpecificVersion>
43+
<HintPath>.\Microsoft.PowerShell.Commands.Utility.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Microsoft.PowerShell.Commands.Management, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
46+
<SpecificVersion>False</SpecificVersion>
47+
<HintPath>.\Microsoft.PowerShell.Commands.Management.dll</HintPath>
48+
</Reference>
49+
<Reference Include="Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
50+
<SpecificVersion>False</SpecificVersion>
51+
<HintPath>.\Microsoft.Management.Infrastructure.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Microsoft.PowerShell.CoreCLR.Eventing, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
54+
<SpecificVersion>False</SpecificVersion>
55+
<HintPath>.\Microsoft.PowerShell.CoreCLR.Eventing.dll</HintPath>
56+
</Reference>
57+
<Reference Include="System.Management.Automation, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
58+
<SpecificVersion>False</SpecificVersion>
59+
<HintPath>.\System.Management.Automation.dll</HintPath>
60+
</Reference>
61+
</ItemGroup>
62+
</Project>
128 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
163 KB
Binary file not shown.
Binary file not shown.
87 KB
Binary file not shown.

0 commit comments

Comments
 (0)