package Apache::Inject::Handler; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestUtil (); use Apache2::Const qw/OK DECLINED/; my $doc = qr{ (? \s* # common way to trigger quirks mode (]*>)? \s* ( ]*>.*? \s* | ( ]*>.*? \s* | ]*> \s* | ]*> \s* | ]*> \s* | ]*>.*? \s* | ]*>.*? \s* # n.b. | ]*>.*? \s* # n.b. | ]*>.*? \s* # 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} if $+{head}; print "Injection 1\n"; print $+{body}; print "Injection 2\n"; return OK; } 1;