예제 #1
0
        public void cmdJobs(string args)
        {
            if (JobCollection.Current.Count <= 0)
            {
                _IO.WriteInfo(Lang.Get("Nothing_To_Show"));
                return;
            }

            CommandTable tb = new CommandTable();

            _IO.WriteLine("");

            tb.AddRow(tb.AddRow(Lang.Get("Id"), Lang.Get("Status"), Lang.Get("Module")).MakeSeparator());

            foreach (Job j in JobCollection.Current)
            {
                CommandTableRow row;
                if (j.IsRunning)
                {
                    row              = tb.AddRow(j.Id.ToString(), Lang.Get("Running"), j.FullPathModule);
                    row[0].Align     = CommandTableCol.EAlign.Right;
                    row[1].ForeColor = ConsoleColor.Green;
                }
                else
                {
                    row              = tb.AddRow(j.Id.ToString(), Lang.Get("Dead"), j.FullPathModule);
                    row[0].Align     = CommandTableCol.EAlign.Right;
                    row[1].ForeColor = ConsoleColor.Red;
                }
            }

            tb.OutputColored(_IO);
            _IO.WriteLine("");
        }
예제 #2
0
        public void cmdSearch(string args)
        {
            args = args.Trim().ToLowerInvariant();


            string[] pars = ArgumentHelper.ArrayFromCommandLine(args);
            if (pars != null && pars.Length > 0)
            {
                CommandTable tb = new CommandTable();

                bool primera1 = false;
                foreach (Module m in ModuleCollection.Current.Search(pars))
                {
                    if (!primera1)
                    {
                        if (tb.Count > 0)
                        {
                            tb.AddRow("", "", "");
                        }
                        CommandTableRow row = tb.AddRow(Lang.Get("Type"), Lang.Get("Path"), Lang.Get("Disclosure"));
                        tb.AddRow(row.MakeSeparator());
                        tb.AddRow("", "", "");
                        primera1 = true;
                    }

                    tb.AddRow(Lang.Get("Modules"), m.FullPath, m.DisclosureDate.ToShortDateString());
                }
                bool primera2 = false;
                foreach (IModule m in PayloadCollection.Current.Search(pars))
                {
                    if (!primera2)
                    {
                        if (tb.Count > 0)
                        {
                            tb.AddRow("", "", "");
                        }
                        CommandTableRow row = tb.AddRow(Lang.Get("Type"), Lang.Get("Path"), "");
                        tb.AddRow(row.MakeSeparator());
                        tb.AddRow("", "", "");
                        primera2 = true;
                    }

                    tb.AddRow(Lang.Get("Payload"), m.FullPath, "");
                }

                if (primera1 || primera2)
                {
                    tb.OutputColored(_IO);
                }
                else
                {
                    _IO.WriteInfo(Lang.Get("Nothing_To_Show"));
                }
            }
            else
            {
                _IO.WriteInfo(Lang.Get("Be_More_Specific"));
            }
        }
예제 #3
0
 public void WriteTable(CommandTable table)
 {
     if (_IO == null)
     {
         return;
     }
     table.OutputColored(_IO);
 }
예제 #4
0
        public void cmdLoad(string args)
        {
            if (string.IsNullOrEmpty(args))
            {
                _IO.WriteError(Lang.Get("Incorrect_Command_Usage"));
                return;
            }
            args = args.Trim();
            if (!File.Exists(args))
            {
                _IO.WriteError(Lang.Get("File_Not_Exists", args));
                return;
            }

            try
            {
                _IO.SetForeColor(ConsoleColor.Gray);
                _IO.Write(Lang.Get("Reading_File", args));

                Assembly.Load(File.ReadAllBytes(args));
                //Assembly.LoadFile(args);

                _IO.SetForeColor(ConsoleColor.Green);
                _IO.WriteLine(Lang.Get("Ok").ToUpperInvariant());
            }
            catch
            {
                _IO.SetForeColor(ConsoleColor.Red);
                _IO.WriteLine(Lang.Get("Error").ToUpperInvariant());
            }
            CommandTable tb = new CommandTable();

            _IO.WriteLine("");

            tb.AddRow(tb.AddRow(Lang.Get("Type"), Lang.Get("Count")).MakeSeparator());

            tb.AddRow(Lang.Get("Modules"), ModuleCollection.Current.Load().ToString())[1].Align   = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Payloads"), PayloadCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Encoders"), EncoderCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Nops"), NopCollection.Current.Load().ToString())[1].Align         = CommandTableCol.EAlign.Right;

            tb.OutputColored(_IO);
            _IO.WriteLine("");
        }
예제 #5
0
        static void DisplayAvailableCommands(CommandMenuItem menu, bool inner)
        {
            if (menu == null)
            {
                throw new ArgumentNullException("menu");
            }

            CommandTable tb = new CommandTable();

            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Available_Commands") + ":");
                menu.IO.WriteLine("");

                tb.AddRow(tb.AddRow(Lang.Get("Short"), Lang.Get("Command")).MakeSeparator());
            }

            bool entra         = false;
            var  abbreviations = menu.CommandAbbreviations().OrderBy(it => it.Key);

            foreach (var ab in abbreviations)
            {
                CommandTableRow row = tb.AddRow(ab.Value, ab.Key);
                row[0].Align     = CommandTableCol.EAlign.Right;
                row[0].ForeColor = ConsoleColor.Yellow;

                entra = true;
            }

            if (entra)
            {
                tb.OutputColored(menu.IO);
            }
            if (!inner)
            {
                menu.IO.WriteLine(Lang.Get("Type_Help"));
            }
        }
예제 #6
0
        public void cmdSearch(string args)
        {
            args = args.Trim().ToLowerInvariant();


            string[] pars = ArgumentHelper.ArrayFromCommandLine(args);
            if (pars != null && pars.Length > 0)
            {
                CommandTable tb = new CommandTable();

                bool primera1 = false;
                foreach (Module m in ModuleCollection.Current.Search(pars))
                {
                    if (!primera1)
                    {
                        if (tb.Count > 0) tb.AddRow("", "", "");
                        CommandTableRow row = tb.AddRow(Lang.Get("Type"), Lang.Get("Path"), Lang.Get("Disclosure"));
                        tb.AddRow(row.MakeSeparator());
                        tb.AddRow("", "", "");
                        primera1 = true;
                    }

                    tb.AddRow(Lang.Get("Modules"), m.FullPath, m.DisclosureDate.ToShortDateString());
                }
                bool primera2 = false;
                foreach (IModule m in PayloadCollection.Current.Search(pars))
                {
                    if (!primera2)
                    {
                        if (tb.Count > 0) tb.AddRow("", "", "");
                        CommandTableRow row = tb.AddRow(Lang.Get("Type"), Lang.Get("Path"), "");
                        tb.AddRow(row.MakeSeparator());
                        tb.AddRow("", "", "");
                        primera2 = true;
                    }

                    tb.AddRow(Lang.Get("Payload"), m.FullPath, "");
                }

                if (primera1 || primera2)
                    tb.OutputColored(_IO);
                else
                    _IO.WriteInfo(Lang.Get("Nothing_To_Show"));
            }
            else
            {
                _IO.WriteInfo(Lang.Get("Be_More_Specific"));
            }
        }
예제 #7
0
        public void cmdInfo(string args)
        {
            if (!CheckModule(false, EModuleType.None)) return;
            args = args.Trim().ToLowerInvariant();

            Module curM = _Current.ModuleType == EModuleType.Module ? (Module)_Current : null;

            CommandTable tb = new CommandTable();

            tb.AddRow(Lang.Get("Path"), _Current.Path, "")[0].ForeColor = ConsoleColor.DarkGray;
            tb.AddRow(Lang.Get("Name"), _Current.Name, "")[0].ForeColor = ConsoleColor.DarkGray;

            tb.AddRow("", "", "");

            if (!string.IsNullOrEmpty(_Current.Author))
            {
                CommandTableRow row = tb.AddRow(1, Lang.Get("Author"), _Current.Author, "");
                row[0].ForeColor = ConsoleColor.DarkGray;
                row[1].Align = CommandTableCol.EAlign.None;
                row[2].Align = CommandTableCol.EAlign.None;
            }

            if (curM != null)
            {
                if (curM.DisclosureDate != DateTime.MinValue) tb.AddRow(Lang.Get("DisclosureDate"), curM.DisclosureDate.ToString(), "")[0].ForeColor = ConsoleColor.DarkGray;
                tb.AddRow(Lang.Get("IsLocal"), curM.IsLocal.ToString(), "")[0].ForeColor = ConsoleColor.DarkGray;
                tb.AddRow(Lang.Get("IsRemote"), curM.IsRemote.ToString(), "")[0].ForeColor = ConsoleColor.DarkGray;

                if (curM.References != null && curM.References.Length > 0)
                {
                    tb.AddRow("", "", "");

                    StringBuilder sb = new StringBuilder();
                    foreach (Reference r in curM.References)
                    {
                        if (r == null) continue;
                        sb.AppendLine(r.Type.ToString() + " - " + r.Value);
                    }

                    foreach (CommandTableRow row in tb.AddSplitRow(1, Lang.Get("References"), sb.ToString(), ""))
                    {
                        row[0].ForeColor = ConsoleColor.DarkGray;
                        row[1].Align = CommandTableCol.EAlign.None;
                        row[2].Align = CommandTableCol.EAlign.None;
                    }
                }
            }

            if (!string.IsNullOrEmpty(_Current.Description))
            {
                foreach (CommandTableRow row in tb.AddSplitRow(1, Lang.Get("Description"), _Current.Description, ""))
                {
                    row[0].ForeColor = ConsoleColor.DarkGray;
                    row[1].Align = CommandTableCol.EAlign.None;
                    row[2].Align = CommandTableCol.EAlign.None;
                }
            }
            tb.OutputColored(_IO);
        }
예제 #8
0
        public void cmdLoad(string args)
        {
            if (string.IsNullOrEmpty(args))
            {
                _IO.WriteError(Lang.Get("Incorrect_Command_Usage"));
                return;
            }
            args = args.Trim();
            if (!File.Exists(args))
            {
                _IO.WriteError(Lang.Get("File_Not_Exists", args));
                return;
            }

            try
            {
                _IO.SetForeColor(ConsoleColor.Gray);
                _IO.Write(Lang.Get("Reading_File", args));

                Assembly.Load(File.ReadAllBytes(args));
                //Assembly.LoadFile(args);

                _IO.SetForeColor(ConsoleColor.Green);
                _IO.WriteLine(Lang.Get("Ok").ToUpperInvariant());
            }
            catch
            {
                _IO.SetForeColor(ConsoleColor.Red);
                _IO.WriteLine(Lang.Get("Error").ToUpperInvariant());
            }
            CommandTable tb = new CommandTable();

            _IO.WriteLine("");

            tb.AddRow(tb.AddRow(Lang.Get("Type"), Lang.Get("Count")).MakeSeparator());

            tb.AddRow(Lang.Get("Modules"), ModuleCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Payloads"), PayloadCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Encoders"), EncoderCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;
            tb.AddRow(Lang.Get("Nops"), NopCollection.Current.Load().ToString())[1].Align = CommandTableCol.EAlign.Right;

            tb.OutputColored(_IO);
            _IO.WriteLine("");
        }
예제 #9
0
        public void cmdJobs(string args)
        {
            if (JobCollection.Current.Count <= 0)
            {
                _IO.WriteInfo(Lang.Get("Nothing_To_Show"));
                return;
            }

            CommandTable tb = new CommandTable();

            _IO.WriteLine("");

            tb.AddRow(tb.AddRow(Lang.Get("Id"), Lang.Get("Status"), Lang.Get("Module")).MakeSeparator());

            foreach (Job j in JobCollection.Current)
            {
                CommandTableRow row;
                if (j.IsRunning)
                {
                    row = tb.AddRow(j.Id.ToString(), Lang.Get("Running"), j.FullPathModule);
                    row[0].Align = CommandTableCol.EAlign.Right;
                    row[1].ForeColor = ConsoleColor.Green;
                }
                else
                {
                    row = tb.AddRow(j.Id.ToString(), Lang.Get("Dead"), j.FullPathModule);
                    row[0].Align = CommandTableCol.EAlign.Right;
                    row[1].ForeColor = ConsoleColor.Red;
                }
            }

            tb.OutputColored(_IO);
            _IO.WriteLine("");
        }
예제 #10
0
        public void cmdInfo(string args)
        {
            if (!CheckModule(false, EModuleType.None))
            {
                return;
            }
            args = args.Trim().ToLowerInvariant();

            Module curM = _Current.ModuleType == EModuleType.Module ? (Module)_Current : null;

            CommandTable tb = new CommandTable();

            tb.AddRow(Lang.Get("Path"), _Current.ModulePath, "")[0].ForeColor = ConsoleColor.DarkGray;
            tb.AddRow(Lang.Get("Name"), _Current.Name, "")[0].ForeColor       = ConsoleColor.DarkGray;

            tb.AddRow("", "", "");

            ModuleInfoAttribute mInfo = _Current == null ? null : _Current.GetType().GetCustomAttribute <ModuleInfoAttribute>();

            if (mInfo != null && !string.IsNullOrEmpty(mInfo.Author))
            {
                CommandTableRow row = tb.AddRow(1, Lang.Get("Author"), mInfo.Author, "");
                row[0].ForeColor = ConsoleColor.DarkGray;
                row[1].Align     = CommandTableCol.EAlign.None;
                row[2].Align     = CommandTableCol.EAlign.None;
            }

            if (curM != null)
            {
                if (curM.DisclosureDate != DateTime.MinValue)
                {
                    tb.AddRow(Lang.Get("DisclosureDate"), curM.DisclosureDate.ToString(), "")[0].ForeColor = ConsoleColor.DarkGray;
                }

                if (curM.References != null && curM.References.Length > 0)
                {
                    tb.AddRow("", "", "");

                    StringBuilder sb = new StringBuilder();
                    foreach (Reference r in curM.References)
                    {
                        if (r == null)
                        {
                            continue;
                        }
                        sb.AppendLine(r.Type.ToString() + " - " + r.Value);
                    }

                    foreach (CommandTableRow row in tb.AddSplitRow(1, Lang.Get("References"), sb.ToString(), ""))
                    {
                        row[0].ForeColor = ConsoleColor.DarkGray;
                        row[1].Align     = CommandTableCol.EAlign.None;
                        row[2].Align     = CommandTableCol.EAlign.None;
                    }
                }
            }

            if (mInfo != null && !string.IsNullOrEmpty(mInfo.Description))
            {
                foreach (CommandTableRow row in tb.AddSplitRow(1, Lang.Get("Description"), mInfo.Description, ""))
                {
                    row[0].ForeColor = ConsoleColor.DarkGray;
                    row[1].Align     = CommandTableCol.EAlign.None;
                    row[2].Align     = CommandTableCol.EAlign.None;
                }
            }
            tb.OutputColored(_IO);
        }