Posted to tcl by cgm at Mon Apr 08 06:59:53 GMT 2024view raw
- # Return crap when script kiddies request php etc. files
- package require httpd
- rename Doc_NotFound Doc_NotFound.orig
- proc Doc_NotFound sock {
- upvar #0 Httpd$sock data
- switch -glob $data(suffix) {
- *.php {set mimetype text/html}
- .* {set mimetype text/plain}
- default {tailcall Doc_NotFound.orig $sock}
- }
- # return a random amount of random crap
- exec head -[expr {int(rand()*10000000)}]c /dev/urandom > htdocs/load_of_crap
- Httpd_ReturnFile $sock $mimetype htdocs/load_of_crap
- }