summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorjosef <josef.gson@gmail.com>2015-11-10 12:57:53 +0100
committerjosef <josef.gson@gmail.com>2015-11-10 12:57:53 +0100
commit99306083f68513cd04e3d1634ad7eb71b5733132 (patch)
tree2ce837e38fdc80ee6d62f0d224293ce72b5c596b /monitor
parent6885ec5ce5c478cd7e607bbe283554eddb536158 (diff)
debugging
Diffstat (limited to 'monitor')
-rwxr-xr-xmonitor/josef_experimental.py50
-rw-r--r--monitor/josef_lib.py5
2 files changed, 30 insertions, 25 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py
index 2ccfceb..ba85a71 100755
--- a/monitor/josef_experimental.py
+++ b/monitor/josef_experimental.py
@@ -183,31 +183,31 @@ if __name__ == '__main__':
# Data gathering for Niklas
if True:
- log = CTLOGS[0]
- sth = get_sth(log["url"])
- # size = sth["tree_size"]
- # for i in range(15,200):
- start = 0
- end = int(sth["tree_size"]) - 1
- print "Getting " + str(start) + " to " + str(end)
- entries = get_entries(log["url"],start ,end)["entries"]
-
- # TODO set filename
- filename = log["name"] + "_content.txt"
- # TODO remove file if exists
- if os.path.exists(filename):
- if prompt_confirm("You are about to overwrite " + filename):
- os.remove(filename)
- else:
- sys.exit()
- # TODO open file
- with open(filename, 'a') as f:
- # TODO write lines
- for i in range(len(entries)):
- entry = entries[i]
- res = check_domain_extended(entry)
- string = parse_entry(res, i + start, log)
- f.write(string + "\n")
+ logs = [CTLOGS[7]]
+ for log in logs:
+ filename = log["name"] + "_content.txt"
+ if os.path.exists(filename):
+ if prompt_confirm("You are about to overwrite " + filename):
+ os.remove(filename)
+ else:
+ sys.exit()
+
+ sth = get_sth(log["url"])
+ start = 0
+ idx = 0
+ end = int(sth["tree_size"]) - 1
+
+ while 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)
+ f.write(string + "\n")
diff --git a/monitor/josef_lib.py b/monitor/josef_lib.py
index 46a0eee..745ae3e 100644
--- a/monitor/josef_lib.py
+++ b/monitor/josef_lib.py
@@ -110,6 +110,10 @@ def check_domain_extended(raw_entry, log=None):
orig_entry = extract_original_entry(raw_entry)
try:
cert_info = my_get_more_cert_info(orig_entry[0][0])
+ except:
+ print "Error in my_get_more_cert_info"
+ return None
+ try:
# print len(orig_entry[0])
cert_info["chain_length"] = str(len(orig_entry[0]))
cert_info["validation"] = get_validation_type(cert_info["policy"])
@@ -119,6 +123,7 @@ def check_domain_extended(raw_entry, log=None):
cert_info["log"] = log[8:-1] # strip generic URL stuff
return cert_info
except IndexError:
+ print "Error while setting additional parameters"
return None
def check_domain_all(raw_entry, log=None):