Esempio n. 1
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            BinaryLauncherMenuItem binaryMenuItem = (BinaryLauncherMenuItem)menuItem;

            binaryMenuItem.binaryLauncher = this.CovenantClient.ApiLaunchersBinaryGet();
            BinaryLauncher launcher = binaryMenuItem.binaryLauncher;
            Listener       listener = this.CovenantClient.ApiListenersGet().FirstOrDefault(L => L.Id == binaryMenuItem.binaryLauncher.ListenerId);

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

            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 == DotNetVersion.Net35 ? "v3.5" : "v4.0"
            });
            menu.Rows.Add(new List <string> {
                "Delay:", (launcher.Delay ?? default).ToString()
            });
Esempio n. 2
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            BinaryLauncherMenuItem binaryLauncherMenuItem = (BinaryLauncherMenuItem)menuItem;

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

            fileToHost = this.CovenantClient.ApiListenersByIdHostedfilesPost(listener.Id ?? default, fileToHost);
            binaryLauncherMenuItem.binaryLauncher = this.CovenantClient.ApiLaunchersBinaryHostedPost(fileToHost);

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

            EliteConsole.PrintFormattedHighlightLine("BinaryLauncher hosted at: " + hostedLocation);
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            BinaryLauncherMenuItem binaryLauncherMenuItem = (BinaryLauncherMenuItem)menuItem;

            this.CovenantClient.ApiLaunchersBinaryPost();
            binaryLauncherMenuItem.binaryLauncher = this.CovenantClient.ApiLaunchersBinaryGet();
            EliteConsole.PrintFormattedHighlightLine("Generated BinaryLauncher: " + binaryLauncherMenuItem.binaryLauncher.LauncherString);
        }
Esempio n. 5
0
        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 + "\"");
            }
        }