Skip to content

Instantly share code, notes, and snippets.

View DeadPackets's full-sized avatar
💻
Hacking away

DeadPackets DeadPackets

💻
Hacking away
View GitHub Profile
@DeadPackets
DeadPackets / hosts2privoxy.py
Created June 18, 2017 09:11 — forked from chew-z/hosts2privoxy.py
Converts hosts file to privoxy action
#!/usr/bin/env python
# Takes amalgamated hosts file and converts to privoxy action file
# so you could block malicious hosts via proxy rather then /etc/hosts file
# See http://www.privoxy.org/faq/misc.html#HOSTSFILE
#
import re
import os
badguys_pattern = re.compile(
'^0.0.0.0(\s*|\t*)(.*)\n|^127.0.0.1(\s*|\t*)(.*)\n')