public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilMenuItem = (InstallUtilLauncherMenuItem)menuItem; installutilMenuItem.installutilLauncher = this.CovenantClient.ApiLaunchersInstallutilPost(); EliteConsole.PrintFormattedHighlightLine("Generated InstallUtilLauncher: " + installutilMenuItem.installutilLauncher.LauncherString); }
public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilMenuItem = (InstallUtilLauncherMenuItem)menuItem; installutilMenuItem.installutilLauncher = this.CovenantClient.ApiLaunchersInstallutilGet(); InstallUtilLauncher launcher = installutilMenuItem.installutilLauncher; Listener listener = this.CovenantClient.ApiListenersGet().FirstOrDefault(L => L.Id == installutilMenuItem.installutilLauncher.ListenerId); EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, "InstallUtilLauncher"); menu.Rows.Add(new List <string> { "Name:", launcher.Name }); menu.Rows.Add(new List <string> { "Description:", launcher.Description }); menu.Rows.Add(new List <string> { "ListenerName:", listener == null ? "" : listener.Name }); menu.Rows.Add(new List <string> { "DotNetFramework:", launcher.DotNetFrameworkVersion.ToString() }); menu.Rows.Add(new List <string> { "Delay:", (launcher.Delay ?? default).ToString() });
public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilMenuItem = (InstallUtilLauncherMenuItem)menuItem; string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "host") { menuItem.PrintInvalidOptionError(UserInput); return; } installutilMenuItem.installutilLauncher = this.CovenantClient.ApiLaunchersInstallutilPost(); HttpListener listener = this.CovenantClient.ApiListenersHttpByIdGet(installutilMenuItem.installutilLauncher.ListenerId ?? default); if (listener == null) { EliteConsole.PrintFormattedErrorLine("Can only host a file on a valid HttpListener."); menuItem.PrintInvalidOptionError(UserInput); return; } HostedFile fileToHost = new HostedFile { ListenerId = listener.Id, Path = commands[1], Content = installutilMenuItem.installutilLauncher.DiskCode }; fileToHost = this.CovenantClient.ApiListenersByIdHostedfilesPost(listener.Id ?? default, fileToHost); installutilMenuItem.installutilLauncher = this.CovenantClient.ApiLaunchersInstallutilHostedPost(fileToHost); Uri hostedLocation = new Uri(listener.Url + fileToHost.Path); EliteConsole.PrintFormattedHighlightLine("InstallUtilLauncher hosted at: " + hostedLocation); EliteConsole.PrintFormattedWarningLine("installutil.exe cannot execute remotely hosted files, the payload must first be written to disk"); EliteConsole.PrintFormattedInfoLine("Launcher: " + installutilMenuItem.installutilLauncher.LauncherString); }
public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilMenuItem = (InstallUtilLauncherMenuItem)menuItem; string[] commands = UserInput.Split(" "); if (commands.Length < 1 || commands.Length > 2 || commands[0].ToLower() != "code") { menuItem.PrintInvalidOptionError(UserInput); return; } else if (commands.Length == 2 && (!new List <string> { "stager", "gruntstager", "xml" }.Contains(commands[1].ToLower()))) { EliteConsole.PrintFormattedErrorLine("Type must be one of: \"Stager\"\\\"GruntStager\" or \"XML\""); menuItem.PrintInvalidOptionError(UserInput); return; } installutilMenuItem.Refresh(); if (installutilMenuItem.installutilLauncher.LauncherString == "") { installutilMenuItem.CovenantClient.ApiLaunchersInstallutilPost(); installutilMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated InstallUtilLauncher: " + installutilMenuItem.installutilLauncher.LauncherString); } if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager"))) { EliteConsole.PrintInfoLine(installutilMenuItem.installutilLauncher.StagerCode); } else if (commands.Length == 2 && commands[1].ToLower() == "xml") { EliteConsole.PrintInfoLine(installutilMenuItem.installutilLauncher.DiskCode); } }
public override void Command(MenuItem menuItem, string UserInput) { InstallUtilLauncherMenuItem installutilLauncherMenuItem = ((InstallUtilLauncherMenuItem)menuItem); string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "write") { menuItem.PrintInvalidOptionError(UserInput); } else { installutilLauncherMenuItem.Refresh(); if (installutilLauncherMenuItem.installutilLauncher.LauncherString == "") { installutilLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost(); installutilLauncherMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated InstallUtilLauncher: " + installutilLauncherMenuItem.installutilLauncher.LauncherString); } string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars())); System.IO.File.WriteAllBytes(OutputFilePath, Convert.FromBase64String(installutilLauncherMenuItem.installutilLauncher.DiskCode)); EliteConsole.PrintFormattedHighlightLine("Wrote InstallUtilLauncher to: \"" + OutputFilePath + "\""); } }