From f944b2592d581ddb7e6c7614ea3766328084b682 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Apr 2021 00:29:32 +0000 Subject: First commit --- Inject/Handler.pm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Inject/Handler.pm (limited to 'Inject/Handler.pm') diff --git a/Inject/Handler.pm b/Inject/Handler.pm new file mode 100644 index 0000000..adeec57 --- /dev/null +++ b/Inject/Handler.pm @@ -0,0 +1,40 @@ +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; -- cgit v1.2.3