summaryrefslogtreecommitdiff
path: root/monitor/josef_experimental.py
diff options
context:
space:
mode:
authorjosef <josef.gson@gmail.com>2015-11-10 09:56:56 +0100
committerjosef <josef.gson@gmail.com>2015-11-10 09:56:56 +0100
commit6885ec5ce5c478cd7e607bbe283554eddb536158 (patch)
tree561e17f4971796211b6d34b3984c59f6107b24b0 /monitor/josef_experimental.py
parentffcd056438f907f27de46129c34026d786129245 (diff)
adding issuer monitoring for lets encrypt
Diffstat (limited to 'monitor/josef_experimental.py')
-rwxr-xr-xmonitor/josef_experimental.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py
index 6c74db9..2ccfceb 100755
--- a/monitor/josef_experimental.py
+++ b/monitor/josef_experimental.py
@@ -4,9 +4,9 @@
import sys
import os
from josef_lib import *
-from josef_lib2 import *
+# from josef_lib2 import *
# import leveldb
-import argparse
+# import argparse
import json
import time
# from josef_leveldb import *
@@ -134,7 +134,10 @@ def parse_entry(e, idx, log):
s = log["name"]
s += sep + str(idx) # index
s += sep + e["subject"] # Subject
- s += sep + e["SAN"] # SAN
+ if "SAN" in e:
+ s += sep + e["SAN"] # SAN
+ else:
+ s += sep
s += sep + e["issuer"] # issuer
s += sep + e["chain_length"] # path length
s += sep + e["sig_algorithm"] # Signature algothithm
@@ -146,16 +149,18 @@ def parse_entry(e, idx, log):
return s
-def check_api2(url):
- print "\nTesting " + url
- try:
- print get_sth_v2(url)
- except:
- print "GET STH Failed..."
+# def check_api2(url):
+# print "\nTesting " + url
+# try:
+# print get_sth_v2(url)
+# except:
+# print "GET STH Failed..."
+
+
if __name__ == '__main__':
-
+ # prompt_confirm("you are about to remove file")
# Find let's encrypt certs
if False:
@@ -177,21 +182,24 @@ if __name__ == '__main__':
# Data gathering for Niklas
- if False:
+ if True:
log = CTLOGS[0]
sth = get_sth(log["url"])
# size = sth["tree_size"]
# for i in range(15,200):
- start = 5757748
- end = 5757847
+ 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 = "ct_log_content.txt"
+ filename = log["name"] + "_content.txt"
# TODO remove file if exists
if os.path.exists(filename):
- os.remove(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