Esempio n. 1
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);
        }
Esempio n. 2
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);
        }