Build Blacklist .htaccess File
DZone's Guide to
Build Blacklist .htaccess File
Join the DZone community and get the full member experience.
Join For FreeI run ./blacklist_builder.py > .htaccess
every week or so...
"""
blacklist_builder.py
Get the entries from a blacklist
and print them to standard output
"""
latest = urllib2.urlopen("http://www.unknowngenius.com/blog/blacklist/")
str = ''
begin = "RewriteCond %{HTTP_REFERER} ^.*"
for line in latest:
str+= begin+ re.sub('(\s#:url:|\s#:regex-url:|\s#:rbl:)',
".*$ [OR]\n",line)
return str
Output looks like this...
RewriteCond %{HTTP_REFERER} ^.*zpics.net.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*zt148.com.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*zum-bestpreis.de.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*zxyzxy.com.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*fondos-pantalla..*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*.kucko.com.*$ [OR]
RewriteCond %{HTTP_REFERER} ^.*.gogof-ck.com.*$ [OR]
.....
Topics:
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}
{{ parent.urlSource.name }}