package Apache::Inject::Handler;
use strict;
use warnings;
use Apache2::RequestRec ();
use Apache2::RequestUtil ();
use Apache2::Const qw/OK DECLINED/;
my $doc = qr{
(?
*]>.*?
|
( ]*>.*?
| ]*>
| ]*>
| ]*>
|
| # n.b.
| # n.b.
| # n.b.!
)+ )
(? .* )
}xms;
sub handler {
my $r = shift;
return DECLINED if not $r->content_type eq 'text/html';
my $content = ${$r->slurp_filename};
return DECLINED if not $content =~ /$doc/;
print $+{head};
print "Injection 1\n";
print $+{body};
print "Injection 2\n";
return OK;
}
1;