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 (35 lines) | stat: -rwxr-xr-x 948 bytes parent folder | download
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
28
29
30
31
32
33
34
35
#!/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");
#  my($SOCKET) = new IO::Socket::SSL( Proto   => "tcp",
#                                     PeerAddr=> "127.0.0.1:443");
  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", $_;
}
for(0..50) {
	request "b.site", "/", $_;
}
for(0..100) {
	request "a.site", "/whitelisted-uri", $_;
}
print "done.\n"