Skip to content

Commit 2b15303

Browse files
committed
BlackHat release
BlackHat release
1 parent 7475d88 commit 2b15303

38 files changed

+4534
-1
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.vs
2+
*.user
3+
[Dd]ebug/
4+
[Rr]elease/
5+
[Bb]in/
6+
[Oo]bj/
7+
.DS_Store
8+
Packages/

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
8+
## [1.0.0] - 2021-08-4
9+
10+
* Initial release

Certify.sln

+25
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 Version 16
4+
VisualStudioVersion = 16.0.29009.5
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Certify", "Certify\Certify.csproj", "{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}"
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+
{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}.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 = {07B108A3-1131-4969-9E7A-B7FD5682E61B}
24+
EndGlobalSection
25+
EndGlobal

Certify/ArgumentParser.cs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections.Generic;
2+
3+
namespace Certify
4+
{
5+
public static class ArgumentParser
6+
{
7+
public static ArgumentParserResult Parse(IEnumerable<string> args)
8+
{
9+
var arguments = new Dictionary<string, string>();
10+
11+
foreach (var argument in args)
12+
{
13+
var idx = argument.IndexOf(':');
14+
if (idx > 0)
15+
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
16+
else
17+
arguments[argument] = string.Empty;
18+
}
19+
20+
return ArgumentParserResult.Success(arguments);
21+
}
22+
}
23+
}

Certify/ArgumentParserResult.cs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections.Generic;
2+
3+
namespace Certify
4+
{
5+
public class ArgumentParserResult
6+
{
7+
public bool ParsedOk { get; }
8+
public Dictionary<string, string> Arguments { get; }
9+
10+
private ArgumentParserResult(bool parsedOk, Dictionary<string, string> arguments)
11+
{
12+
ParsedOk = parsedOk;
13+
Arguments = arguments;
14+
}
15+
16+
public static ArgumentParserResult Success(Dictionary<string, string> arguments)
17+
=> new ArgumentParserResult(true, arguments);
18+
19+
public static ArgumentParserResult Failure()
20+
=> new ArgumentParserResult(false, new Dictionary<string, string>());
21+
22+
}
23+
}

Certify/Certify.csproj

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" />
4+
<Import Project="..\packages\ILMerge.3.0.41\build\ILMerge.props" Condition="Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" />
5+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
6+
<PropertyGroup>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9+
<ProjectGuid>{64524CA5-E4D0-41B3-ACC3-3BDBEFD40C97}</ProjectGuid>
10+
<OutputType>Exe</OutputType>
11+
<RootNamespace>Certify</RootNamespace>
12+
<AssemblyName>Certify</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<Deterministic>true</Deterministic>
16+
<TargetFrameworkProfile />
17+
<NuGetPackageImportStamp>
18+
</NuGetPackageImportStamp>
19+
<PublishUrl>publish\</PublishUrl>
20+
<Install>true</Install>
21+
<InstallFrom>Disk</InstallFrom>
22+
<UpdateEnabled>false</UpdateEnabled>
23+
<UpdateMode>Foreground</UpdateMode>
24+
<UpdateInterval>7</UpdateInterval>
25+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
26+
<UpdatePeriodically>false</UpdatePeriodically>
27+
<UpdateRequired>false</UpdateRequired>
28+
<MapFileExtensions>true</MapFileExtensions>
29+
<ApplicationRevision>0</ApplicationRevision>
30+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
31+
<IsWebBootstrapper>false</IsWebBootstrapper>
32+
<UseApplicationTrust>false</UseApplicationTrust>
33+
<BootstrapperEnabled>true</BootstrapperEnabled>
34+
<LangVersion>9.0</LangVersion>
35+
<Nullable>enable</Nullable>
36+
</PropertyGroup>
37+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
38+
<PlatformTarget>AnyCPU</PlatformTarget>
39+
<DebugSymbols>true</DebugSymbols>
40+
<DebugType>full</DebugType>
41+
<Optimize>false</Optimize>
42+
<OutputPath>bin\Debug\</OutputPath>
43+
<DefineConstants>DEBUG;TRACE</DefineConstants>
44+
<ErrorReport>prompt</ErrorReport>
45+
<WarningLevel>4</WarningLevel>
46+
<LangVersion>9.0</LangVersion>
47+
<Nullable>enable</Nullable>
48+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
49+
</PropertyGroup>
50+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
51+
<PlatformTarget>AnyCPU</PlatformTarget>
52+
<DebugType>none</DebugType>
53+
<Optimize>true</Optimize>
54+
<OutputPath>bin\Release\</OutputPath>
55+
<DefineConstants>TRACE</DefineConstants>
56+
<ErrorReport>prompt</ErrorReport>
57+
<WarningLevel>0</WarningLevel>
58+
<LangVersion>9.0</LangVersion>
59+
<Nullable>enable</Nullable>
60+
</PropertyGroup>
61+
<ItemGroup>
62+
<Reference Include="System" />
63+
<Reference Include="System.Core" />
64+
<Reference Include="System.DirectoryServices" />
65+
<Reference Include="System.DirectoryServices.AccountManagement" />
66+
<Reference Include="System.Web.Extensions" />
67+
<Reference Include="System.Xml.Linq" />
68+
<Reference Include="System.Data.DataSetExtensions" />
69+
<Reference Include="System.Data" />
70+
<Reference Include="System.Xml" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<Compile Include="Commands\CAs.cs" />
74+
<Compile Include="Commands\Download.cs" />
75+
<Compile Include="Commands\Find.cs" />
76+
<Compile Include="Commands\ICommand.cs" />
77+
<Compile Include="Commands\PKIObjects.cs" />
78+
<Compile Include="Commands\Request.cs" />
79+
<Compile Include="Domain\ADObject.cs" />
80+
<Compile Include="ArgumentParser.cs" />
81+
<Compile Include="ArgumentParserResult.cs" />
82+
<Compile Include="Domain\CertificateAuthorityWebServices.cs" />
83+
<Compile Include="Domain\CommonOids.cs" />
84+
<Compile Include="Domain\CertificateTemplate.cs" />
85+
<Compile Include="Domain\CertificateAuthority.cs" />
86+
<Compile Include="CommandCollection.cs" />
87+
<Compile Include="Domain\EnrollmentAgentRestriction.cs" />
88+
<Compile Include="Domain\EnterpriseCertificateAuthority.cs" />
89+
<Compile Include="Domain\PKIObject.cs" />
90+
<Compile Include="Info.cs" />
91+
<Compile Include="Lib\HttpUtil.cs" />
92+
<Compile Include="Lib\LdapSearchOptions.cs" />
93+
<Compile Include="Version.cs" />
94+
<Compile Include="Lib\Cert.cs" />
95+
<Compile Include="Lib\DisplayUtil.cs" />
96+
<Compile Include="Lib\Elevator.cs" />
97+
<Compile Include="Lib\Interop.cs" />
98+
<Compile Include="Lib\LdapOperations.cs" />
99+
<Compile Include="Program.cs" />
100+
<Compile Include="Properties\AssemblyInfo.cs" />
101+
</ItemGroup>
102+
<ItemGroup>
103+
<COMReference Include="CERTCLILib">
104+
<Guid>{372FCE32-4324-11D0-8810-00A0C903B83C}</Guid>
105+
<VersionMajor>1</VersionMajor>
106+
<VersionMinor>0</VersionMinor>
107+
<Lcid>0</Lcid>
108+
<WrapperTool>tlbimp</WrapperTool>
109+
<Isolated>False</Isolated>
110+
<EmbedInteropTypes>False</EmbedInteropTypes>
111+
</COMReference>
112+
<COMReference Include="CERTENROLLLib">
113+
<Guid>{728AB348-217D-11DA-B2A4-000E7BBB2B09}</Guid>
114+
<VersionMajor>1</VersionMajor>
115+
<VersionMinor>0</VersionMinor>
116+
<Lcid>0</Lcid>
117+
<WrapperTool>tlbimp</WrapperTool>
118+
<Isolated>False</Isolated>
119+
<EmbedInteropTypes>False</EmbedInteropTypes>
120+
</COMReference>
121+
</ItemGroup>
122+
<ItemGroup>
123+
<None Include="app.config" />
124+
<None Include="ILMerge.props" />
125+
<None Include="packages.config" />
126+
</ItemGroup>
127+
<ItemGroup>
128+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
129+
<Visible>False</Visible>
130+
<ProductName>.NET Framework 3.5 SP1</ProductName>
131+
<Install>false</Install>
132+
</BootstrapperPackage>
133+
</ItemGroup>
134+
<ItemGroup>
135+
<Content Include="ILMergeOrder.txt" />
136+
</ItemGroup>
137+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
138+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
139+
<PropertyGroup>
140+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
141+
</PropertyGroup>
142+
<Error Condition="!Exists('..\packages\ILMerge.3.0.41\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILMerge.3.0.41\build\ILMerge.props'))" />
143+
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.props'))" />
144+
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets'))" />
145+
</Target>
146+
<Import Project="..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.1.3\build\MSBuild.ILMerge.Task.targets')" />
147+
</Project>

Certify/CommandCollection.cs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Certify.Commands;
4+
5+
namespace Certify
6+
{
7+
public class CommandCollection
8+
{
9+
private readonly Dictionary<string, Func<ICommand>> _availableCommands = new Dictionary<string, Func<ICommand>>();
10+
11+
// How To Add A New Command:
12+
// 1. Create your command class in the Commands Folder
13+
// a. That class must have a CommandName static property that has the Command's name
14+
// and must also Implement the ICommand interface
15+
// b. Put the code that does the work into the Execute() method
16+
// 2. Add an entry to the _availableCommands dictionary in the Constructor below.
17+
18+
public CommandCollection()
19+
{
20+
_availableCommands.Add(CAs.CommandName, () => new CAs());
21+
_availableCommands.Add(Request.CommandName, () => new Request());
22+
_availableCommands.Add(Download.CommandName, () => new Download());
23+
_availableCommands.Add(Find.CommandName, () => new Find());
24+
_availableCommands.Add(PKIObjects.CommandName, () => new PKIObjects());
25+
}
26+
27+
public bool ExecuteCommand(string commandName, Dictionary<string, string> arguments)
28+
{
29+
bool commandWasFound;
30+
31+
if (string.IsNullOrEmpty(commandName) || _availableCommands.ContainsKey(commandName) == false)
32+
commandWasFound= false;
33+
else
34+
{
35+
// Create the command object
36+
var command = _availableCommands[commandName].Invoke();
37+
38+
// and execute it with the arguments from the command line
39+
command.Execute(arguments);
40+
41+
commandWasFound = true;
42+
}
43+
44+
return commandWasFound;
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)