summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorJosef Gustafsson <josef.gson@gmail.com>2015-09-10 16:02:44 +0200
committerJosef Gustafsson <josef.gson@gmail.com>2015-09-10 16:02:44 +0200
commitf915c0883091bc63a800f1e264608d14fe94fd64 (patch)
tree92fac8388d5749f25ecfb42bc30c43653c79c0b6 /monitor
parentfba1ff8104fbe21b3ab647b2dc7cdb7a64a3bf70 (diff)
bugfix: finding data when looking in multiple domains
Diffstat (limited to 'monitor')
-rwxr-xr-xmonitor/josef_experimental.py93
-rwxr-xr-xmonitor/josef_leveldb.py10
2 files changed, 12 insertions, 91 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py
index 53f0147..80b4d13 100755
--- a/monitor/josef_experimental.py
+++ b/monitor/josef_experimental.py
@@ -29,100 +29,17 @@ monitored_domains = [
db = db_open("./tmpdatabase")
-db_add_domain(db, "www.cox.a.com", "{dummydata}")
-print db_lookup_domain(db, "www.cox.a.com")
+# db_add_domain(db, "www.cox.a.com", "{dummydata}")
+# print db_lookup_domain(db, "www.cox.a.com")
db_add_domain(db, "www.cox.b.com", "{dummydata}")
print db_lookup_domain(db, "www.cox.b.com")
-db_add_domain(db, "www.cox.a.com", "{dummydata3}")
-print db_lookup_domain(db, "www.cox.a.com")
+print db.Get("www.cox.b.com")
+# db_add_domain(db, "www.cox.a.com", "{dummydata3}")
+# print db_lookup_domain(db, "www.cox.a.com")
# print db.Get("com")
# print db.Get("a.com")
# print db.Get("cox.a.com")
# print db.Get("www.cox.a.com")
-# if args.domain:
-# db = db_open()
-# raw = db_lookup_domain(db, args.domain)
-# else:
-# print "No domain selected!"
-# sys.exit()
-
-# cur_time = dt.now()
-# count_valid = 0
-# count_all = 0
-# for item in raw:
-# # print item + '}', type(item)
-# try:
-# entry = json.loads((item + '}').replace("'", '"'))
-# except:
-# print (item + '}').replace("'", '"')
-# # print entry, type(entry)
-# success = True
-# not_after_time = dt.strptime(entry["not_after"], "%b %d %H:%M:%S %Y GMT")
-# not_before_time = dt.strptime(entry["not_before"], "%b %d %H:%M:%S %Y GMT")
-
-
-# if args.log:
-# if args.log in entry["log"]:
-# pass
-# else:
-# success = False
-
-# if cur_time > not_after_time:
-# expired = True
-# elif cur_time < not_before_time:
-# expired = True
-# else:
-# expired = False
-
-# # Exclude expired
-# if args.exclude_expired and expired:
-# success = False
-
-
-# # Set count matches
-# if success:
-# count_all += 1
-# if not expired:
-# count_valid += 1
-
-# # Print matching
-# if success:
-# s = entry["subject"].split("CN=")[1] + \
-# " certified by " + entry["issuer"].split("CN=")[1] + \
-# " (" + entry["log"] + ") "
-# if expired:
-# print "(NOT VALID) " + s
-# else:
-# print "(VALID) " + s
-
-
-# print str(count_all) + " matches found."
-
-
-# print res
-# print "Found " + str(len(res)) + " results"
-# print db.Get("wush.net")
-# 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
-
-
-
-
-
diff --git a/monitor/josef_leveldb.py b/monitor/josef_leveldb.py
index ac96211..23ca90f 100755
--- a/monitor/josef_leveldb.py
+++ b/monitor/josef_leveldb.py
@@ -67,8 +67,10 @@ def db_add_domain(db, domain, data):
next_k = item
else:
next_k = item + '.' + k
+ # print "Appending ", k, next_k
db_append(db, k, next_k)
k = next_k
+ # print "Appending ", k, data
db_append(db, k, data)
@@ -109,9 +111,11 @@ def db_lookup_domain(db, domain):
return res
# Prune
next_level = []
+ print intermediate
for item in intermediate:
+ print cur_domain, item
if match_domain(cur_domain, item):
- # print item
+ print item
try:
tmp = db.Get(item)
if tmp[1] == '{':
@@ -121,8 +125,8 @@ def db_lookup_domain(db, domain):
# print "Could not find " + item
pass
- else:
- intermediate.remove(item)
+ # else:
+ # intermediate.remove(item)
intermediate = next_level
return res