Ejemplo n.º 1
0
        public void OutputColored(CommandLayer io)
        {
            string separator = Separator;

            foreach (CommandTableRow row in this)
            {
                foreach (CommandTableCol col in row)
                {
                    io.SetForeColor(col.ForeColor);

                    if (col.Index != 0)
                    {
                        io.Write(separator);
                    }
                    io.Write(col.GetFormatedValue());
                }
                io.WriteLine("");
            }
        }
Ejemplo n.º 2
0
        void OnPrompt(CommandLayer sender)
        {
            sender.SetForeColor(ConsoleColor.Green);

            if (_Current != null)
            {
                sender.SetForeColor(ConsoleColor.DarkGreen);
                sender.Write(Lang.Get(_Current.ModuleType.ToString()) + "(");
                sender.SetForeColor(ConsoleColor.Green);
                sender.Write(_Current.Name);
                sender.SetForeColor(ConsoleColor.DarkGreen);
                sender.Write(")");
                sender.SetForeColor(ConsoleColor.Green);
                sender.Write("> ");
            }
            else
            {
                sender.Write("> ");
            }

            sender.SetForeColor(ConsoleColor.White);
        }
Ejemplo n.º 3
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("");
        }
Ejemplo n.º 4
0
 void OnPrompt(CommandLayer sender)
 {
     sender.SetForeColor(_PromptColor);
     sender.Write(PromptCharacter);
     sender.SetForeColor(_ClientColor);
 }
Ejemplo n.º 5
0
        public static void GetNyanCatBanner(CommandLayer command)
        {
            //1
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 80));
            command.WriteLine(StringHelper.Replicate(" ", 80));
            command.WriteLine(StringHelper.Replicate(" ", 80));
            //2
            command.SetBackgroundColor(ConsoleColor.Red);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 30));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 24));
            //3
            command.SetBackgroundColor(ConsoleColor.Red);
            command.Write(StringHelper.Replicate(" ", 24));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 30));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 22));
            //4
            command.SetBackgroundColor(ConsoleColor.DarkYellow);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Red);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 22));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 20));
            //5
            command.SetBackgroundColor(ConsoleColor.DarkYellow);
            command.Write(StringHelper.Replicate(" ", 22));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 6));

            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 14));

            //6
            command.SetBackgroundColor(ConsoleColor.DarkYellow);
            command.Write(StringHelper.Replicate(" ", 22));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));

            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 12));
            //7
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.DarkYellow);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 6));

            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 12));
            //8
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 12));
            //9
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 22));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 12));
            //10
            command.SetBackgroundColor(ConsoleColor.Green);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Yellow);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 26));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 10));
            //11
            command.SetBackgroundColor(ConsoleColor.Green);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));

            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 10));
            //12
            command.SetBackgroundColor(ConsoleColor.Green);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));

            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Black);
            //13
            command.SetBackgroundColor(ConsoleColor.Cyan);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Green);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Black);
            //14
            command.SetBackgroundColor(ConsoleColor.Cyan);
            command.Write(StringHelper.Replicate(" ", 22));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.DarkMagenta);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            //15
            command.SetBackgroundColor(ConsoleColor.DarkCyan);
            command.Write(StringHelper.Replicate(" ", 10));
            command.SetBackgroundColor(ConsoleColor.Cyan);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Cyan);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Magenta);
            command.Write(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 18));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 14));
            command.SetBackgroundColor(ConsoleColor.Black);
            //16
            command.SetBackgroundColor(ConsoleColor.DarkCyan);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 20));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 18));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            //17
            command.SetBackgroundColor(ConsoleColor.DarkCyan);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 32));

            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 20));
            //18
            //command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));

            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.DarkGray);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 20));
            //19
            //command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 8));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 6));

            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 4));
            command.SetBackgroundColor(ConsoleColor.Black);
            command.Write(StringHelper.Replicate(" ", 6));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 20));
            //20
            //command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 16));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 62));
            //20
            //command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.Write(StringHelper.Replicate(" ", 12));
            command.SetBackgroundColor(ConsoleColor.White);
            command.Write(StringHelper.Replicate(" ", 2));
            command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 66));
            //21
            //command.SetBackgroundColor(ConsoleColor.DarkBlue);
            command.WriteLine(StringHelper.Replicate(" ", 80));

            command.SetBackgroundColor(ConsoleColor.Black);
        }
Ejemplo n.º 6
0
        static int Main(string[] args)
        {
            // hacer load, reload, probar el global con payload, hacer el listen general con un handler, no cargar exploits sin el load

            // Linq to library assembly
            BuildLink.Dummy();

            // Configure
            //Console.InputEncoding = Encoding.UTF8;
            //Console.OutputEncoding = Encoding.UTF8;
            using (CommandLayer command = new CommandLayer(new ConsoleIO()))
            {
                command.SetBackgroundColor(ConsoleColor.White);
                command.SetBackgroundColor(ConsoleColor.Black);

                command.AddInput("banner");
#if DEBUG
                if (Debugger.IsAttached)
                {
                    command.AddInput("Play Debug.txt");
                }
#endif

                if (GeoLite2LocationProvider.Current == null)
                {
                    /// TODO: Config the default GeoIp
                    if (GeoLite2LocationProvider.LoadCurrent(
                            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"GeoLite2", "GeoLite2-Blocks-IP.csv.gz"),
                            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"GeoLite2", "GeoLite2-City-Locations-es.csv.gz")))
                    {
                        command.WriteInfo("Loaded GeoIp", GeoLite2LocationProvider.Current.Count.ToString(), ConsoleColor.Green);
                    }
                }

                // TODO: Fix \"CryptKey=#Crypt0 M3#\" -> broken line whith white space
                // \"CryptKey=#Crypt0M3#\"
                Config cfg = ArgumentHelper.Parse <Config>(args);// ("\"Replay=d:\\temp\\console.txt\" \"Listen={Port=23 CryptKey=#Test# IPFilter={OnlyAllowed=127.0.0.1,172.22.32.51}}\" \"User={UserName=root Password=toor}\"");

                // Run file
                if (!string.IsNullOrEmpty(cfg.Play))
                {
                    try
                    {
                        command.SetForeColor(ConsoleColor.Gray);
                        command.Write(Lang.Get("Reading_File", cfg.Play));

                        foreach (string line in File.ReadAllLines(cfg.Play, Encoding.UTF8))
                        {
                            string ap = line.Trim();
                            if (string.IsNullOrEmpty(ap) || ap.StartsWith("#") || ap.StartsWith("//"))
                            {
                                continue;
                            }
                            command.AddInput(ap);
                        }

                        command.SetForeColor(ConsoleColor.Green);
                        command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                    }
                    catch
                    {
                        command.SetForeColor(ConsoleColor.Red);
                        command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                    }
                }

                if (cfg.Connect != null)
                {
                    // Connect to server
                    SocketListener client = new SocketListener(cfg.Connect);

                    command.SetForeColor(ConsoleColor.Gray);
                    command.Write(Lang.Get("Connecting_To", client.ToString()));
                    if (client.Start())
                    {
                        command.SetForeColor(ConsoleColor.Green);
                        command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                    }
                    else
                    {
                        command.SetForeColor(ConsoleColor.Red);
                        command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                    }

                    command.SetForeColor(ConsoleColor.DarkGray);
                    command.WriteLine(Lang.Get("Press_Any_Key"));

                    Console.ReadKey();
                }
                else
                {
                    List <IListener> listeners = new List <IListener>();

                    // Launch socket listener
                    if (cfg.Listen != null)
                    {
                        listeners.Add(new SocketListener(cfg.Listen));
                    }

                    // Run listeners
                    foreach (IListener listener in listeners)
                    {
                        command.SetForeColor(ConsoleColor.Gray);
                        command.Write(Lang.Get("Starting_Listener", listener.ToString()));

                        if (listener.Start())
                        {
                            command.SetForeColor(ConsoleColor.Green);
                            command.WriteLine(Lang.Get("Ok").ToUpperInvariant());
                        }
                        else
                        {
                            command.SetForeColor(ConsoleColor.Red);
                            command.WriteLine(Lang.Get("Error").ToUpperInvariant());
                        }
                    }

                    // Console listener
                    CommandListener cmd = new CommandListener(command);
                    cmd.Start();
                }
            }

            // Wait exit signal
            JobCollection.Current.KillAll();
            return(0);
        }