コード例 #1
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            MshtaLauncherMenuItem mshtaMenuItem = (MshtaLauncherMenuItem)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;
            }
            mshtaMenuItem.Refresh();
            if (mshtaMenuItem.mshtaLauncher.LauncherString == "")
            {
                mshtaMenuItem.CovenantClient.ApiLaunchersMshtaPost();
                mshtaMenuItem.Refresh();
                EliteConsole.PrintFormattedHighlightLine("Generated MshtaLauncher: " + mshtaMenuItem.mshtaLauncher.LauncherString);
            }
            if (commands.Length == 1 || (commands.Length == 2 && (commands[1].ToLower() == "stager" || commands[1].ToLower() == "gruntstager")))
            {
                EliteConsole.PrintInfoLine(mshtaMenuItem.mshtaLauncher.StagerCode);
            }
            else if (commands.Length == 2 && commands[1].ToLower() == "scriptlet")
            {
                EliteConsole.PrintInfoLine(mshtaMenuItem.mshtaLauncher.DiskCode);
            }
        }
コード例 #2
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            MshtaLauncherMenuItem mshtaLauncherMenuItem = ((MshtaLauncherMenuItem)menuItem);

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

                string OutputFilePath = Common.EliteDataFolder + String.Concat(commands[1].Split(System.IO.Path.GetInvalidFileNameChars()));
                System.IO.File.WriteAllText(OutputFilePath, mshtaLauncherMenuItem.mshtaLauncher.DiskCode);
                EliteConsole.PrintFormattedHighlightLine("Wrote MshtaLauncher's hta to: \"" + OutputFilePath + "\"");
            }
        }