File: test.pl

package info (click to toggle)
libapache-mod-evasive 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: ansic: 3,005; perl: 44; sh: 28; makefile: 8
file content (27 lines) | stat: -rwxr-xr-x 723 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

# test.pl: small script to test mod_evasive's effectiveness
# - requires https virtualhosts a.site and b.site to be setup, each with their own mod_evasive config

#use IO::Socket;
use IO::Socket::SSL;
use strict;

sub request {
  my($address,$uri,$i) = @_;
  my($response);
  my($SOCKET) = new IO::Socket::INET( Proto   => "tcp",
                                      PeerAddr=> "127.0.0.1:1980");
  if (! defined $SOCKET) { die $!; }
  print $SOCKET "GET $uri?$i HTTP/1.1\r\n";
  print $SOCKET "Host: $address\r\n\r\n";
  $response = <$SOCKET>;
	chomp $response;
  print "$i - $address: $response\n";
  close($SOCKET);
}

for(0..900) {
	request "a.site", "/j_spring_security_check", $_;
}
print "done.\n"