public override void Command(MenuItem menuItem, string UserInput) { BinaryLauncherMenuItem binaryLauncherMenuItem = (BinaryLauncherMenuItem)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" }.Contains(commands[1].ToLower()))) { EliteConsole.PrintFormattedErrorLine("Type must be one of: \"Stager\"\\\"GruntStager\""); menuItem.PrintInvalidOptionError(UserInput); return; } binaryLauncherMenuItem.Refresh(); if (binaryLauncherMenuItem.binaryLauncher.LauncherString == "") { binaryLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost(); binaryLauncherMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated BinaryLauncher: " + binaryLauncherMenuItem.binaryLauncher.LauncherString); } if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager"))) { EliteConsole.PrintInfoLine(binaryLauncherMenuItem.binaryLauncher.StagerCode); } }
public override void Command(MenuItem menuItem, string UserInput) { BinaryLauncherMenuItem binaryLauncherMenuItem = ((BinaryLauncherMenuItem)menuItem); string[] commands = UserInput.Split(" "); if (commands.Length != 2 || commands[0].ToLower() != "write") { menuItem.PrintInvalidOptionError(UserInput); } else { binaryLauncherMenuItem.Refresh(); if (binaryLauncherMenuItem.binaryLauncher.LauncherString == "") { binaryLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost(); binaryLauncherMenuItem.Refresh(); EliteConsole.PrintFormattedHighlightLine("Generated BinaryLauncher: " + binaryLauncherMenuItem.binaryLauncher.LauncherString); } string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars())); System.IO.File.WriteAllBytes(OutputFilePath, Convert.FromBase64String(binaryLauncherMenuItem.binaryLauncher.LauncherString)); EliteConsole.PrintFormattedHighlightLine("Wrote BinaryLauncher to: \"" + OutputFilePath + "\""); } }