示例#1
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Menu, "Help");

            menu.Columns.Add("Command");
            menu.Columns.Add("Options");
            menu.Columns.Add("Description");
            menuItem.MenuOptions.ForEach(M =>
            {
                menu.Rows.Add(new List <string>
                {
                    M.MenuTitle,
                    String.Join(" ", M.MenuItemParameters.Select(P => "<" + P.Name.ToLower().Replace(" ", "_") + ">").ToList()),
                    M.MenuDescription
                });
            });
            menuItem.AdditionalOptions.ForEach(O =>
            {
                menu.Rows.Add(new List <string>
                {
                    O.Name,
                    String.Join(" ", O.Parameters.Select(P => "<" + P.Name.ToLower().Replace(" ", "_") + ">")),
                    O.Description
                });
            });
            menu.Print();
        }
示例#2
0
 public override void Command(MenuItem menuItem, string UserInput)
 {
     try
     {
         menuItem.Refresh();
         List <CovenantUser> Users = ((UsersMenuItem)menuItem).Users;
         EliteConsoleMenu    menu  = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Users");
         menu.Columns.Add("Username");
         menu.Columns.Add("Roles");
         menu.Columns.Add("Status");
         Users.ForEach(U =>
         {
             var userRoles       = this.CovenantClient.ApiUsersByIdRolesGet(U.Id).ToList();
             List <string> roles = new List <string>();
             foreach (var userRole in userRoles)
             {
                 IdentityRole role = this.CovenantClient.ApiRolesByRidGet(userRole.RoleId);
                 if (role != null)
                 {
                     roles.Add(role.Name);
                 }
             }
             menu.Rows.Add(new List <string> {
                 U.UserName, String.Join(", ", roles), "Active"
             });
         });
         menu.Print();
     }
     catch (HttpOperationException e)
     {
         EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content);
     }
 }
示例#3
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            try
            {
                menuItem.Refresh();
                Listener          listener    = ((HostedFilesMenuItem)menuItem).Listener;
                List <HostedFile> HostedFiles = ((HostedFilesMenuItem)menuItem).HostedFiles;

                EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "HostedFiles");
                menu.Columns.Add("Listener");
                menu.Columns.Add("Address");
                menu.Columns.Add("Path");
                HostedFiles.ForEach(HF =>
                {
                    menu.Rows.Add(new List <string> {
                        listener.Name, listener.ConnectAddress, HF.Path
                    });
                });
                menu.Print();
            }
            catch (HttpOperationException e)
            {
                EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content);
            }
        }
示例#4
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            TaskMenuItem taskMenuItem = (TaskMenuItem)menuItem;

            // Refresh the task object
            taskMenuItem.task = this.CovenantClient.ApiGruntTasksByIdGet(taskMenuItem.task.Id ?? default);
            GruntTask task = taskMenuItem.task;

            EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, "Task: " + task.Name);

            menu.Rows.Add(new List <string> {
                "Name:", task.Name
            });
            menu.Rows.Add(new List <string> {
                "Description:", task.Description
            });
            menu.Rows.Add(new List <string> {
                "ReferenceAssemblies:", task.ReferenceAssemblies
            });
            task.Options.ToList().ForEach(O =>
            {
                menu.Rows.Add(new List <string> {
                    O.Name + ":", O.Value
                });
            });
            menu.Print();
        }
示例#5
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            UsersMenuItem usersMenuItem = (UsersMenuItem)menuItem;

            usersMenuItem.Refresh();
            EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Users");

            menu.Columns.Add("Username");
            menu.Columns.Add("Roles");
            menu.Columns.Add("Status");
            usersMenuItem.Users.ForEach(U =>
            {
                var userRoles       = this.CovenantClient.ApiUsersByUidRolesGet(U.Id).ToList();
                List <string> roles = new List <string>();
                foreach (var userRole in userRoles)
                {
                    IdentityRole role = CovenantClient.ApiRolesByRidGet(userRole.RoleId);
                    if (role != null)
                    {
                        roles.Add(role.Name);
                    }
                }
                menu.Rows.Add(new List <string> {
                    U.UserName, String.Join(", ", roles), "Active"
                });
            });
            menu.Print();
        }
示例#6
0
 public override void Command(MenuItem menuItem, string UserInput)
 {
     try
     {
         menuItem.Refresh();
         Listener         listener     = ((ListenerInteractMenuItem)menuItem).Listener;
         ListenerType     listenerType = ((ListenerInteractMenuItem)menuItem).ListenerType;
         EliteConsoleMenu menu         = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, listenerType.Name + " Listener: " + listener.Name);
         switch (listenerType.Name)
         {
         case "HTTP":
             HttpListener httpListener = ((ListenerInteractMenuItem)menuItem).HttpListener;
             HttpProfile  httpProfile  = ((ListenerInteractMenuItem)menuItem).HttpProfile;
             menu.Rows.Add(new List <string> {
                 "Name:", httpListener.Name
             });
             menu.Rows.Add(new List <string> {
                 "Status:", httpListener.Status.ToString()
             });
             menu.Rows.Add(new List <string> {
                 "StartTime:", httpListener.StartTime.ToString()
             });
             menu.Rows.Add(new List <string> {
                 "Description:", httpListener.Description
             });
             menu.Rows.Add(new List <string> {
                 "URL:", httpListener.Url
             });
             menu.Rows.Add(new List <string> {
                 "  ConnectAddress:", httpListener.ConnectAddress
             });
             menu.Rows.Add(new List <string> {
                 "  BindAddress:", httpListener.BindAddress
             });
             menu.Rows.Add(new List <string> {
                 "  BindPort:", httpListener.BindPort.ToString()
             });
             menu.Rows.Add(new List <string> {
                 "  UseSSL:", (httpListener.UseSSL ?? default) ? "True" : "False"
             });
             menu.Rows.Add(new List <string> {
                 "SSLCertPath:", ((ListenerInteractMenuItem)menuItem).SSLCertPath
             });
             menu.Rows.Add(new List <string> {
                 "SSLCertPassword:"******"SSLCertHash:", httpListener.SslCertHash
             });
             menu.Rows.Add(new List <string> {
                 "HttpProfile:", httpProfile.Name
             });
             break;
         }
         menu.Print();
     }
示例#7
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            List <Launcher>  launchers = this.CovenantClient.ApiLaunchersGet().ToList();
            EliteConsoleMenu menu      = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Launchers");

            menu.Columns.Add("Name");
            menu.Columns.Add("Description");
            launchers.ForEach(L =>
            {
                menu.Rows.Add(new List <string> {
                    L.Name, L.Description
                });
            });
            menu.Print();
        }
示例#8
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            Listener          listener    = ((HostedFilesMenuItem)menuItem).Listener;
            List <HostedFile> hostedFiles = this.CovenantClient.ApiListenersByIdHostedfilesGet(listener.Id ?? default).ToList();

            EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "HostedFiles");

            menu.Columns.Add("Listener");
            // menu.Columns.Add("HostUri");
            menu.Columns.Add("Path");
            hostedFiles.ForEach(HF =>
            {
                menu.Rows.Add(new List <string> {
                    listener.Name, HF.Path
                });
            });
            menu.Print();
        }
示例#9
0
 public override void Command(MenuItem menuItem, string UserInput)
 {
     try
     {
         List <Launcher>  launchers = this.CovenantClient.ApiLaunchersGet().ToList();
         EliteConsoleMenu menu      = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Launchers");
         menu.Columns.Add("Name");
         menu.Columns.Add("Description");
         launchers.ForEach(L =>
         {
             menu.Rows.Add(new List <string> {
                 L.Name, L.Description
             });
         });
         menu.Print();
     }
     catch (HttpOperationException e)
     {
         EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content);
     }
 }
示例#10
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            menuItem.Refresh();
            List <Listener>     Listeners     = ((ListenersMenuItem)menuItem).Listeners;
            List <ListenerType> ListenerTypes = ((ListenersMenuItem)menuItem).ListenerTypes;

            EliteConsoleMenu typeMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Listener Types");

            typeMenu.Columns.Add("ListenerName");
            typeMenu.Columns.Add("Description");
            ListenerTypes.ToList().ForEach(L =>
            {
                typeMenu.Rows.Add(new List <string> {
                    L.Name, L.Description
                });
            });
            typeMenu.PrintEndBuffer = false;
            typeMenu.Print();

            EliteConsoleMenu instanceMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Active Listeners");

            instanceMenu.Columns.Add("Name");
            instanceMenu.Columns.Add("TypeName");
            instanceMenu.Columns.Add("Status");
            instanceMenu.Columns.Add("StartTime");
            instanceMenu.Columns.Add("BindAddress");
            instanceMenu.Columns.Add("BindPort");
            Listeners.ToList().ForEach(L =>
            {
                instanceMenu.Rows.Add(new List <string> {
                    L.Name,
                    ListenerTypes.FirstOrDefault(LT => LT.Id == L.ListenerTypeId).Name,
                    L.Status.ToString(),
                    L.StartTime.ToString(),
                    L.BindAddress,
                    L.BindPort.ToString()
                });
            });
            instanceMenu.Print();
        }
示例#11
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            GruntsMenuItem gruntsMenuItem = (GruntsMenuItem)menuItem;

            gruntsMenuItem.ValidateMenuParameters();
            List <Grunt>     displayGrunts = gruntsMenuItem.Grunts.Where(G => G.Status != GruntStatus.Uninitialized && !gruntsMenuItem.HiddenGruntNames.Contains(G.Name)).ToList();
            EliteConsoleMenu menu          = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Grunts");

            menu.Columns.Add("Name");
            menu.Columns.Add("User");
            menu.Columns.Add("Integrity");
            menu.Columns.Add("ComputerName");
            menu.Columns.Add("OperatingSystem");
            menu.Columns.Add("Process");
            menu.Columns.Add("Status");
            menu.Columns.Add("Last Check In");
            displayGrunts.ForEach(G =>
            {
                menu.Rows.Add(new List <string> {
                    G.Name, G.UserDomainName + "\\" + G.UserName, G.Integrity.ToString(), G.IpAddress, G.OperatingSystem, G.Process, G.Status.ToString(), G.LastCheckIn
                });
            });
            menu.Print();
        }
示例#12
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            menuItem.Refresh();
            IndicatorsMenuItem indicatorsMenu       = ((IndicatorsMenuItem)menuItem);
            EliteConsoleMenu   targetIndicatorsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Target Indicators");

            targetIndicatorsMenu.Columns.Add("Name");
            targetIndicatorsMenu.Columns.Add("ComputerName");
            targetIndicatorsMenu.Columns.Add("UserName");
            indicatorsMenu.TargetIndicators.ToList().ForEach(TI =>
            {
                targetIndicatorsMenu.Rows.Add(new List <string> {
                    TI.Name,
                    TI.ComputerName,
                    TI.UserName
                });
            });
            if (targetIndicatorsMenu.Rows.Count > 0)
            {
                targetIndicatorsMenu.PrintEndBuffer = false;
                targetIndicatorsMenu.Print();
            }

            EliteConsoleMenu networkIndicatorsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Network Indicators");

            networkIndicatorsMenu.Columns.Add("Name");
            networkIndicatorsMenu.Columns.Add("Protocol");
            networkIndicatorsMenu.Columns.Add("Domain");
            networkIndicatorsMenu.Columns.Add("IPAddress");
            networkIndicatorsMenu.Columns.Add("Port");
            networkIndicatorsMenu.Columns.Add("URI");

            indicatorsMenu.NetworkIndicators.ToList().ForEach(NI =>
            {
                networkIndicatorsMenu.Rows.Add(new List <string> {
                    NI.Name,
                    NI.Protocol,
                    NI.Domain,
                    NI.IpAddress,
                    NI.Port.ToString(),
                    NI.Uri
                });
            });
            if (networkIndicatorsMenu.Rows.Count > 0)
            {
                networkIndicatorsMenu.PrintEndBuffer = false;
                networkIndicatorsMenu.Print();
            }

            EliteConsoleMenu fileIndicatorsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "File Indicators");

            fileIndicatorsMenu.Columns.Add("Name");
            fileIndicatorsMenu.Columns.Add("FileName");
            fileIndicatorsMenu.Columns.Add("FilePath");
            fileIndicatorsMenu.Columns.Add("SHA2");
            fileIndicatorsMenu.Columns.Add("SHA1");
            fileIndicatorsMenu.Columns.Add("MD5");
            indicatorsMenu.FileIndicators.ToList().ForEach(FI =>
            {
                fileIndicatorsMenu.Rows.Add(new List <string> {
                    FI.Name,
                    FI.FileName,
                    FI.FilePath,
                    FI.ShA2,
                    FI.ShA1,
                    FI.MD5
                });
            });
            if (fileIndicatorsMenu.Rows.Count > 0)
            {
                fileIndicatorsMenu.Print();
            }
        }
示例#13
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            menuItem.Refresh();
            CredentialsMenuItem credentialsMenu         = ((CredentialsMenuItem)menuItem);
            EliteConsoleMenu    passwordCredentialsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Password Credentials");

            passwordCredentialsMenu.Columns.Add("Domain");
            passwordCredentialsMenu.Columns.Add("Username");
            passwordCredentialsMenu.Columns.Add("Password");
            credentialsMenu.PasswordCredentials.ToList().ForEach(PC =>
            {
                passwordCredentialsMenu.Rows.Add(new List <string> {
                    PC.Domain,
                    PC.Username,
                    PC.Password
                });
            });
            if (passwordCredentialsMenu.Rows.Count > 0)
            {
                passwordCredentialsMenu.PrintEndBuffer = false;
                passwordCredentialsMenu.Print();
            }

            EliteConsoleMenu hashCredentialsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Hashed Credentials");

            hashCredentialsMenu.Columns.Add("Domain");
            hashCredentialsMenu.Columns.Add("Username");
            hashCredentialsMenu.Columns.Add("Hash");
            hashCredentialsMenu.Columns.Add("HashType");
            credentialsMenu.HashCredentials.ToList().ForEach(HC =>
            {
                hashCredentialsMenu.Rows.Add(new List <string> {
                    HC.Domain,
                    HC.Username,
                    HC.Hash,
                    HC.HashCredentialType.ToString()
                });
            });
            if (hashCredentialsMenu.Rows.Count > 0)
            {
                hashCredentialsMenu.PrintEndBuffer = false;
                hashCredentialsMenu.Print();
            }

            EliteConsoleMenu ticketCredentialsMenu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.List, "Ticket Credentials");

            ticketCredentialsMenu.Columns.Add("ID");
            ticketCredentialsMenu.Columns.Add("Domain");
            ticketCredentialsMenu.Columns.Add("Username");
            ticketCredentialsMenu.Columns.Add("ServiceName");
            ticketCredentialsMenu.Columns.Add("Ticket");
            ticketCredentialsMenu.Columns.Add("TicketType");
            credentialsMenu.TicketCredentials.ToList().ForEach(TC =>
            {
                ticketCredentialsMenu.Rows.Add(new List <string> {
                    TC.Id.ToString(),
                    TC.Domain,
                    TC.Username,
                    TC.ServiceName,
                    TC.Ticket,
                    TC.TicketCredentialType.ToString()
                });
            });
            if (ticketCredentialsMenu.Rows.Count > 0)
            {
                ticketCredentialsMenu.Print();
            }
        }
示例#14
0
        public override void Command(MenuItem menuItem, string UserInput)
        {
            try
            {
                menuItem.Refresh();
                GruntTask task = ((TaskMenuItem)menuItem).Task;

                EliteConsoleMenu menu = new EliteConsoleMenu(EliteConsoleMenu.EliteConsoleMenuType.Parameter, "Task: " + task.Name)
                {
                    ShouldShortenFields = false
                };
                menu.Rows.Add(new List <string> {
                    "Name:", task.Name
                });
                menu.Rows.Add(new List <string> {
                    "Description:", task.Description
                });
                if (task.ReferenceAssemblies.Any())
                {
                    menu.Rows.Add(new List <string> {
                        "ReferenceAssemblies:", String.Join(",", task.ReferenceAssemblies)
                    });
                }
                if (task.ReferenceSourceLibraries.Any())
                {
                    menu.Rows.Add(new List <string> {
                        "ReferenceSourceLibraries:", String.Join(",", task.ReferenceSourceLibraries)
                    });
                }
                if (task.EmbeddedResources.Any())
                {
                    menu.Rows.Add(new List <string> {
                        "EmbeddedResources:", String.Join(",", task.EmbeddedResources)
                    });
                }
                // string usage = "Usage: " + task.Name;
                // foreach (GruntTaskOption o in task.Options)
                // {
                //     usage += " <" + o.Name.ToLower() + ">";
                // }
                // menu.Rows.Add(new List<string> { "Usage:", usage });
                if (task.Options.Any())
                {
                    foreach (GruntTaskOption o in task.Options)
                    {
                        menu.Rows.Add(new List <string> {
                            "Parameter:"
                        });
                        menu.Rows.Add(new List <string> {
                            "  Name:", o.Name
                        });
                        menu.Rows.Add(new List <string> {
                            "  Description:", o.Description
                        });
                        menu.Rows.Add(new List <string> {
                            "  Value:", o.Value
                        });
                    }
                }
                menu.Print();
            }
            catch (HttpOperationException e)
            {
                EliteConsole.PrintFormattedWarningLine("CovenantException: " + e.Response.Content);
            }
        }