{"action":"created","comment":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/30795735","id":30795735,"diff_hunk":"@@ -0,0 +1,116 @@\n+#!/usr/bin/env python\n+\"\"\"Submits a chain to a list of logs.\"\"\"\n+\n+import base64\n+import hashlib\n+import sys\n+\n+import json\n+import logging\n+import gflags\n+\n+from ct.client import log_client\n+from ct.crypto import cert\n+from ct.crypto import error\n+from ct.crypto import pem\n+from ct.crypto import verify\n+from ct.proto import client_pb2\n+from ct.serialization import tls_message\n+\n+FLAGS = gflags.FLAGS\n+\n+gflags.DEFINE_string(\"log_list\", None, \"List of logs to submit to.\")\n+gflags.DEFINE_string(\"chain\", None, \"Certificate chain to submit (PEM).\")\n+gflags.DEFINE_string(\"log_schema\", \"http\", \"Log schema (http/https)\")\n+gflags.DEFINE_string(\"output\", None, \"output file for sct_list\")\n+gflags.MarkFlagAsRequired(\"log_list\")\n+gflags.MarkFlagAsRequired(\"chain\")\n+gflags.MarkFlagAsRequired(\"output\")\n+\n+def _read_ct_log_list(log_list_file):\n+    \"\"\"Parses the log list JSON, returns a log url to key map.\"\"\"\n+    try:\n+        log_list_json = json.loads(log_list_file)\n+        log_url_to_key = {}\n+        for log_info in log_list_json['logs']:\n+            log_url_to_key[FLAGS.log_schema + '://' + log_info['url']] = (","path":"python/utilities/submit_chain/submit_chain.py","position":36,"original_position":36,"commit_id":"2789334e3be57751e2c554d5b358454faa5e0563","original_commit_id":"2789334e3be57751e2c554d5b358454faa5e0563","user":{"login":"pphaneuf","id":40400,"avatar_url":"https://avatars.githubusercontent.com/u/40400?v=3","gravatar_id":"","url":"https://api.github.com/users/pphaneuf","html_url":"https://github.com/pphaneuf","followers_url":"https://api.github.com/users/pphaneuf/followers","following_url":"https://api.github.com/users/pphaneuf/following{/other_user}","gists_url":"https://api.github.com/users/pphaneuf/gists{/gist_id}","starred_url":"https://api.github.com/users/pphaneuf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pphaneuf/subscriptions","organizations_url":"https://api.github.com/users/pphaneuf/orgs","repos_url":"https://api.github.com/users/pphaneuf/repos","events_url":"https://api.github.com/users/pphaneuf/events{/privacy}","received_events_url":"https://api.github.com/users/pphaneuf/received_events","type":"User","site_admin":false},"body":"I would +1 that, especially if it's allowed to host a log on any arbitrary URL (like http://example.com/submariner/, say, where getting the STH would be http://example.com/submariner/ct/v1/get-sth).","created_at":"2015-05-21T12:14:50Z","updated_at":"2015-05-21T12:14:50Z","html_url":"https://github.com/google/certificate-transparency/pull/757#discussion_r30795735","pull_request_url":"https://api.github.com/repos/google/certificate-transparency/pulls/757","_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments/30795735"},"html":{"href":"https://github.com/google/certificate-transparency/pull/757#discussion_r30795735"},"pull_request":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/757"}}},"pull_request":{"url":"https://api.github.com/repos/google/certificate-transparency/pulls/757","id":35868535,"html_url":"https://github.com/google/certificate-transparency/pull/757","diff_url":"https://github.com/google/certificate-transparency/pull/757.diff","patch_url":"https://github.com/google/certificate-transparency/pull/757.patch","issue_url":"https://api.github.com/repos/google/certificate-transparency/issues/757","number":757,"state":"open","locked":false,"title":"Adding a small Python utility to submit certificate chains.","user":{"login":"eranmes","id":1072163,"avatar_url":"https://avatars.githubusercontent.com/u/1072163?v=3","gravatar_id":"","url":"https://api.github.com/users/eranmes","html_url":"https://github.com/eranmes","followers_url":"https://api.github.com/users/eranmes/followers","following_url":"https://api.github.com/users/eranmes/following{/other_user}","gists_url":"https://api.github.com/users/eranmes/gists{/gist_id}","starred_url":"https://api.github.com/users/eranmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranmes/subscriptions","organizations_url":"https://api.github.com/users/eranmes/orgs","repos_url":"https://api.github.com/users/eranmes/repos","events_url":"https://api.github.com/users/eranmes/events{/privacy}","received_events_url":"https://api.github.com/users/eranmes/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-20T19:45:16Z","updated_at":"2015-05-21T12:14:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2183da1cd6c830c23c29855c819dfbb73f4a67c2","assignee":{"login":"phad","id":874173,"avatar_url":"https://avatars.githubusercontent.com/u/874173?v=3","gravatar_id":"","url":"https://api.github.com/users/phad","html_url":"https://github.com/phad","followers_url":"https://api.github.com/users/phad/followers","following_url":"https://api.github.com/users/phad/following{/other_user}","gists_url":"https://api.github.com/users/phad/gists{/gist_id}","starred_url":"https://api.github.com/users/phad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phad/subscriptions","organizations_url":"https://api.github.com/users/phad/orgs","repos_url":"https://api.github.com/users/phad/repos","events_url":"https://api.github.com/users/phad/events{/privacy}","received_events_url":"https://api.github.com/users/phad/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/google/certificate-transparency/pulls/757/commits","review_comments_url":"https://api.github.com/repos/google/certificate-transparency/pulls/757/comments","review_comment_url":"https://api.github.com/repos/google/certificate-transparency/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/certificate-transparency/issues/757/comments","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/2789334e3be57751e2c554d5b358454faa5e0563","head":{"label":"eranmes:py_submit_chain","ref":"py_submit_chain","sha":"2789334e3be57751e2c554d5b358454faa5e0563","user":{"login":"eranmes","id":1072163,"avatar_url":"https://avatars.githubusercontent.com/u/1072163?v=3","gravatar_id":"","url":"https://api.github.com/users/eranmes","html_url":"https://github.com/eranmes","followers_url":"https://api.github.com/users/eranmes/followers","following_url":"https://api.github.com/users/eranmes/following{/other_user}","gists_url":"https://api.github.com/users/eranmes/gists{/gist_id}","starred_url":"https://api.github.com/users/eranmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranmes/subscriptions","organizations_url":"https://api.github.com/users/eranmes/orgs","repos_url":"https://api.github.com/users/eranmes/repos","events_url":"https://api.github.com/users/eranmes/events{/privacy}","received_events_url":"https://api.github.com/users/eranmes/received_events","type":"User","site_admin":false},"repo":{"id":20220876,"name":"certificate-transparency","full_name":"eranmes/certificate-transparency","owner":{"login":"eranmes","id":1072163,"avatar_url":"https://avatars.githubusercontent.com/u/1072163?v=3","gravatar_id":"","url":"https://api.github.com/users/eranmes","html_url":"https://github.com/eranmes","followers_url":"https://api.github.com/users/eranmes/followers","following_url":"https://api.github.com/users/eranmes/following{/other_user}","gists_url":"https://api.github.com/users/eranmes/gists{/gist_id}","starred_url":"https://api.github.com/users/eranmes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eranmes/subscriptions","organizations_url":"https://api.github.com/users/eranmes/orgs","repos_url":"https://api.github.com/users/eranmes/repos","events_url":"https://api.github.com/users/eranmes/events{/privacy}","received_events_url":"https://api.github.com/users/eranmes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eranmes/certificate-transparency","description":"Auditing for TLS certificates.","fork":true,"url":"https://api.github.com/repos/eranmes/certificate-transparency","forks_url":"https://api.github.com/repos/eranmes/certificate-transparency/forks","keys_url":"https://api.github.com/repos/eranmes/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eranmes/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eranmes/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/eranmes/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/eranmes/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/eranmes/certificate-transparency/events","assignees_url":"https://api.github.com/repos/eranmes/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/eranmes/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/eranmes/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/eranmes/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eranmes/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eranmes/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/eranmes/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eranmes/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/eranmes/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/eranmes/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/eranmes/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/eranmes/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/eranmes/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/eranmes/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/eranmes/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/eranmes/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/eranmes/certificate-transparency/issues/comments{/number}","contents_url":"https://api.github.com/repos/eranmes/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/eranmes/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eranmes/certificate-transparency/merges","archive_url":"https://api.github.com/repos/eranmes/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eranmes/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/eranmes/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/eranmes/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/eranmes/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/eranmes/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eranmes/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/eranmes/certificate-transparency/releases{/id}","created_at":"2014-05-27T13:28:02Z","updated_at":"2015-04-27T16:52:06Z","pushed_at":"2015-05-20T16:16:41Z","git_url":"git://github.com/eranmes/certificate-transparency.git","ssh_url":"git@github.com:eranmes/certificate-transparency.git","clone_url":"https://github.com/eranmes/certificate-transparency.git","svn_url":"https://github.com/eranmes/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":19229,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"18da1bad4cafdb0f74a63f829b0548d2e9966144","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19989605,"name":"certificate-transparency","full_name":"google/certificate-transparency","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/certificate-transparency","description":"Auditing for TLS certificates.","fork":false,"url":"https://api.github.com/repos/google/certificate-transparency","forks_url":"https://api.github.com/repos/google/certificate-transparency/forks","keys_url":"https://api.github.com/repos/google/certificate-transparency/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/certificate-transparency/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/certificate-transparency/teams","hooks_url":"https://api.github.com/repos/google/certificate-transparency/hooks","issue_events_url":"https://api.github.com/repos/google/certificate-transparency/issues/events{/number}","events_url":"https://api.github.com/repos/google/certificate-transparency/events","assignees_url":"https://api.github.com/repos/google/certificate-transparency/assignees{/user}","branches_url":"https://api.github.com/repos/google/certificate-transparency/branches{/branch}","tags_url":"https://api.github.com/repos/google/certificate-transparency/tags","blobs_url":"https://api.github.com/repos/google/certificate-transparency/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/certificate-transparency/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/certificate-transparency/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/certificate-transparency/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/certificate-transparency/statuses/{sha}","languages_url":"https://api.github.com/repos/google/certificate-transparency/languages","stargazers_url":"https://api.github.com/repos/google/certificate-transparency/stargazers","contributors_url":"https://api.github.com/repos/google/certificate-transparency/contributors","subscribers_url":"https://api.github.com/repos/google/certificate-transparency/subscribers","subscription_url":"https://api.github.com/repos/google/certificate-transparency/subscription","commits_url":"https://api.github.com/repos/google/certificate-transparency/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/certificate-transparency/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/certificate-transparency/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/certificate-transparency/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/certificate-transparency/contents/{+path}","compare_url":"https://api.github.com/repos/google/certificate-transparency/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/certificate-transparency/merges","archive_url":"https://api.github.com/repos/google/certificate-transparency/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/certificate-transparency/downloads","issues_url":"https://api.github.com/repos/google/certificate-transparency/issues{/number}","pulls_url":"https://api.github.com/repos/google/certificate-transparency/pulls{/number}","milestones_url":"https://api.github.com/repos/google/certificate-transparency/milestones{/number}","notifications_url":"https://api.github.com/repos/google/certificate-transparency/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/certificate-transparency/labels{/name}","releases_url":"https://api.github.com/repos/google/certificate-transparency/releases{/id}","created_at":"2014-05-20T17:03:47Z","updated_at":"2015-05-21T01:52:46Z","pushed_at":"2015-05-21T10:50:32Z","git_url":"git://github.com/google/certificate-transparency.git","ssh_url":"git@github.com:google/certificate-transparency.git","clone_url":"https://github.com/google/certificate-transparency.git","svn_url":"https://github.com/google/certificate-transparency","homepage":"http://www.certificate-transparency.org/","size":26325,"stargazers_count":130,"watchers_count":130,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":39,"mirror_url":null,"open_issues_count":45,"forks":39,"open_issues":45,"watchers":130,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/757"},"html":{"href":"https://github.com/google/certificate-transparency/pull/757"},"issue":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/757"},"comments":{"href":"https://api.github.com/repos/google/certificate-transparency/issues/757/comments"},"review_comments":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/757/comments"},"review_comment":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/certificate-transparency/pulls/757/commits"},"statuses":{"href":"https://api.github.com/repos/google/certificate-transparency/statuses/2789334e3be57751e2c554d5b358454faa5e0563"}}}}