Inspired by Mike Cohen, I’ve written a quick Perl script that continually accesses an HTTP URL. It prints out a period every time it finishes loading a page so you can keep track of your abuse. It can also fork itself a specified number of times to be more efficient on broadband connections.

The script (which I’ve oh-so-originally named hit) really isn’t meant for use in DDoS or anything (use ping -f or something if you’re that 3vil l337), but it’s nice for swaying server logs. I’ve used it for two things so far…

  1. Giving my friend’s site a few extra hits just to make his day. I used ?hits_for_fun after the URL so as not to cause a 404.
  2. Spiting some spammers, which was the original idea. Added /LEAVE_US_ALONE to make sure I get into the error log.

Okay, so maybe it’s not one of the most morally upright Perl scripts ever written, but there ‘tis.


#!/usr/bin/perl

$e = shift;

if (!$e) {
	print STDERR "usage: hit url [strength]\n";
	exit(1);
}

$p = $n = shift;

while (--$n > 0 && $p) {
	$p = fork;
}

while (1) {
    # if you use sh or bash or the like, put a 2 before the >
    print `curl '$e' >& /dev/null`;
	print '.';
};
comments