diff options
author | root <root@rbsd.ankarstrom.se> | 2021-04-23 00:45:02 +0000 |
---|---|---|
committer | root <root@rbsd.ankarstrom.se> | 2021-04-23 00:45:02 +0000 |
commit | bb8c79deb85b9982009a805c77676c35a33ed277 (patch) | |
tree | 9df237d189130ac0cda5e96646695ebd2d2a3cec | |
parent | f944b2592d581ddb7e6c7614ea3766328084b682 (diff) | |
download | Apache-Inject-bb8c79deb85b9982009a805c77676c35a33ed277.tar.gz |
Fix some bugs
-rw-r--r-- | Inject/Handler.pm | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Inject/Handler.pm b/Inject/Handler.pm index adeec57..98d4713 100644 --- a/Inject/Handler.pm +++ b/Inject/Handler.pm @@ -8,17 +8,20 @@ use Apache2::RequestUtil (); use Apache2::Const qw/OK DECLINED/; my $doc = qr{ - (?<head> <head[^>*]>.*?</head> - | - ( <title[^>]*>.*?</title> - | <base[^>]*> - | <meta[^>]*> - | <link[^>]*> - | <object[^>]*>.*?</object> - | <style[^>]*>.*?</style> # n.b. - | <script[^>]*>.*?</script> # n.b. - | <noscript[^>]*>.*?</noscript> # n.b.! - )+ ) + (?<head> \s* # common way to trigger quirks mode + (<!doctype[^>]*>)? \s* + ( <head[^>]*>.*?</head> \s* + | ( <title[^>]*>.*?</title> \s* + | <base[^>]*> \s* + | <meta[^>]*> \s* + | <link[^>]*> \s* + | <object[^>]*>.*?</object> \s* + | <style[^>]*>.*?</style> \s* # n.b. + | <script[^>]*>.*?</script> \s* # n.b. + | <noscript[^>]*>.*?</noscript> \s* # n.b.! + )+ + ) + )? (?<body> .* ) }xms; @@ -29,7 +32,7 @@ sub handler { my $content = ${$r->slurp_filename}; return DECLINED if not $content =~ /$doc/; - print $+{head}; + print $+{head} if $+{head}; print "Injection 1\n"; print $+{body}; print "Injection 2\n"; |