diff options
Diffstat (limited to 'monitor/josef_experimental.py')
-rwxr-xr-x | monitor/josef_experimental.py | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py index 49c9e09..c9a94e2 100755 --- a/monitor/josef_experimental.py +++ b/monitor/josef_experimental.py @@ -169,9 +169,21 @@ def parse_entry(e, idx, log): +from subprocess import call +def email(s): + for addr in EMAIL_ADDR: + command = 'echo "' + s + '" | mail -s "' + EMAIL_SUBJECT + '" ' + addr + command = 'echo "message content" | mail -s "' + EMAIL_SUBJECT + '" josef@nordu.net' + os.system("bash -c '" + command + "'") + + + if __name__ == '__main__': - # prompt_confirm("you are about to remove file") + # Test email + if True: + email("this is an automated test") + # Find let's encrypt certs if False: @@ -204,7 +216,7 @@ if __name__ == '__main__': print parse_entry(res,0,log) # Data gathering for Niklas - if True: + if False: logs = [CTLOGS[9]] #,CTLOGS[4],CTLOGS[7],CTLOGS[8],CTLOGS[9]] for log in logs: filename = log["name"] + "_content.txt" @@ -233,9 +245,24 @@ if __name__ == '__main__': idx += len(entries) - - - + # Test consistency + if False: + url = "https://ct.googleapis.com/aviator/" + sth1 = json.loads('{"sth": {"timestamp": 1447820379698, "sha256_root_hash": "adJNwPSYP0XOadNQEVF1nZSVZ+ojN9ORPXEdjRMhC8U=", "tree_size": 9867417, "tree_head_signature": "BAMARzBFAiEAwa1SAOMb5k/QQTDQvTPqDkGi43esqg04Em1MHJ6tpckCIBedSUATxgSB3AfIxq/UlP5KtlfuaMGRZYcbUIF0UWyC"}}')["sth"] + sth2 = json.loads('{"sth": {"tree_size":10068846,"timestamp":1448889471701,"sha256_root_hash":"1L+e36K1yiynAgaWG+olJ2mEmv2bEyZCzY7YYmJfFas=","tree_head_signature":"BAMASDBGAiEArW7hREfWjArGlUohSIMZvaHnm+jsD0NTCZmAoFYBFYMCIQCEtnV/iX7oDqMb2vr0eP3Ex8Q65rncqg5SGw0z7cefBA=="}}')["sth"] + + # url = "https://gaol.ct.nordu.net/open/" + # sth2 = json.loads('{"sth": {"timestamp":1448893523957,"sha256_root_hash":"APf+TzOLNooNAF0Ka59C9n+dLRccMKZ/S5TNKULuolM=","tree_size":5,"tree_head_signature":"BAMARjBEAiAmmxUE3xC1HePGEZvUaubi0WlzwhW+SiTu5hvvxquLhQIgAoRms8ogotonyuoFHZaxWxJMkh9d9l+ZsJ/Jee2VTTo="}}')["sth"] + # sth1 = json.loads('{"sth": {"timestamp":1448639930117,"sha256_root_hash":"FliDqU/S5o+qMPS42nwYy9b1/kKEldeedad/5vDl+UA=","tree_size":2,"tree_head_signature":"BAMARzBFAiBEOSbEdnzBGeUV+AGzJUs/ekf5Sq/SRbrxxiDKN23yNAIhAOTrwhYFHg3a6iLrGoz0QoIjOW8PckRJ/1oayj3993Cl"}}')["sth"] + + cons = get_consistency_proof(url, sth1["tree_size"], sth2["tree_size"]) + decoded_consistency_proof = [] + for item in cons: + decoded_consistency_proof.append(base64.b64decode(item)) + res = verify_consistency_proof(decoded_consistency_proof, sth1["tree_size"], sth2["tree_size"], base64.b64decode(sth1["sha256_root_hash"])) + print sth1["sha256_root_hash"], sth2["sha256_root_hash"] + # print res + print base64.b64encode(res[0]), base64.b64encode(res[1]) |