summaryrefslogtreecommitdiff
path: root/monitor/josef_leveldb.py
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/josef_leveldb.py')
-rwxr-xr-xmonitor/josef_leveldb.py57
1 files changed, 7 insertions, 50 deletions
diff --git a/monitor/josef_leveldb.py b/monitor/josef_leveldb.py
index e985e8d..cee0035 100755
--- a/monitor/josef_leveldb.py
+++ b/monitor/josef_leveldb.py
@@ -73,18 +73,19 @@ def db_add_certs(db, data):
print "ERROR: NO DATABASE SET!"
return
# print data, type(data)
+ # batch = leveldb.WriteBatch()
for cert in data:
try:
db_add_domain(db, cert["subject"].split("CN=")[1], str(cert))
- except:
- # print "Failed adding Subject in " + str(cert)
+ except IndexError:
pass
- try:
+ # try:
for line in cert["SAN"].split("DNS:")[1:]:
db_add_domain(db, line, str(cert))
- except:
- # print "Failed adding SAN in " + str(cert)
- pass
+ # except:
+ # # print "Failed adding SAN in " + str(cert)
+ # pass
+ # db.Write(batch, sync = True)
@@ -125,50 +126,6 @@ def db_lookup_domain(db, domain):
return res
-# db_open()
-# # print db_lookup_domain("*.cox.com")
-# print db.Get("wush.net")
-
-# f = open("output/cert_data.json")
-# max_count = 1
-# for line in f:
-# # print max_count
-# # try:
-# tmp = json.loads(line)
-# # print tmp
-# # d = tmp["subject"].split("CN=")[1]
-# db_add_cert(tmp)
-# # print d
-
-# max_count -= 1
-# if max_count == 0:
-# break
- # except:
- # pass
-
- # tmp_res = ""
- # # print domain_list
- # # print tmp_res[:-1]
- # last = False
-
- # for i in range(3):
- # try:
- # except:
- # last = True
- # new_res_list = []
- # print len(tmp_res_list)
- # print tmp_res
- # for item in tmp_res_list:
- # if not last:
- # if match_domain(tmp_res, item):
- # new_res_list.append(item)
- # else:
- # res.append(item)
- # # print item
- # tmp_res_list = new_res_list
- # return res
-
-