diff --git a/EmpireCompiler/Core/Common.cs b/EmpireCompiler/Core/Common.cs index f59f283..0f24c10 100644 --- a/EmpireCompiler/Core/Common.cs +++ b/EmpireCompiler/Core/Common.cs @@ -1,21 +1,14 @@ using System.Collections.Generic; using System.IO; using System.Reflection; -using System.Security.Cryptography; -using System.Text; + namespace EmpireCompiler.Core { public static class Common { - public static Encoding EmpireEncoding = Encoding.UTF8; - public static int AesIVLength = 16; - public static CipherMode AesCipherMode = CipherMode.CBC; - public static PaddingMode AesPaddingMode = PaddingMode.PKCS7; - public static string EmpireDirectory = Assembly.GetExecutingAssembly().Location.Split("bin")[0].Split("EmpireCompiler.dll")[0]; public static string EmpireDataDirectory = EmpireDirectory + "Data" + Path.DirectorySeparatorChar; - public static string EmpireDatabaseFile = EmpireDataDirectory + "covenant.db"; public static string EmpireTempDirectory = EmpireDataDirectory + "Temp" + Path.DirectorySeparatorChar; public static string EmpireAssemblyReferenceDirectory = EmpireDataDirectory + "AssemblyReferences" + Path.DirectorySeparatorChar; @@ -24,12 +17,10 @@ public static class Common public static string EmpireAssemblyReferenceNet45Directory = EmpireAssemblyReferenceDirectory + "net45" + Path.DirectorySeparatorChar; public static string EmpireEmbeddedResourcesDirectory = EmpireDataDirectory + "EmbeddedResources" + Path.DirectorySeparatorChar; public static string EmpireReferenceSourceLibraries = EmpireDataDirectory + "ReferenceSourceLibraries" + Path.DirectorySeparatorChar; - public static string EmpireSharpSploitDirectory = EmpireReferenceSourceLibraries + "SharpSploit" + Path.DirectorySeparatorChar; - public static string EmpireRubeusDirectory = EmpireReferenceSourceLibraries + "Rubeus" + Path.DirectorySeparatorChar; public static string EmpireTaskDirectory = EmpireDataDirectory + "Tasks" + Path.DirectorySeparatorChar; public static string EmpireTaskCSharpDirectory = EmpireTaskDirectory + "CSharp" + Path.DirectorySeparatorChar; - public static string EmpireTaskCSharpNetCoreApp30Directory = EmpireTaskCSharpDirectory + "netcoreapp3.0" + Path.DirectorySeparatorChar; + // public static string EmpireTaskCSharpNetCoreApp30Directory = EmpireTaskCSharpDirectory + "netcoreapp3.0" + Path.DirectorySeparatorChar; public static string EmpireTaskCSharpCompiledDirectory = EmpireTaskCSharpDirectory + "Compiled" + Path.DirectorySeparatorChar; public static string EmpireTaskCSharpCompiledNet35Directory = EmpireTaskCSharpCompiledDirectory + "net35" + Path.DirectorySeparatorChar; public static string EmpireTaskCSharpCompiledNet40Directory = EmpireTaskCSharpCompiledDirectory + "net40" + Path.DirectorySeparatorChar; diff --git a/EmpireCompiler/Core/Compiler.cs b/EmpireCompiler/Core/Compiler.cs index 29ea29b..fda8487 100644 --- a/EmpireCompiler/Core/Compiler.cs +++ b/EmpireCompiler/Core/Compiler.cs @@ -125,9 +125,17 @@ private static byte[] CompileCSharpRoslyn(CsharpFrameworkCompilationRequest requ .Select(R => MetadataReference.CreateFromFile(R.File)) .ToList(); + string entryPointClass = "Program"; + // Use specified OutputKind and Platform - CSharpCompilationOptions options = new CSharpCompilationOptions(outputKind: request.OutputKind, optimizationLevel: OptimizationLevel.Release, platform: request.Platform, allowUnsafe: request.UnsafeCompile); - // Compile to obtain SemanticModel + CSharpCompilationOptions options = new CSharpCompilationOptions( + outputKind: request.OutputKind, + optimizationLevel: OptimizationLevel.Release, + platform: request.Platform, + allowUnsafe: request.UnsafeCompile, + mainTypeName: entryPointClass + ); + CSharpCompilation compilation = CSharpCompilation.Create( request.AssemblyName == null ? Path.GetRandomFileName() : request.AssemblyName, compilationTrees, @@ -171,7 +179,6 @@ private static byte[] CompileCSharpRoslyn(CsharpFrameworkCompilationRequest requ ); } - // Emit compilation EmitResult emitResult; byte[] ILbytes = null; using (var ms = new MemoryStream()) @@ -184,7 +191,8 @@ private static byte[] CompileCSharpRoslyn(CsharpFrameworkCompilationRequest requ }).Where(ER => ER.Enabled).Select(ER => { return new ResourceDescription(ER.Name, () => File.OpenRead(ER.File), true); - }).ToList() + }).ToList(), + cancellationToken: default ); if (emitResult.Success) { diff --git a/EmpireCompiler/Core/Context.cs b/EmpireCompiler/Core/Context.cs deleted file mode 100644 index 80d7aa3..0000000 --- a/EmpireCompiler/Core/Context.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Author: Jake Krasnov (@_hubbl3) -// Project: Empire (https://github.com/BC-SECURITY/Empire) -// License: GNU GPLv3 - -using EmpireCompiler.Models.Agents; -using System; -using System.Collections.Generic; - -namespace EmpireCompiler.Core.Empire -{ - public class EmpireContext - { - // Covenant builds a DB to handle this however Empire is using the compiler as semi stateless - // This is not persistent so will be lost on restart - public List gList { get; set; } - public List referenceAssemblies { get; set; } - public List embeddedResources { get; set; } - public List referenceSourceLibraries { get; set; } - public List referenceSourceLibraryReferenceAssemblies { get; set; } - - public List gruntTaskOptions { get; set; } - - public List gruntTasks { get; set; } - - private int nextTaskId; - public EmpireContext() - { - gList = new List(); - referenceAssemblies = new List(); - embeddedResources = new List(); - referenceSourceLibraries = new List(); - referenceSourceLibraryReferenceAssemblies = new List(); - gruntTaskOptions = new List(); - gruntTasks = new List(); - nextTaskId = 0; - - } - - //doing this with a DB would have been a lot easier - //This is probably the wrong way to do this but it appears to be working - public void Add(Object entity) - { - gList.Add(entity); - } - - public void Add(AgentTask entity) - { - gruntTasks.Add(entity); - } - //Not sure why the grunt options are added separately instead of a member of the Grunt Task class - public void Add(TaskOption entity) - { - gruntTaskOptions.Add(entity); - } - - //generate the next task ID when a task is created - public int GetNextTaskID() - { - this.nextTaskId += 1; - return this.nextTaskId; - } - } -} \ No newline at end of file diff --git a/EmpireCompiler/Core/DbInitializer.cs b/EmpireCompiler/Core/DbInitializer.cs deleted file mode 100644 index 4c162c6..0000000 --- a/EmpireCompiler/Core/DbInitializer.cs +++ /dev/null @@ -1,290 +0,0 @@ -// Author: Ryan Cobb (@cobbr_io) -// Modified by: Jake Krasnov (@hubbl3) -// Project: Empire (https://github.com/BC-SECURITY/Empire) -// Code originally from Covenant (https://github.com/cobbr/Covenant) -// License: GNU GPLv3 - -using EmpireCompiler.Core.Empire; -using EmpireCompiler.Models.Agents; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using YamlDotNet.Serialization; - -namespace EmpireCompiler.Core -{ - public static class DbInitializer - { - - public async static Task Initialize(ICovenantService2 service) - { - await InitializeTasks2(service); - } - - public async static Task IngestTask(ICovenantService2 service, String recievedTask) - { - - IDeserializer deserializer = new DeserializerBuilder().Build(); - List serialized = deserializer.Deserialize>(recievedTask); - List tasks = serialized.Select(S => new AgentTask().FromSerializedGruntTask(S)).ToList(); - foreach (AgentTask task in tasks) - { - await service.CreateGruntTask(task); - } - - } - - public async static Task InitializeTasks2(ICovenantService2 service) - { - EmpireContext context = service.GetEmpire(); - if (!context.referenceAssemblies.Any()) - { - List ReferenceAssemblies = Directory.GetFiles(Common.EmpireAssemblyReferenceNet35Directory).Select(R => - { - FileInfo info = new FileInfo(R); - return new ReferenceAssembly - { - Name = info.Name, - Location = info.FullName.Replace(Common.EmpireAssemblyReferenceDirectory, ""), - DotNetVersion = Common.DotNetVersion.Net35 - }; - }).ToList(); - - Directory.GetFiles(Common.EmpireAssemblyReferenceNet40Directory).ToList().ForEach(R => - { - FileInfo info = new FileInfo(R); - ReferenceAssemblies.Add(new ReferenceAssembly - { - Name = info.Name, - Location = info.FullName.Replace(Common.EmpireAssemblyReferenceDirectory, ""), - DotNetVersion = Common.DotNetVersion.Net40 - }); - }); - - Directory.GetFiles(Common.EmpireAssemblyReferenceNet45Directory).ToList().ForEach(R => - { - FileInfo info = new FileInfo(R); - ReferenceAssemblies.Add(new ReferenceAssembly - { - Name = info.Name, - Location = info.FullName.Replace(Common.EmpireAssemblyReferenceDirectory, ""), - DotNetVersion = Common.DotNetVersion.Net45 - }); - }); - await service.CreateReferenceAssemblies(ReferenceAssemblies.ToArray()); - } - if (!context.embeddedResources.Any()) - { - EmbeddedResource[] EmbeddedResources = Directory.GetFiles(Common.EmpireEmbeddedResourcesDirectory).Select(R => - { - FileInfo info = new FileInfo(R); - return new EmbeddedResource - { - Name = info.Name, - Location = info.FullName.Replace(Common.EmpireEmbeddedResourcesDirectory, "") - }; - }).ToArray(); - await service.CreateEmbeddedResources(EmbeddedResources); - } - - #region ReferenceSourceLibraries - if (!context.referenceSourceLibraries.Any()) - { - var ReferenceSourceLibraries = new ReferenceSourceLibrary[] - { - new ReferenceSourceLibrary - { - Name = "SharpSploit", Description = "SharpSploit is a library for C# post-exploitation modules.", - Location = "SharpSploit" + Path.DirectorySeparatorChar + "SharpSploit" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "Rubeus", Description = "Rubeus is a C# toolset for raw Kerberos interaction and abuses.", - Location = "Rubeus" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "Seatbelt", Description = "Seatbelt is a C# project that performs a number of security oriented host-survey \"safety checks\" relevant from both offensive and defensive security perspectives.", - Location = "Seatbelt" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "SharpDPAPI", Description = "SharpDPAPI is a C# port of some Mimikatz DPAPI functionality.", - Location = "SharpDPAPI" + Path.DirectorySeparatorChar + "SharpDPAPI" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "SharpDump", Description = "SharpDump is a C# port of PowerSploit's Out-Minidump.ps1 functionality.", - Location = "SharpDump" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "SharpUp", Description = "SharpUp is a C# port of various PowerUp functionality.", - Location = "SharpUp" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "SharpWMI", Description = "SharpWMI is a C# implementation of various WMI functionality.", - Location = "SharpWMI" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - }, - new ReferenceSourceLibrary - { - Name = "SharpSC", Description = "SharpSC is a .NET assembly to perform basic operations with services.", - Location= "SharpSC" + Path.DirectorySeparatorChar, - CompatibleDotNetVersions = new List { Common.DotNetVersion.Net35, Common.DotNetVersion.Net40 } - } - }; - await service.CreateReferenceSourceLibraries(ReferenceSourceLibraries); - - var ss = await service.GetReferenceSourceLibraryByName("SharpSploit"); - var ru = await service.GetReferenceSourceLibraryByName("Rubeus"); - var se = await service.GetReferenceSourceLibraryByName("Seatbelt"); - var sd = await service.GetReferenceSourceLibraryByName("SharpDPAPI"); - var sdu = await service.GetReferenceSourceLibraryByName("SharpDump"); - var su = await service.GetReferenceSourceLibraryByName("SharpUp"); - var sw = await service.GetReferenceSourceLibraryByName("SharpWMI"); - var sc = await service.GetReferenceSourceLibraryByName("SharpSC"); - await service.CreateEntities( - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.Protocols.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.Protocols.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.IdentityModel.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.IdentityModel.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.Automation.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.Automation.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Windows.Forms.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Windows.Forms.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ss, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.AccountManagement.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.AccountManagement.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.IdentityModel.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = ru, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.IdentityModel.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.DirectoryServices.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Web.Extensions.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Web.Extensions.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Data.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Data.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Data.DataSetExtensions.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Data.DataSetExtensions.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Windows.Forms.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = se, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Windows.Forms.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Security.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sd, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Security.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sdu, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = su, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.XML.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sw, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Management.dll", Common.DotNetVersion.Net40) }, - - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net35) }, - new ReferenceSourceLibraryReferenceAssembly { ReferenceSourceLibrary = sc, ReferenceAssembly = await service.GetReferenceAssemblyByName("System.ServiceProcess.dll", Common.DotNetVersion.Net40) } - ); - } - #endregion - - if (!context.gruntTasks.Any()) - { - List files = Directory.GetFiles(Common.EmpireTaskDirectory) - .Where(F => F.EndsWith(".yaml", StringComparison.CurrentCultureIgnoreCase)) - .ToList(); - IDeserializer deserializer = new DeserializerBuilder().Build(); - foreach (string file in files) - { - - string yaml = File.ReadAllText(file); - List serialized = deserializer.Deserialize>(yaml); - List tasks = serialized.Select(S => new AgentTask().FromSerializedGruntTask(S)).ToList(); - foreach (AgentTask task in tasks) - { - await service.CreateGruntTask(task); - - } - } - } - } - - } -} \ No newline at end of file diff --git a/EmpireCompiler/Core/Exception.cs b/EmpireCompiler/Core/Exception.cs index 590722b..298a8f1 100644 --- a/EmpireCompiler/Core/Exception.cs +++ b/EmpireCompiler/Core/Exception.cs @@ -11,20 +11,4 @@ public Exception(string message) : base(message) } } - - public class ControllerNotFoundException : System.Exception - { - public ControllerNotFoundException(string message) : base(message) - { - - } - } - - public class CovenantCompileGruntStagerFailedException : Exception - { - public CovenantCompileGruntStagerFailedException(string message) : base(message) - { - - } - } } diff --git a/EmpireCompiler/Core/Service.cs b/EmpireCompiler/Core/Service.cs deleted file mode 100644 index d26313a..0000000 --- a/EmpireCompiler/Core/Service.cs +++ /dev/null @@ -1,452 +0,0 @@ -using EmpireCompiler.Core.Empire; -using EmpireCompiler.Models; -using EmpireCompiler.Models.Agents; -using Microsoft.CodeAnalysis; -using Microsoft.Extensions.Configuration; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EmpireCompiler.Core -{ - public interface IReferenceAssemblyService - { - Task> GetReferenceAssemblies(); - Task> GetDefaultNet35ReferenceAssemblies(); - Task> GetDefaultNet40ReferenceAssemblies(); - Task> GetDefaultNet45ReferenceAssemblies(); - Task GetReferenceAssembly(int id); - Task GetReferenceAssemblyByName(string name, Common.DotNetVersion version); - Task CreateReferenceAssembly(ReferenceAssembly assembly); - Task> CreateReferenceAssemblies(params ReferenceAssembly[] assemblies); - Task EditReferenceAssembly(ReferenceAssembly assembly); - Task DeleteReferenceAssembly(int id); - } - - public interface IEmbeddedResourceService - { - Task> GetEmbeddedResources(); - Task GetEmbeddedResource(int id); - Task GetEmbeddedResourceByName(string name); - Task CreateEmbeddedResource(EmbeddedResource resource); - Task> CreateEmbeddedResources(params EmbeddedResource[] resources); - Task EditEmbeddedResource(EmbeddedResource resource); - Task DeleteEmbeddedResource(int id); - } - - public interface IReferenceSourceLibraryService - { - Task> GetReferenceSourceLibraries(); - Task GetReferenceSourceLibrary(int id); - Task GetReferenceSourceLibraryByName(string name); - Task CreateReferenceSourceLibrary(ReferenceSourceLibrary library); - Task> CreateReferenceSourceLibraries(params ReferenceSourceLibrary[] libraries); - Task EditReferenceSourceLibrary(ReferenceSourceLibrary library); - Task DeleteReferenceSourceLibrary(int id); - } - - public interface IGruntTaskOptionService - { - Task EditGruntTaskOption(TaskOption option); - Task CreateGruntTaskOption(TaskOption option); - Task> CreateGruntTaskOptions(params TaskOption[] options); - } - - - public interface IGruntTaskService : IReferenceAssemblyService, IEmbeddedResourceService, IReferenceSourceLibraryService, - IGruntTaskOptionService - { - Task> GetGruntTasks(); - Task> GetGruntTasksForGrunt(int gruntId); - Task GetGruntTask(int id); - Task GetGruntTaskByName(string name, Common.DotNetVersion version = Common.DotNetVersion.Net35); - Task CreateGruntTask(AgentTask task); - Task> CreateGruntTasks(params AgentTask[] tasks); - Task EditGruntTask(AgentTask task); - Task DeleteGruntTask(int taskId); - Task ParseParametersIntoTask(AgentTask task, List parameters); - } - - public interface ICovenantService2 : IGruntTaskService - { - Task> CreateEntities(params T[] entities); - EmpireContext GetEmpire(); - void DisposeContext(); - } - - public class EmpireService : ICovenantService2 - { - protected EmpireContext _context; - public EmpireService() - { - _context = new EmpireContext(); - } - - public EmpireContext GetEmpire() - { - return _context; - } - - //Eventually this may access the Empire DB instead but for now just shove it in a list - //This actually might end up being handled on the python side anyways - public async Task> CreateEntities(params T[] entities) - { - foreach (T entity in entities) - { - _context.Add(entity); - } - return entities; - } - - public async Task ParseParametersIntoTask(AgentTask task, List parameters) - { - return null; - } - - #region Core functions for Empire Service - public async Task> CreateEmbeddedResources(params EmbeddedResource[] resources) - { - _context.embeddedResources = resources.OfType().ToList(); - return resources; - } - - //Reference Assembly methods - public async Task GetReferenceAssemblyByName(string name, Common.DotNetVersion version) - { - ReferenceAssembly assembly = _context.referenceAssemblies.First(asm => asm.Name == name); - return assembly; - } - - public async Task> CreateReferenceAssemblies(params ReferenceAssembly[] assemblies) - { - _context.referenceAssemblies = assemblies.OfType().ToList(); - return assemblies; - } - //Refrence library methods - public async Task> CreateReferenceSourceLibraries(params ReferenceSourceLibrary[] libraries) - { - _context.referenceSourceLibraries = libraries.OfType().ToList(); - return libraries; - } - - public async Task GetReferenceSourceLibraryByName(string name) - { - //original had an include for ReferenceSourceLibraryReferenceAssemblies.ReferenceAssembly and ReferenceSourceLibraryEmbeddedResources.EmbeddedResource - // if there is an issue with retrieving a library look into this atrribute more - ReferenceSourceLibrary library = _context.referenceSourceLibraries.First(RSL => RSL.Name == name); - if (library == null) - { - Console.WriteLine($"NotFound - ReferenceSourceLibrary with Name: {name}"); - } - return library; - } - - //Grunt Task Methods - public async Task GetGruntTask(int id) - { - AgentTask task = _context.gruntTasks.FirstOrDefault(tsk => tsk.Id == id); - if (task == null) - { - Console.WriteLine($"NotFound - GruntTask with id: {id}"); - } - return task; - } - - public async Task CreateGruntTask(AgentTask task) - { - //Need to consider restructuring this method and the context class - //The way it is currently done is built around interacting with a sqllite db. - //need to decide if the Empire server will manage the DB directly. - List options = task.Options.ToList(); - List resources = task.EmbeddedResources.ToList(); - List assemblies = task.ReferenceAssemblies.ToList(); - List libraries = task.ReferenceSourceLibraries.ToList(); - task.Options = new List(); - task.EmbeddedResources.ForEach(ER => task.Remove(ER)); - task.ReferenceAssemblies.ForEach(RA => task.Remove(RA)); - task.ReferenceSourceLibraries.ForEach(RSL => task.Remove(RSL)); - task.Id = _context.GetNextTaskID(); - - foreach (TaskOption option in options) - { - option.GruntTaskId = task.Id; - //since the option is being added to the task not sure the options need to be stored separately - //this was a structure done for the covenant Db - _context.Add(option); - task.Options.Add(option); - } - foreach (EmbeddedResource resource in resources) - { - await this.CreateEntities( - new AgentTaskEmbeddedResource - { - EmbeddedResource = await this.GetEmbeddedResourceByName(resource.Name), - AgentTask = task - } - ); - task.Add(resource); - } - foreach (ReferenceAssembly assembly in assemblies) - { - //This is all Database schema based so doesn't work without the databasse - await this.CreateEntities( - new AgentTaskReferenceAssembly - { - ReferenceAssembly = await this.GetReferenceAssemblyByName(assembly.Name, assembly.DotNetVersion), - AgentTask = task - } - ); - //instead do this - task.Add(assembly); - } - foreach (ReferenceSourceLibrary library in libraries) - { - task.Add(library); - } - //add the Grunt task to teh context list - _context.Add(task); - return await this.GetGruntTask(task.Id); - } - - public async Task> GetGruntTasks() - { - return _context.gruntTasks; - } - - public void DisposeContext() - { - _context = new EmpireContext(); - } - #endregion - - #region GruntTaskComponents EmbeddedResource Actions - public async Task> GetEmbeddedResources() - { - return _context.embeddedResources.ToList(); - } - - public async Task GetEmbeddedResource(int id) - { - EmbeddedResource resource = _context.embeddedResources.FirstOrDefault(ER => ER.Id == id); - if (resource == null) - { - throw new ControllerNotFoundException($"NotFound - EmbeddedResource with id: {id}"); - } - return resource; - } - - public async Task GetEmbeddedResourceByName(string name) - { - EmbeddedResource resource = _context.embeddedResources - .Where(ER => ER.Name == name) - .FirstOrDefault(); - if (resource == null) - { - throw new ControllerNotFoundException($"NotFound - EmbeddedResource with Name: {name}"); - } - return resource; - } - - public async Task CreateEmbeddedResource(EmbeddedResource resource) - { - _context.embeddedResources.Add(resource); - return await this.GetEmbeddedResource(resource.Id); - } - - //NOT FULLY IMPLEMENTED - public async Task EditEmbeddedResource(EmbeddedResource resource) - { - EmbeddedResource matchingResource = await this.GetEmbeddedResource(resource.Id); - matchingResource.Name = resource.Name; - matchingResource.Location = resource.Location; - return await this.GetEmbeddedResource(matchingResource.Id); - } - - public async Task DeleteEmbeddedResource(int id) - { - EmbeddedResource matchingResource = await this.GetEmbeddedResource(id); - _context.embeddedResources.Remove(matchingResource); - } - #endregion - - #region GruntTaskOption Actions - public async Task EditGruntTaskOption(TaskOption option) - { - return option; - } - - public async Task CreateGruntTaskOption(TaskOption option) - { - _context.Add(option); - return option; - } - - public async Task> CreateGruntTaskOptions(params TaskOption[] options) - { - _context.gruntTaskOptions.AddRange(options); - - return options; - } - #endregion - - #region GruntTask Actions - - public async Task> GetGruntTasksForGrunt(int gruntId) - { - return _context.gruntTasks - .AsEnumerable() - .Where(T => T.CompatibleDotNetVersions.Contains(Common.DotNetVersion.Net35)); - } - - public async Task GetGruntTaskByName(string name, Common.DotNetVersion version = Common.DotNetVersion.Net35) - { - string lower = name.ToLower(); - - AgentTask task = _context.gruntTasks - .Where(T => T.Name.ToLower() == lower) - .AsEnumerable() - .Where(T => T.CompatibleDotNetVersions.Contains(version)) - .FirstOrDefault(); - if (task == null) - { - // Probably bad performance here - task = _context.gruntTasks - .AsEnumerable() - .Where(T => T.Aliases.Any(A => A.Equals(lower, StringComparison.CurrentCultureIgnoreCase))) - .Where(T => T.CompatibleDotNetVersions.Contains(version)) - .FirstOrDefault(); - if (task == null) - { - throw new ControllerNotFoundException($"NotFound - GruntTask with Name: {name}"); - } - } - return await Task.FromResult(task); - } - - public async Task> CreateGruntTasks(params AgentTask[] tasks) - { - List createdTasks = new List(); - foreach (AgentTask t in tasks) - { - createdTasks.Add(await this.CreateGruntTask(t)); - } - return createdTasks; - } - - public async Task EditGruntTask(AgentTask task) - { - return null; - } - - public async Task DeleteGruntTask(int taskId) - { - - } - #endregion - - #region GruntTaskComponents ReferenceSourceLibrary Actions - public async Task> GetReferenceSourceLibraries() - { - return _context.referenceSourceLibraries; - } - - public async Task GetReferenceSourceLibrary(int id) - { - ReferenceSourceLibrary library = _context.referenceSourceLibraries - .Where(RSL => RSL.Id == id) - .FirstOrDefault(); - if (library == null) - { - throw new ControllerNotFoundException($"NotFound - ReferenceSourceLibrary with id: {id}"); - } - return library; - } - - public async Task CreateReferenceSourceLibrary(ReferenceSourceLibrary library) - { - _context.referenceSourceLibraries.Add(library); - return await this.GetReferenceSourceLibrary(library.Id); - } - - //This not properly down at the moment - public async Task EditReferenceSourceLibrary(ReferenceSourceLibrary library) - { - return await this.GetReferenceSourceLibrary(library.Id); - } - - public async Task DeleteReferenceSourceLibrary(int id) - { - ReferenceSourceLibrary referenceSourceLibrary = await this.GetReferenceSourceLibrary(id); - _context.referenceSourceLibraries.Remove(referenceSourceLibrary); - - } - #endregion - #region GruntTaskComponent ReferenceAssembly Actions - public async Task> GetReferenceAssemblies() - { - return _context.referenceAssemblies.ToList(); - } - - public async Task> GetDefaultNet35ReferenceAssemblies() - { - return new List - { - await this.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net35), - await this.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net35), - await this.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net35) - }; - } - - public async Task> GetDefaultNet40ReferenceAssemblies() - { - return new List - { - await this.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net40), - await this.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net40), - await this.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net40) - }; - } - public async Task> GetDefaultNet45ReferenceAssemblies() - { - return new List - { - await this.GetReferenceAssemblyByName("mscorlib.dll", Common.DotNetVersion.Net45), - await this.GetReferenceAssemblyByName("System.dll", Common.DotNetVersion.Net45), - await this.GetReferenceAssemblyByName("System.Core.dll", Common.DotNetVersion.Net45) - }; - } - public async Task GetReferenceAssembly(int id) - { - ReferenceAssembly assembly = _context.referenceAssemblies.FirstOrDefault(RA => RA.Id == id); - if (assembly == null) - { - throw new ControllerNotFoundException($"NotFound - ReferenceAssembly with id: {id}"); - } - return assembly; - } - - public async Task CreateReferenceAssembly(ReferenceAssembly assembly) - { - _context.referenceAssemblies.Add(assembly); - return await this.GetReferenceAssembly(assembly.Id); - } - - public async Task EditReferenceAssembly(ReferenceAssembly assembly) - { - ReferenceAssembly matchingAssembly = await this.GetReferenceAssembly(assembly.Id); - matchingAssembly.Name = assembly.Name; - matchingAssembly.Location = assembly.Location; - matchingAssembly.DotNetVersion = assembly.DotNetVersion; - return await this.GetReferenceAssembly(matchingAssembly.Id); - } - - public async Task DeleteReferenceAssembly(int id) - { - ReferenceAssembly matchingAssembly = await this.GetReferenceAssembly(id); - _context.referenceAssemblies.Remove(matchingAssembly); - } - #endregion - } - -} \ No newline at end of file diff --git a/EmpireCompiler/Core/Utilities.cs b/EmpireCompiler/Core/Utilities.cs index 63e4e35..feb97a7 100644 --- a/EmpireCompiler/Core/Utilities.cs +++ b/EmpireCompiler/Core/Utilities.cs @@ -2,7 +2,6 @@ // Project: Covenant (https://github.com/cobbr/Covenant) // License: GNU GPLv3 -using System; using System.IO; using System.IO.Compression; @@ -24,11 +23,6 @@ public static byte[] Compress(byte[] bytes) return compressedBytes; } - public static string CreateShortGuid() - { - return Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); - } - public static string GetSanitizedFilename(string filename) { foreach (char invalid in Path.GetInvalidFileNameChars()) diff --git a/EmpireCompiler/Data/ReferenceSourceLibraries/Sharpire b/EmpireCompiler/Data/ReferenceSourceLibraries/Sharpire index 9f9b5fa..37961d5 160000 --- a/EmpireCompiler/Data/ReferenceSourceLibraries/Sharpire +++ b/EmpireCompiler/Data/ReferenceSourceLibraries/Sharpire @@ -1 +1 @@ -Subproject commit 9f9b5fa36765aea39e4e7b2e48212a99c350f866 +Subproject commit 37961d5f4e88af5b722209da2413e8731dfbbf74 diff --git a/EmpireCompiler/Models/Module/AgentTask.cs b/EmpireCompiler/Models/Module/AgentTask.cs index 30d15bd..112802e 100644 --- a/EmpireCompiler/Models/Module/AgentTask.cs +++ b/EmpireCompiler/Models/Module/AgentTask.cs @@ -21,9 +21,7 @@ public class AgentTask : ISerializable [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public string OutputPath { get; set; } - - public TaskAuthor Author { get; set; } = new TaskAuthor(); - + [Required] public string Name { get; set; } = "GenericTask"; public List Aliases { get; set; } = new List(); @@ -35,8 +33,6 @@ public class AgentTask : ISerializable public string Code { get; set; } = ""; public bool Compiled { get; set; } = false; public bool Confuse { get; set; } = false; - public GruntTaskingType TaskingType { get; set; } = GruntTaskingType.Assembly; - private List GruntTaskReferenceSourceLibraries { get; set; } = new List(); private List GruntTaskReferenceAssemblies { get; set; } = new List(); private List GruntTaskEmbeddedResources { get; set; } = new List(); @@ -49,9 +45,7 @@ public class AgentTask : ISerializable public bool UnsafeCompile { get; set; } = false; public bool TokenTask { get; set; } = false; - - public List Options { get; set; } = new List(); - + public void Add(ReferenceSourceLibrary library) { GruntTaskReferenceSourceLibraries.Add(new AgentTaskReferenceSourceLibrary @@ -63,14 +57,6 @@ public void Add(ReferenceSourceLibrary library) }); } - public void Remove(ReferenceSourceLibrary library) - { - GruntTaskReferenceSourceLibraries.Remove( - GruntTaskReferenceSourceLibraries - .FirstOrDefault(GTRSL => GTRSL.GruntTaskId == this.Id && GTRSL.ReferenceSourceLibraryId == library.Id) - ); - } - public void Add(ReferenceAssembly assembly) { GruntTaskReferenceAssemblies.Add(new AgentTaskReferenceAssembly @@ -82,14 +68,6 @@ public void Add(ReferenceAssembly assembly) }); } - public void Remove(ReferenceAssembly assembly) - { - GruntTaskReferenceAssemblies.Remove( - GruntTaskReferenceAssemblies - .FirstOrDefault(GTRA => GTRA.GruntTaskId == this.Id && GTRA.ReferenceAssemblyId == assembly.Id) - ); - } - public void Add(EmbeddedResource resource) { GruntTaskEmbeddedResources.Add(new AgentTaskEmbeddedResource @@ -101,30 +79,16 @@ public void Add(EmbeddedResource resource) }); } - public void Remove(EmbeddedResource resource) - { - GruntTaskEmbeddedResources.Remove( - GruntTaskEmbeddedResources - .FirstOrDefault(GTER => GTER.GruntTaskId == this.Id && GTER.EmbeddedResourceId == resource.Id) - ); - } - internal SerializedGruntTask ToSerializedGruntTask() { return new SerializedGruntTask { Name = this.Name, - Aliases = this.Aliases, - Author = this.Author.ToSerializedGruntTaskAuthor(), - Description = this.Description, - Help = this.Help, Language = this.Language, CompatibleDotNetVersions = this.CompatibleDotNetVersions, Code = this.Code, - TaskingType = this.TaskingType, UnsafeCompile = this.UnsafeCompile, TokenTask = this.TokenTask, - Options = this.Options.OrderBy(O => O.Id).Select(O => O.ToSerializedGruntTaskOption()).ToList(), ReferenceSourceLibraries = this.ReferenceSourceLibraries.Select(RSL => RSL.ToSerializedReferenceSourceLibrary()).ToList(), ReferenceAssemblies = this.ReferenceAssemblies.Select(RA => RA.ToSerializedReferenceAssembly()).ToList(), EmbeddedResources = this.EmbeddedResources.Select(ER => ER.ToSerializedEmbeddedResource()).ToList() @@ -134,20 +98,12 @@ internal SerializedGruntTask ToSerializedGruntTask() internal AgentTask FromSerializedGruntTask(SerializedGruntTask task) { this.Name = task.Name; - this.Author = new TaskAuthor().FromSerializedGruntTaskAuthor(task.Author); - this.Aliases = task.Aliases; - this.Description = task.Description; - this.Help = task.Help; this.Language = task.Language; this.CompatibleDotNetVersions = task.CompatibleDotNetVersions; this.Code = task.Code; this.Compiled = false; - - this.TaskingType = task.TaskingType; this.UnsafeCompile = task.UnsafeCompile; this.TokenTask = task.TokenTask; - this.Options = task.Options.Select(O => new TaskOption().FromSerializedGruntTaskOption(O)).ToList(); - this.Options.ForEach(O => O.GruntTaskId = this.Id); task.ReferenceSourceLibraries.ForEach(RSL => this.Add(new ReferenceSourceLibrary().FromSerializedReferenceSourceLibrary(RSL))); task.ReferenceAssemblies.ForEach(RA => this.Add(new ReferenceAssembly().FromSerializedReferenceAssembly(RA))); task.EmbeddedResources.ForEach(ER => this.Add(new EmbeddedResource().FromSerializedEmbeddedResource(ER))); @@ -196,10 +152,10 @@ public void Compile(Compiler.RuntimeIdentifier runtimeIdentifier = Compiler.Runt { this.CompileDotNet45(); } - else if (version == Common.DotNetVersion.NetCore31) - { - this.CompileDotNetCore(runtimeIdentifier); - } + // else if (version == Common.DotNetVersion.NetCore31) + // { + // this.CompileDotNetCore(runtimeIdentifier); + // } } } } @@ -247,47 +203,23 @@ private void CompileDotNet35() return new Compiler.Reference { File = Common.EmpireAssemblyReferenceDirectory + RA.Location, Framework = Common.DotNetVersion.Net35, Enabled = true }; }) ); - #region testOutFile - if (this.Name.StartsWith("Sharpire") || this.Name.StartsWith("CSharpPS") || this.Name.StartsWith("CSharpPy")) - { - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet35Directory + this.Name + ".exe", - Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net35, - References = references35, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - // TODO: Add debug option - // OutputKind = OutputKind.ConsoleApplication, - OutputKind = OutputKind.WindowsApplication, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - }) - ); - } - else - { - #endregion - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet35Directory + this.Name + ".compiled", - Utilities.Compress(Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net35, - References = references35, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - })) - ); - } + + File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet35Directory + this.Name + ".exe", + Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest + { + Language = this.Language, + Source = this.Code, + SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), + TargetDotNetVersion = Common.DotNetVersion.Net35, + References = references35, + EmbeddedResources = resources, + UnsafeCompile = this.UnsafeCompile, + OutputKind = OutputKind.ConsoleApplication, + //OutputKind = OutputKind.WindowsApplication, + Confuse = this.Confuse, + Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") + }) + ); } private void CompileDotNet40() @@ -333,47 +265,22 @@ private void CompileDotNet40() return new Compiler.Reference { File = Common.EmpireAssemblyReferenceDirectory + RA.Location, Framework = Common.DotNetVersion.Net40, Enabled = true }; }) ); - #region testOutFile - if (this.Name.StartsWith("Sharpire") || this.Name.StartsWith("CSharpPS") || this.Name.StartsWith("CSharpPy")) - { - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet40Directory + this.Name + ".exe", - Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net40, - References = references40, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - // TODO: Add debug option - // OutputKind = OutputKind.ConsoleApplication, - OutputKind = OutputKind.ConsoleApplication, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack. It also doesn't work with Sharpire. Not sure if this actuall works with anything... - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - }) - ); - } - else - { - #endregion - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet40Directory + this.Name + ".compiled", - Utilities.Compress(Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net40, - References = references40, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - })) - ); - } + File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet40Directory + this.Name + ".exe", + Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest + { + Language = this.Language, + Source = this.Code, + SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), + TargetDotNetVersion = Common.DotNetVersion.Net40, + References = references40, + EmbeddedResources = resources, + UnsafeCompile = this.UnsafeCompile, + OutputKind = OutputKind.ConsoleApplication, + //OutputKind = OutputKind.WindowsApplication, + Confuse = this.Confuse, + Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") + }) + ); } private void CompileDotNet45() @@ -419,47 +326,22 @@ private void CompileDotNet45() return new Compiler.Reference { File = Common.EmpireAssemblyReferenceDirectory + RA.Location, Framework = Common.DotNetVersion.Net45, Enabled = true }; }) ); - #region testOutFile - if (this.Name.StartsWith("Sharpire") || this.Name.StartsWith("CSharpPS") || this.Name.StartsWith("CSharpPy")) - { - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet45Directory + this.Name + ".exe", - Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net45, - References = references45, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - // TODO: Add debug option - // OutputKind = OutputKind.ConsoleApplication, - OutputKind = OutputKind.WindowsApplication, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack. It also doesn't work with Sharpire. Not sure if this actuall works with anything... - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - }) - ); - } - else - { - #endregion - File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet45Directory + this.Name + ".compiled", - Utilities.Compress(Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest - { - Language = this.Language, - Source = this.Code, - SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), - TargetDotNetVersion = Common.DotNetVersion.Net45, - References = references45, - EmbeddedResources = resources, - UnsafeCompile = this.UnsafeCompile, - Confuse = this.Confuse, - // TODO: Fix optimization to work with GhostPack - Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") - })) - ); - } + File.WriteAllBytes(Common.EmpireTaskCSharpCompiledNet45Directory + this.Name + ".exe", + Compiler.Compile(new Compiler.CsharpFrameworkCompilationRequest + { + Language = this.Language, + Source = this.Code, + SourceDirectories = this.ReferenceSourceLibraries.Select(RSL => Common.EmpireReferenceSourceLibraries + RSL.Location).ToList(), + TargetDotNetVersion = Common.DotNetVersion.Net45, + References = references45, + EmbeddedResources = resources, + UnsafeCompile = this.UnsafeCompile, + OutputKind = OutputKind.ConsoleApplication, + //OutputKind = OutputKind.WindowsApplication, + Confuse = this.Confuse, + Optimize = !this.ReferenceSourceLibraries.Select(RSL => RSL.Name).Contains("Seatbelt") + }) + ); } private void CompileDotNetCore(Compiler.RuntimeIdentifier runtimeIdentifier) @@ -513,18 +395,11 @@ private void CompileDotNetCore(Compiler.RuntimeIdentifier runtimeIdentifier) internal class SerializedGruntTask { public string Name { get; set; } = ""; - public List Aliases { get; set; } = new List(); - public SerializedGruntTaskAuthor Author { get; set; } - - public string Description { get; set; } = ""; - public string Help { get; set; } = ""; public ImplantLanguage Language { get; set; } public IList CompatibleDotNetVersions { get; set; } = new List(); public string Code { get; set; } = ""; - public GruntTaskingType TaskingType { get; set; } = GruntTaskingType.Assembly; public bool UnsafeCompile { get; set; } = false; public bool TokenTask { get; set; } = false; - public List Options { get; set; } = new List(); public List ReferenceSourceLibraries { get; set; } = new List(); public List ReferenceAssemblies { get; set; } = new List(); public List EmbeddedResources { get; set; } = new List(); diff --git a/EmpireCompiler/Models/Module/AgentTasking.cs b/EmpireCompiler/Models/Module/AgentTasking.cs deleted file mode 100644 index ad7f89b..0000000 --- a/EmpireCompiler/Models/Module/AgentTasking.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Author: Ryan Cobb (@cobbr_io) -// Project: Covenant (https://github.com/cobbr/Covenant) -// License: GNU GPLv3 - -using EmpireCompiler.Core; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - - -namespace EmpireCompiler.Models.Agents -{ - public class CommandOutput - { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - - public string Output { get; set; } = ""; - - [Required] - public int GruntCommandId { get; set; } - [JsonIgnore, System.Text.Json.Serialization.JsonIgnore] - public GruntCommand GruntCommand { get; set; } - } - - public class GruntCommand - { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - [Required] - public string Command { get; set; } - [Required] - public DateTime CommandTime { get; set; } = DateTime.MinValue; - [Required] - public int CommandOutputId { get; set; } - public CommandOutput CommandOutput { get; set; } - - - public int? GruntTaskingId { get; set; } = null; - public AgentTasking AgentTasking { get; set; } - - public int GruntId { get; set; } - - } - - public enum GruntTaskingStatus - { - Uninitialized, - Tasked, - Progressed, - Completed, - Aborted - } - - public enum GruntTaskingType - { - Assembly, - SetDelay, - SetJitter, - SetConnectAttempts, - SetKillDate, - Exit, - Connect, - Disconnect, - Tasks, - TaskKill - } - - public class AgentTasking - { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - [Required] - public string Name { get; set; } = Utilities.CreateShortGuid(); - [Required] - public int GruntId { get; set; } - - [Required] - public int GruntTaskId { get; set; } - public AgentTask AgentTask { get; set; } - - public GruntTaskingType Type { get; set; } = GruntTaskingType.Assembly; - public List Parameters { get; set; } = new List(); - - public GruntTaskingStatus Status { get; set; } = GruntTaskingStatus.Uninitialized; - public DateTime TaskingTime { get; set; } = DateTime.MinValue; - public DateTime CompletionTime { get; set; } = DateTime.MinValue; - - public int GruntCommandId { get; set; } - [JsonIgnore, System.Text.Json.Serialization.JsonIgnore] - public GruntCommand GruntCommand { get; set; } - } -} diff --git a/EmpireCompiler/Models/Module/TaskAuthor.cs b/EmpireCompiler/Models/Module/TaskAuthor.cs deleted file mode 100644 index 3ce39c4..0000000 --- a/EmpireCompiler/Models/Module/TaskAuthor.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using YamlDotNet.Serialization; - - -namespace EmpireCompiler.Models.Agents -{ - public class TaskAuthor : ISerializable - { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - public string Name { get; set; } = ""; - public string Handle { get; set; } = ""; - public string Link { get; set; } = ""; - - public List GruntTasks { get; set; } - - internal SerializedGruntTaskAuthor ToSerializedGruntTaskAuthor() - { - return new SerializedGruntTaskAuthor - { - Name = this.Name, - Handle = this.Handle, - Link = this.Link - }; - } - - internal TaskAuthor FromSerializedGruntTaskAuthor(SerializedGruntTaskAuthor author) - { - this.Name = author.Name; - this.Handle = author.Handle; - this.Link = author.Link; - return this; - } - - public string ToYaml() - { - ISerializer serializer = new SerializerBuilder().Build(); - return serializer.Serialize(this.ToSerializedGruntTaskAuthor()); - } - - public TaskAuthor FromYaml(string yaml) - { - IDeserializer deserializer = new DeserializerBuilder().Build(); - SerializedGruntTaskAuthor author = deserializer.Deserialize(yaml); - return this.FromSerializedGruntTaskAuthor(author); - } - - public string ToJson() - { - return JsonConvert.SerializeObject(this.ToSerializedGruntTaskAuthor()); - } - - public TaskAuthor FromJson(string json) - { - SerializedGruntTaskAuthor author = JsonConvert.DeserializeObject(json); - return this.FromSerializedGruntTaskAuthor(author); - } - } - - internal class SerializedGruntTaskAuthor - { - public string Name { get; set; } = ""; - public string Handle { get; set; } = ""; - public string Link { get; set; } = ""; - } -} diff --git a/EmpireCompiler/Models/Module/TaskOption.cs b/EmpireCompiler/Models/Module/TaskOption.cs deleted file mode 100644 index 9371628..0000000 --- a/EmpireCompiler/Models/Module/TaskOption.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using YamlDotNet.Serialization; - -namespace EmpireCompiler.Models.Agents -{ - public class TaskOption : ISerializable - { - [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - public string Name { get; set; } = ""; - public string Value { get; set; } = ""; - public string DefaultValue { get; set; } = ""; - public string Description { get; set; } = ""; - public List SuggestedValues { get; set; } = new List(); - public bool Optional { get; set; } = false; - public bool DisplayInCommand { get; set; } = true; - public bool FileOption { get; set; } = false; - - public int GruntTaskId { get; set; } - [JsonIgnore, System.Text.Json.Serialization.JsonIgnore] - public AgentTask Task { get; set; } - - internal SerializedGruntTaskOption ToSerializedGruntTaskOption() - { - return new SerializedGruntTaskOption - { - Name = this.Name, - Value = "", - DefaultValue = this.DefaultValue, - Description = this.Description, - SuggestedValues = this.SuggestedValues, - Optional = this.Optional, - DisplayInCommand = this.DisplayInCommand, - FileOption = this.FileOption - }; - } - - internal TaskOption FromSerializedGruntTaskOption(SerializedGruntTaskOption option) - { - this.Name = option.Name; - this.Value = option.Value; - this.DefaultValue = option.DefaultValue; - this.Description = option.Description; - this.SuggestedValues = option.SuggestedValues; - this.Optional = option.Optional; - this.DisplayInCommand = option.DisplayInCommand; - this.FileOption = option.FileOption; - return this; - } - - public string ToYaml() - { - ISerializer serializer = new SerializerBuilder().Build(); - return serializer.Serialize(this.ToSerializedGruntTaskOption()); - } - - public TaskOption FromYaml(string yaml) - { - IDeserializer deserializer = new DeserializerBuilder().Build(); - SerializedGruntTaskOption option = deserializer.Deserialize(yaml); - return this.FromSerializedGruntTaskOption(option); - } - - public string ToJson() - { - return JsonConvert.SerializeObject(this.ToSerializedGruntTaskOption()); - } - - public TaskOption FromJson(string json) - { - SerializedGruntTaskOption option = JsonConvert.DeserializeObject(json); - return this.FromSerializedGruntTaskOption(option); - } - } - - internal class SerializedGruntTaskOption - { - public string Name { get; set; } = ""; - public string Value { get; set; } = ""; - public string DefaultValue { get; set; } = ""; - public string Description { get; set; } = ""; - public List SuggestedValues { get; set; } = new List(); - public bool Optional { get; set; } = false; - public bool DisplayInCommand { get; set; } = true; - public bool FileOption { get; set; } = false; - } -} diff --git a/EmpireCompiler/Program.cs b/EmpireCompiler/Program.cs index fceceac..aeac02c 100644 --- a/EmpireCompiler/Program.cs +++ b/EmpireCompiler/Program.cs @@ -1,11 +1,12 @@ -using EmpireCompiler.Core; +using EmpireCompiler.Models.Agents; using EmpireCompiler.Utility; using System; -using System.Linq; +using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; using System.Text; using System.Threading.Tasks; +using YamlDotNet.Serialization; namespace EmpireCompiler { @@ -48,7 +49,6 @@ static async Task Main(string[] args) var confuse = context.ParseResult.GetValueForOption(confuseOption); var debug = context.ParseResult.GetValueForOption(debugOption); - // Set the debug flag in the DebugUtility DebugUtility.IsDebugEnabled = debug; DebugUtility.DebugPrint("Debug mode enabled."); @@ -64,32 +64,17 @@ static async Task Main(string[] args) return; } - var empireService = new EmpireService(); - _ = DbInitializer.Initialize(empireService); - - // Decode YAML and ingest the task var decodedYaml = DecodeBase64(yaml); - DbInitializer.IngestTask(empireService, decodedYaml); - - // Fetch the list of tasks after ingestion - var tasks = empireService.GetEmpire().gruntTasks; - - var foundTask = tasks.FirstOrDefault(t => t.Name == task); - if (foundTask == null) - { - Console.WriteLine("Task not found: " + task); - return; - } - - foundTask.Name = GenerateRandomizedName(foundTask.Name); - foundTask.Confuse = confuse; + var deserializer = new DeserializerBuilder() .IgnoreUnmatchedProperties().Build(); + var serializedTasks = deserializer.Deserialize>(decodedYaml); DebugUtility.DebugPrint("Compiling task..."); - foundTask.Compile(); + var agentTask = new AgentTask().FromSerializedGruntTask(serializedTasks[0]); + agentTask.Name = task; + agentTask.Compile(); - // Return the final task name - DebugUtility.DebugPrint($"Final Task Name: {foundTask.Name}"); - Console.WriteLine($"Final Task Name: {foundTask.Name}"); + DebugUtility.DebugPrint($"Final Task Name: {task}"); + Console.WriteLine($"Final Task Name: {task}"); } catch (System.Exception ex) { @@ -101,14 +86,6 @@ static async Task Main(string[] args) await rootCommand.InvokeAsync(args); } - private static string GenerateRandomizedName(string baseName) - { - var random = new Random(); - var randomName = new string(Enumerable.Repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 5) - .Select(s => s[random.Next(s.Length)]).ToArray()); - return $"{baseName}_{randomName}"; - } - private static string DecodeBase64(string encodedString) { var bytes = Convert.FromBase64String(encodedString); diff --git a/EmpireCompiler/Properties/launchSettings.json b/EmpireCompiler/Properties/launchSettings.json index 3d1c440..138f6e1 100644 --- a/EmpireCompiler/Properties/launchSettings.json +++ b/EmpireCompiler/Properties/launchSettings.json @@ -3,7 +3,31 @@ "EmpireCompiler": { "commandName": "Project", "launchBrowser": true, - "commandLineArgs": "--task CSharpPS --yaml LSBOYW1lOiBDU2hhcnBQUwogIEFsaWFzZXM6IFtdCiAgRGVzY3JpcHRpb246IEdlbmVyYXRlIGEgUG93ZXJTaGVsbCBDIyBzb2x1dGlvbiB3aXRoIGVtYmVkZGVkIHN0YWdlciBjb2RlIHRoYXQgY29tcGlsZXMgdG8gYW4gZXhlCiAgQXV0aG9yOgogICAgICBOYW1lOiBDeDAxTgogICAgICBIYW5kbGU6IEN4MDFOCiAgICAgIExpbms6IGh0dHBzOi8vdHdpdHRlci5jb20vX0N4MDFOCiAgSGVscDoKICBMYW5ndWFnZTogQ1NoYXJwCiAgQ29tcGF0aWJsZURvdE5ldFZlcnNpb25zOgogIC0gTmV0NDAKICAtIE5ldDM1CiAgQ29kZTogfAogICAgdXNpbmcgU3lzdGVtOwogICAgdXNpbmcgU3lzdGVtLlJlc291cmNlczsKICAgIHVzaW5nIFN5c3RlbS5MaW5xOwogICAgdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zOwogICAgdXNpbmcgU3lzdGVtLlRleHQ7CiAgICB1c2luZyBTeXN0ZW0uTWFuYWdlbWVudC5BdXRvbWF0aW9uOwogICAgdXNpbmcgU3lzdGVtLk1hbmFnZW1lbnQuQXV0b21hdGlvbi5SdW5zcGFjZXM7CiAgICB1c2luZyBTeXN0ZW0uSU87CiAgICB1c2luZyBTeXN0ZW0uUmVmbGVjdGlvbjsKICAgIAogICAgcHVibGljIHN0YXRpYyBjbGFzcyBQcm9ncmFtCiAgICB7CiAgICAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQogICAgICAgICAgewoKICAgICAgICAgICAgUG93ZXJTaGVsbCBwcyA9IFBvd2VyU2hlbGwuQ3JlYXRlKCk7CgogICAgICAgICAgICB0cnkKICAgICAgICAgICAgewogICAgICAgICAgICAgIHZhciBhc3NlbWJseSA9IEFzc2VtYmx5LkdldEV4ZWN1dGluZ0Fzc2VtYmx5KCk7CiAgICAgICAgICAgICAgdmFyIHJlc291cmNlTmFtZSA9ICJsYXVuY2hlci50eHQiOwoKICAgICAgICAgICAgICBzdHJpbmdbXSBuYW1lcyA9IGFzc2VtYmx5LkdldE1hbmlmZXN0UmVzb3VyY2VOYW1lcygpOwoKICAgICAgICAgICAgICB1c2luZyAoU3RyZWFtUmVhZGVyIHJlYWRlciA9IG5ldyBTdHJlYW1SZWFkZXIoYXNzZW1ibHkuR2V0TWFuaWZlc3RSZXNvdXJjZVN0cmVhbShyZXNvdXJjZU5hbWUpKSkKICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIHN0cmluZyBzY3JpcHQgPSByZWFkZXIuUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICAgIHBzLkFkZFNjcmlwdChzY3JpcHQpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwcy5JbnZva2UoKTsKICAgIAogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkVycm9yOiAiICsgZS5NZXNzYWdlLlRvU3RyaW5nKCkpOwogICAgICAgICAgICB9CgogICAgICAgICAgfQogICAgfQogIFRhc2tpbmdUeXBlOiBBc3NlbWJseQogIFVuc2FmZUNvbXBpbGU6IGZhbHNlCiAgVG9rZW5UYXNrOiBmYWxzZQogIE9wdGlvbnM6IFtdCiAgUmVmZ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lKCk7CgogICAgICAgICAgICB0cnkKICAgICAgICAgICAgewogICAgICAgICAgICAgIHZhciBhc3NlbWJseSA9IEFzc2VtYmx5LkdldEV4ZWN1dGluZ0Fzc2VtYmx5KCk7CiAgICAgICAgICAgICAgdmFyIHJlc291cmNlTmFtZSA9ICJsYXVuY2hlci50eHQiOwoKICAgICAgICAgICAgICBzdHJpbmdbXSBuYW1lcyA9IGFzc2VtYmx5LkdldE1hbmlmZXN0UmVzb3VyY2VOYW1lcygpOwoKICAgICAgICAgICAgICB1c2luZyAoU3RyZWFtUmVhZGVyIHJlYWRlciA9IG5ldyBTdHJlYW1SZWFkZXIoYXNzZW1ibHkuR2V0TWFuaWZlc3RSZXNvdXJjZVN0cmVhbShyZXNvdXJjZU5hbWUpKSkKICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIHN0cmluZyBzY3JpcHQgPSByZWFkZXIuUmVhZFRvRW5kKCk7CiAgICAgICAgICAgICAgICAgIHBzLkFkZFNjcmlwdChzY3JpcHQpOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICBwcy5JbnZva2UoKTsKICAgIAogICAgICAgICAgICB9CiAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkVycm9yOiAiICsgZS5NZXNzYWdlLlRvU3RyaW5nKCkpOwogICAgICAgICAgICB9CgogICAgICAgICAgfQogICAgfQogIFRhc2tpbmdUeXBlOiBBc3NlbWJseQogIFVuc2FmZUNvbXBpbGU6IGZhbHNlCiAgVG9rZW5UYXNrOiBmYWxzZQogIE9wdGlvbnM6IFtdCiAgUmVmZXJlbmNlU291cmNlTGlicmFyaWVzOiBbXQogIFJlZmVyZW5jZUFzc2VtYmxpZXM6CiAgICAtIE5hbWU6IFN5c3RlbS5NYW5hZ2VtZW50LkF1dG9tYXRpb24uZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uTWFuYWdlbWVudC5BdXRvbWF0aW9uLmRsbAogICAgICBEb3ROZXRWZXJzaW9uOiBOZXQzNQogICAgLSBOYW1lOiBTeXN0ZW0uTWFuYWdlbWVudC5BdXRvbWF0aW9uLmRsbAogICAgICBMb2NhdGlvbjogbmV0NDBcU3lzdGVtLk1hbmFnZW1lbnQuQXV0b21hdGlvbi5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0NDAKICAgIC0gTmFtZTogU3lzdGVtLkNvcmUuZGxsCiAgICAgIExvY2F0aW9uOiBuZXQ0MFxTeXN0ZW0uQ29yZS5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0NDAKICAgIC0gTmFtZTogU3lzdGVtLkNvcmUuZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uQ29yZS5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0MzUKICAgIC0gTmFtZTogU3lzdGVtLmRsbAogICAgICBMb2NhdGlvbjogbmV0NDBcU3lzdGVtLmRsbAogICAgICBEb3ROZXRWZXJzaW9uOiBOZXQ0MAogICAgLSBOYW1lOiBTeXN0ZW0uZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDM1CiAgICAtIE5hbWU6IG1zY29ybGliLmRsbAogICAgICBMb2NhdGlvbjogbmV0NDBcbXNjb3JsaWIuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDQwCiAgICAtIE5hbWU6IG1zY29ybGliLmRsbAogICAgICBMb2NhdGlvbjogbmV0MzVcbXNjb3JsaWIuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDM1CiAgRW1iZWRkZWRSZXNvdXJjZXM6CiAgICAtIE5hbWU6IGxhdW5jaGVyLnR4dAogICAgICBMb2NhdGlvbjogbGF1bmNoZXIudHh0 --debug", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Seatbelt": { + "commandName": "Project", + "launchBrowser": true, + "commandLineArgs": "--task Seatbelt_ku53 --yaml LSBOYW1lOiBTZWF0YmVsdAogIEFsaWFzZXM6IFtdCiAgRGVzY3JpcHRpb246ICcnCiAgQXV0aG9yOgogICAgTmFtZTogJycKICAgIEhhbmRsZTogJycKICAgIExpbms6ICcnCiAgSGVscDogJycKICBMYW5ndWFnZTogY3NoYXJwCiAgQ29tcGF0aWJsZURvdE5ldFZlcnNpb25zOgogIC0gTmV0MzUKICAtIE5ldDQwCiAgQ29kZTogfAogICAgdXNpbmcgU3lzdGVtOwogICAgdXNpbmcgU3lzdGVtLklPOwogICAgdXNpbmcgU3lzdGVtLlJlZmxlY3Rpb247CiAgICB1c2luZyBTeXN0ZW0uVGV4dDsKICAgIHVzaW5nIFNlYXRiZWx0OwogICAgCiAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFByb2dyYW0KICAgIHsKICAgICAgICBwdWJsaWMgc3RhdGljIFN0cmVhbSBPdXRwdXRTdHJlYW0geyBnZXQ7IHNldDsgfQogICAgCiAgICAgICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKICAgICAgICB7CiAgICAgICAgICAgIHVzaW5nIChTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpKQogICAgICAgICAgICB7ICAgIAogICAgICAgICAgICAgICAgU3RyZWFtV3JpdGVyIG91dHB1dFN0cmVhbVdyaXRlciA9IG51bGw7CiAgICAgICAgICAgICAgICBpZiAoT3V0cHV0U3RyZWFtICE9IG51bGwpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgb3V0cHV0U3RyZWFtV3JpdGVyID0gbmV3IFN0cmVhbVdyaXRlcihPdXRwdXRTdHJlYW0pOwogICAgICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbVdyaXRlci5BdXRvRmx1c2ggPSB0cnVlOwogICAgICAgICAgICAgICAgfQogICAgCiAgICAgICAgICAgICAgICB0cnkKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICB2YXIgc2VhdGJlbHQgPSBuZXcgU2VhdGJlbHQuU2VhdGJlbHQoYXJncyk7CiAgICAgICAgICAgICAgICAgICAgc2VhdGJlbHQuU3RhcnQoKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoIChFeGNlcHRpb24gZXgpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgc3RyaW5nV3JpdGVyLldyaXRlTGluZSgkIkVycm9yOiB7ZXguTWVzc2FnZX0iKTsKICAgICAgICAgICAgICAgICAgICBpZiAoZXguSW5uZXJFeGNlcHRpb24gIT0gbnVsbCkKICAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgIHN0cmluZ1dyaXRlci5Xcml0ZUxpbmUoJCJJbm5lciBFeGNlcHRpb246IHtleC5Jbm5lckV4Y2VwdGlvbi5HZXRUeXBlKCkuRnVsbE5hbWV9OiB7ZXguSW5uZXJFeGNlcHRpb24uTWVzc2FnZX0iKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBmaW5hbGx5CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWYgKG91dHB1dFN0cmVhbVdyaXRlciAhPSBudWxsKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0U3RyZWFtV3JpdGVyLkZsdXNoKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbVdyaXRlci5DbG9zZSgpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShzdHJpbmdXcml0ZXIuVG9TdHJpbmcoKSk7CiAgICAg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mV0NDBcU3lzdGVtLkRhdGEuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDQwCiAgICAtIE5hbWU6IFN5c3RlbS5EYXRhLkRhdGFTZXRFeHRlbnNpb25zLmRsbAogICAgICBMb2NhdGlvbjogbmV0MzVcU3lzdGVtLkRhdGEuRGF0YVNldEV4dGVuc2lvbnMuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDM1CiAgICAtIE5hbWU6IFN5c3RlbS5EYXRhLkRhdGFTZXRFeHRlbnNpb25zLmRsbAogICAgICBMb2NhdGlvbjogbmV0NDBcU3lzdGVtLkRhdGEuRGF0YVNldEV4dGVuc2lvbnMuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDQwCiAgICBFbWJlZGRlZFJlc291cmNlczogW10KICBSZWZlcmVuY2VBc3NlbWJsaWVzOiBbXQogIEVtYmVkZGVkUmVzb3VyY2VzOiBbXQ== --debug", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Powershell-Old": { + "commandName": "Project", + "launchBrowser": true, + "commandLineArgs": "--task Powershell_4f24 --yaml LSBOYW1lOiBQb3dlclNoZWxsCiAgQWxpYXNlczogW10KICBEZXNjcmlwdGlvbjogJycKICBBdXRob3I6CiAgICBOYW1lOiAnJwogICAgSGFuZGxlOiAnJwogICAgTGluazogJycKICBIZWxwOiAnJwogIExhbmd1YWdlOiBjc2hhcnAKICBDb21wYXRpYmxlRG90TmV0VmVyc2lvbnM6CiAgLSBOZXQzNQogIC0gTmV0NDAKICBDb2RlOiB8CiAgICB1c2luZyBTeXN0ZW07CiAgICB1c2luZyBTeXN0ZW0uSU87CiAgICB1c2luZyBTeXN0ZW0uUmVmbGVjdGlvbjsKICAgIHVzaW5nIFN5c3RlbS5UZXh0OwogICAgdXNpbmcgU2hhcnBTcGxvaXQuRXhlY3V0aW9uOwogICAgCiAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFByb2dyYW0KICAgIHsKICAgICAgICBw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ogTmV0NDAKICAgIC0gTmFtZTogU3lzdGVtLk1hbmFnZW1lbnQuZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uTWFuYWdlbWVudC5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0MzUKICAgIC0gTmFtZTogbXNjb3JsaWIuZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxtc2NvcmxpYi5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0MzUKICAgIC0gTmFtZTogU3lzdGVtLkNvcmUuZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uQ29yZS5kbGwKICAgICAgRG90TmV0VmVyc2lvbjogTmV0MzUKICAgIC0gTmFtZTogU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLmRsbAogICAgICBMb2NhdGlvbjogbmV0MzVcU3lzdGVtLkRpcmVjdG9yeVNlcnZpY2VzLmRsbAogICAgICBEb3ROZXRWZXJzaW9uOiBOZXQzNQogICAgLSBOYW1lOiBTeXN0ZW0uZGxsCiAgICAgIExvY2F0aW9uOiBuZXQzNVxTeXN0ZW0uZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDM1CiAgICAtIE5hbWU6IFN5c3RlbS5JZGVudGl0eU1vZGVsLmRsbAogICAgICBMb2NhdGlvbjogbmV0MzVcU3lzdGVtLklkZW50aXR5TW9kZWwuZGxsCiAgICAgIERvdE5ldFZlcnNpb246IE5ldDM1CiAgICBFbWJlZGRlZFJlc291cmNlczogW10KICBSZWZlcmVuY2VBc3NlbWJsaWVzOiBbXQogIEVtYmVkZGVkUmVzb3VyY2VzOiBbXQ== --debug", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Powershell-New": { + "commandName": "Project", + "launchBrowser": true, + "commandLineArgs": "--task Powershell --yaml LSBOYW1lOiBQb3dlclNoZWxsCiAgQWxpYXNlczogW10KICBEZXNjcmlwdGlvbjoKICBBdXRob3I6CiAgICBOY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NvdXJjZXM6IFtdCiAgUmVmZXJlbmNlQXNzZW1ibGllczogW10KICBFbWJlZGRlZFJlc291cmNlczogW10= --debug", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }