示例#1
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            CscriptLauncherMenuItem cscriptMenuItem = (CscriptLauncherMenuItem)menuItem;

            cscriptMenuItem.cscriptLauncher = this.CovenantClient.ApiLaunchersCscriptPost();
            EliteConsole.PrintFormattedHighlightLine("Generated CscriptLauncher: " + cscriptMenuItem.cscriptLauncher.LauncherString);
        }
示例#2
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            CscriptLauncherMenuItem cscriptMenuItem = (CscriptLauncherMenuItem)menuItem;

            cscriptMenuItem.cscriptLauncher = this.CovenantClient.ApiLaunchersCscriptGet();
            CscriptLauncher launcher = cscriptMenuItem.cscriptLauncher;
            Listener        listener = this.CovenantClient.ApiListenersGet().FirstOrDefault(L => L.Id == cscriptMenuItem.cscriptLauncher.ListenerId);

            EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, "CscriptLauncher");

            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()
            });
示例#3
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            CscriptLauncherMenuItem cscriptMenuItem = (CscriptLauncherMenuItem)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;
            }
            cscriptMenuItem.Refresh();
            if (cscriptMenuItem.cscriptLauncher.LauncherString == "")
            {
                cscriptMenuItem.CovenantClient.ApiLaunchersCscriptPost();
                cscriptMenuItem.Refresh();
                EliteConsole.PrintFormattedHighlightLine("Generated CscriptLauncher: " + cscriptMenuItem.cscriptLauncher.LauncherString);
            }
            if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager")))
            {
                EliteConsole.PrintInfoLine(cscriptMenuItem.cscriptLauncher.StagerCode);
            }
            else if (commands.Length == 2 && commands[1].ToLower() == "scriptlet")
            {
                EliteConsole.PrintInfoLine(cscriptMenuItem.cscriptLauncher.DiskCode);
            }
        }
示例#4
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            CscriptLauncherMenuItem cscriptLauncherMenuItem = ((CscriptLauncherMenuItem)menuItem);

            string[] commands = UserInput.Split(" ");
            if (commands.Length != 2 || commands[0].ToLower() != "write")
            {
                menuItem.PrintInvalidOptionError(UserInput);
            }
            else
            {
                cscriptLauncherMenuItem.Refresh();
                if (cscriptLauncherMenuItem.cscriptLauncher.LauncherString == "")
                {
                    cscriptLauncherMenuItem.CovenantClient.ApiLaunchersBinaryPost();
                    cscriptLauncherMenuItem.Refresh();
                    EliteConsole.PrintFormattedHighlightLine("Generated CscriptLauncher: " + cscriptLauncherMenuItem.cscriptLauncher.LauncherString);
                }

                string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars()));
                System.IO.File.WriteAllText(OutputFilePath, cscriptLauncherMenuItem.cscriptLauncher.DiskCode);
                EliteConsole.PrintFormattedHighlightLine("Wrote CscriptLauncher to: \"" + OutputFilePath + "\"");
            }
        }
示例#5
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            CscriptLauncherMenuItem cscriptMenuItem = (CscriptLauncherMenuItem)menuItem;

            string[] commands = UserInput.Split(" ");
            if (commands.Length != 2 || commands[0].ToLower() != "host")
            {
                menuItem.PrintInvalidOptionError(UserInput);
                return;
            }
            cscriptMenuItem.cscriptLauncher = this.CovenantClient.ApiLaunchersCscriptPost();
            HttpListener listener = this.CovenantClient.ApiListenersHttpByIdGet(cscriptMenuItem.cscriptLauncher.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(cscriptMenuItem.cscriptLauncher.DiskCode))
            };

            fileToHost = this.CovenantClient.ApiListenersByIdHostedfilesPost(listener.Id ?? default, fileToHost);
            cscriptMenuItem.cscriptLauncher = this.CovenantClient.ApiLaunchersCscriptHostedPost(fileToHost);

            Uri hostedLocation = new Uri(listener.Url + fileToHost.Path);

            EliteConsole.PrintFormattedHighlightLine("CscriptLauncher hosted at: " + hostedLocation);
            EliteConsole.PrintFormattedWarningLine("cscript.exe cannot execute remotely hosted files, the payload must first be written to disk");
            EliteConsole.PrintFormattedInfoLine("Launcher: " + cscriptMenuItem.cscriptLauncher.LauncherString);
        }