Oxfilter is a project mainly written in C and SHELL, it's free.
Apache output filter for advertisment/counter insertion