various mods
This commit is contained in:
parent
daa6db828a
commit
758763ace9
@ -4,7 +4,6 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
import urllib
|
import urllib
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
try:
|
try:
|
||||||
@ -17,21 +16,21 @@ domain_files = [os.path.join(dp, f) for dp, dn, fn in os.walk(os.path.expanduser
|
|||||||
|
|
||||||
def make_list(files):
|
def make_list(files):
|
||||||
blacklists = []
|
blacklists = []
|
||||||
for f in files:
|
for l in files:
|
||||||
splitlist = f.split("/")
|
splitlist = l.split("/")
|
||||||
list_type = splitlist[len(splitlist)-2]
|
list_type = splitlist[len(splitlist)-2]
|
||||||
blacklists.append([list_type,f])
|
blacklists.append([list_type,l])
|
||||||
return blacklists
|
return blacklists
|
||||||
|
|
||||||
def make_db(blacklist_files):
|
def make_db(blacklist_files):
|
||||||
lib = dict()
|
lib = dict()
|
||||||
for blacklist in blacklist_files:
|
for blacklist in blacklist_files:
|
||||||
cache = dict()
|
cache = dict()
|
||||||
values = []
|
|
||||||
f = open(blacklist[1], "r")
|
f = open(blacklist[1], "r")
|
||||||
for line in f:
|
for line in f:
|
||||||
cache[line.strip("\n")] = True
|
cache[line.strip("\n")] = True
|
||||||
lib[blacklist[0]] = cache
|
lib[blacklist[0]] = cache
|
||||||
|
del cache
|
||||||
return lib
|
return lib
|
||||||
|
|
||||||
def compare(outline,blacklist_cache,blacklists):
|
def compare(outline,blacklist_cache,blacklists):
|
||||||
@ -52,7 +51,7 @@ def squid_response(response):
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
blacklist_cache=[]
|
blacklist_cache = []
|
||||||
blacklist_files = make_list(domain_files)
|
blacklist_files = make_list(domain_files)
|
||||||
blacklist_cache = make_db(blacklist_files)
|
blacklist_cache = make_db(blacklist_files)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user