summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosef <josef.gson@gmail.com>2015-11-11 09:42:11 +0100
committerjosef <josef.gson@gmail.com>2015-11-11 09:42:11 +0100
commite9a1c2d0838ab42d4eabf9d45318e9570670c13f (patch)
tree2f79b748025a85452cffbaac348715c9942f3c8e
parente260f505c405eef5030749e45361a43b6bf0e87f (diff)
fixes for keylength parsing and indexing
-rwxr-xr-xmonitor/josef_experimental.py29
-rw-r--r--monitor/josef_lib.py1
2 files changed, 22 insertions, 8 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py
index a6d6aa9..e6c3c1a 100755
--- a/monitor/josef_experimental.py
+++ b/monitor/josef_experimental.py
@@ -143,7 +143,14 @@ def parse_entry(e, idx, log):
s += sep + e["chain_length"] # path length
s += sep + e["sig_algorithm"] # Signature algothithm
s += sep + e["pubkey_algorithm"] # pubkey algorithm
- s += sep + e["keylength"]
+
+ try:
+ s += sep + e["keylength"]
+ except:
+ s += sep
+ print "\nERROR: COUND NOT FIND KEYLENGTH!"
+ print str(e)
+
s += sep + e["not_before"] # valid from
s += sep + e["not_after"] # valid to
s += sep + e["validation"] # EV?
@@ -185,8 +192,8 @@ if __name__ == '__main__':
# Experimental
if False:
- log = CTLOGS[9]
- entries = get_entries(log["url"],1 ,1)["entries"]
+ log = CTLOGS[2]
+ entries = get_entries(log["url"],4074 ,4074)["entries"]
entry = entries[0]
print check_domain_all(entry)
# res = check_domain_extended(entry)
@@ -194,7 +201,7 @@ if __name__ == '__main__':
# Data gathering for Niklas
if True:
- logs = [CTLOGS[9]]
+ logs = [CTLOGS[2]]
for log in logs:
filename = log["name"] + "_content.txt"
if os.path.exists(filename):
@@ -204,22 +211,28 @@ if __name__ == '__main__':
sys.exit()
sth = get_sth(log["url"])
- start = 0
+ start = 4050
idx = 0
end = int(sth["tree_size"]) - 1
- while idx < end:
+ while start + idx < end:
entries = get_entries(log["url"],start + idx ,end)["entries"]
print log["name"] + ": Got " + str(start + idx) + " to " + str(start + idx + len(entries) - 1)
- idx = idx + len(entries)
with open(filename, 'a') as f:
for i in range(len(entries)):
entry = entries[i]
res = check_domain_extended(entry)
- string = parse_entry(res, i + start, log)
+ string = parse_entry(res, i + start + idx, log)
f.write(string + "\n")
+ idx += len(entries)
+
+
+
+
+
+
diff --git a/monitor/josef_lib.py b/monitor/josef_lib.py
index 6b16b03..5ee6255 100644
--- a/monitor/josef_lib.py
+++ b/monitor/josef_lib.py
@@ -257,6 +257,7 @@ def my_get_more_cert_info(s):
raise Exception
result = {}
result["policy"] = []
+ result["keylength"] = "N/A" # Default value
prev = ""
for line in parsed[0].split("\n"):
if "Subject:" in line: