public override void Command(MenuItem menuItem, string UserInput) { WscriptLauncherMenuItem wscriptMenuItem = (WscriptLauncherMenuItem)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", "scriptlet" }.Contains(commands[1].ToLower()))) { EliteConsole.PrintFormattedErrorLine("Type must be one of: \"Stager\"\\\"GruntStager\" or \"Scriptlet\""); menuItem.PrintInvalidOptionError(UserInput); return; } wscriptMenuItem.Refresh(); if (wscriptMenuItem.wscriptLauncher.LauncherString == "") { wscriptMenuItem.CovenantClient.ApiLaunchersWscriptPost(); wscriptMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated WscriptLauncher: " + wscriptMenuItem.wscriptLauncher.LauncherString); } if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager"))) { EliteConsole.PrintInfoLine(wscriptMenuItem.wscriptLauncher.StagerCode); } else if (commands.Length == 2 && commands[1].ToLower() == "scriptlet") { EliteConsole.PrintInfoLine(wscriptMenuItem.wscriptLauncher.DiskCode); } }
public override void Command(MenuItem menuItem, string UserInput) { WscriptLauncherMenuItem wscriptMenuItem = (WscriptLauncherMenuItem)menuItem; string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "host") { menuItem.PrintInvalidOptionError(UserInput); return; } wscriptMenuItem.wscriptLauncher = this.CovenantClient.ApiLaunchersWscriptPost(); HttpListener listener = this.CovenantClient.ApiListenersHttpByIdGet(wscriptMenuItem.wscriptLauncher.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 = Convert.ToBase64String(Common.CovenantEncoding.GetBytes(wscriptMenuItem.wscriptLauncher.DiskCode)) }; fileToHost = this.CovenantClient.ApiListenersByIdHostedfilesPost(listener.Id ?? default, fileToHost); wscriptMenuItem.wscriptLauncher = this.CovenantClient.ApiLaunchersWscriptHostedPost(fileToHost); Uri hostedLocation = new Uri(listener.Url + fileToHost.Path); EliteConsole.PrintFormattedHighlightLine("WscriptLauncher hosted at: " + hostedLocation); EliteConsole.PrintFormattedWarningLine("wscript.exe cannot execute remotely hosted files, the payload must first be written to disk"); EliteConsole.PrintFormattedInfoLine("Launcher: " + wscriptMenuItem.wscriptLauncher.LauncherString); }
public override void Command(MenuItem menuItem, string UserInput) { WscriptLauncherMenuItem wscriptMenuItem = (WscriptLauncherMenuItem)menuItem; wscriptMenuItem.wscriptLauncher = this.CovenantClient.ApiLaunchersWscriptGet(); WscriptLauncher launcher = wscriptMenuItem.wscriptLauncher; Listener listener = this.CovenantClient.ApiListenersGet().FirstOrDefault(L => L.Id == wscriptMenuItem.wscriptLauncher.ListenerId); EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, "WscriptLauncher"); 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> { "ScriptLanguage:", launcher.ScriptLanguage.ToString() }); 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) { WscriptLauncherMenuItem wscriptMenuItem = (WscriptLauncherMenuItem)menuItem; wscriptMenuItem.wscriptLauncher = this.CovenantClient.ApiLaunchersWscriptPost(); EliteConsole.PrintFormattedHighlightLine("Generated WscriptLauncher: " + wscriptMenuItem.wscriptLauncher.LauncherString); }