1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import time
import datetime
import os
import json
from monitor_conf import *
from josef_lib import *
def print_reply(rep, entry, precert):
t = datetime.datetime.fromtimestamp(rep['timestamp'] / 1000, UTC()).strftime("%Y-%m-%d %H:%M:%S")
log_id = rep["id"]
# print res
print "Time:", t
for log in ctlogs:
if str(log_id) == log["id"]:
l = log
break
else:
l = {"name" : "Log not found" + log_id}
print "Log:", l["name"]
# check_sct_signature(log["url"], entry, rep, precert, log["key"])
# print "Signature: CHECKING NOT IMPLEMENTED YET!"
# print ""
source = ctlogs[0]
dests = [ctlogs[1]]
first = 21001
last = 22000
entries = get_entries(source["url"], first, last)["entries"]
# print entries
for log in dests:
for item in entries:
entry = extract_original_entry(item)
if entry[2]:
precert = True
else:
precert = False
submission = []
for e in entry[0]:
submission.append(base64.b64encode(e))
if precert:
res = add_prechain(log["url"], {"chain" : submission})
else:
res = add_chain(log["url"], {"chain" : submission})
print_reply(res, entry, precert)
time.sleep(5)
|