summaryrefslogtreecommitdiff
path: root/monitor/josef_leveldb.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/josef_leveldb.py')
-rwxr-xr-xmonitor/josef_leveldb.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/monitor/josef_leveldb.py b/monitor/josef_leveldb.py
index 9994609..9c6f77d 100755
--- a/monitor/josef_leveldb.py
+++ b/monitor/josef_leveldb.py
@@ -7,8 +7,6 @@ import leveldb
import ast
SEP = ";"
-# db = None
-
dbs = {}
@@ -41,7 +39,6 @@ def db_open(fn='./cert_db'):
if fn in dbs:
return dbs[fn]
else:
- # print "Opening " + fn
db = leveldb.LevelDB(fn)
dbs[fn] = db
return db
@@ -68,9 +65,7 @@ def db_append(db, key, val):
def db_add_domain_2(db_dir, key_in, val_in, db_in=None):
if db_in == None:
- # print val_in
val = "###" + ast.literal_eval(val_in)["leaf_hash"]
- # val = str(hash(val_in))
cert_db = db_open(db_dir + "certificates")
cert_db.Put(val, val_in)
@@ -119,7 +114,7 @@ def db_add_certs(db_dir, data):
pass
except IndexError:
pass
- db_close()
+ # db_close()
def db_lookup_domain(db_dir, domain):
@@ -135,7 +130,6 @@ def db_lookup_domain(db_dir, domain):
db = db_open(db_dir + "other")
cur_domain = domain_list.pop()
- # print cur_domain
try:
intermediate = db.Get(cur_domain).split(SEP)
except KeyError:
@@ -156,13 +150,11 @@ def db_lookup_domain(db_dir, domain):
# Prune
next_level = []
for item in intermediate:
- # print item
if match_domain(cur_domain, item):
- # print item
try:
tmp = db.Get(item).split(SEP)
- # print tmp
for tmp_item in tmp:
+ # This is really not a good solution...
if tmp_item[0:3] == "###":
res.append(tmp_item[3:])
else:
@@ -173,7 +165,6 @@ def db_lookup_domain(db_dir, domain):
certs = []
cert_db = db_open(db_dir + "certificates")
- # print res
for item in res:
tmp = cert_db.Get("###" + str(item))
certs.append(tmp)