Skip to content

Commit 6c82452

Browse files
committed
Convert utils/mk_client_whitelist.py and utils/dbconnect.py to py3.6 and move to utils/mk-client-whitelist/
1 parent 598091b commit 6c82452

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2.7
1+
#!/usr/bin/env python3.6
22
import MySQLdb
33

44
try: from db_private import DB_USER
@@ -7,7 +7,7 @@
77
try: from db_private import DB_PASS
88
except: DB_PASS = "root" # customise
99

10-
try: from db_private import DB_NAME
10+
try: from db_private import DB_NAME
1111
except: DB_NAME = "observatory_api"
1212

1313
TEST_DB_NAME = "tmp_TESTDB1"
@@ -21,4 +21,4 @@ def dbconnecttest():
2121
db = MySQLdb.connect(user=DB_USER, passwd=DB_PASS, db=TEST_DB_NAME)
2222
dbc = db.cursor()
2323
return db,dbc
24-
24+
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2.7
1+
#!/usr/bin/env python3.6
22

33
# Make a list of the current top 1,000 certs to whitelist from the
44
# Decentralized SSL Observatory's client submissions, to live in
@@ -17,15 +17,15 @@
1717
# run on the published datasets and read-only SQL servers too...
1818

1919
q = """
20-
SELECT hex(reports.chain_fp), count, `Validity:Not After`, Subject
21-
FROM reports JOIN chains ON reports.chain_fp = chains.chain_fp
20+
SELECT hex(reports.chain_fp), count, `Validity:Not After`, Subject
21+
FROM reports JOIN chains ON reports.chain_fp = chains.chain_fp
2222
JOIN new_parsed_certs ON reports.cert_fp = new_parsed_certs.cert_fp
23-
WHERE count > 1000 AND
24-
`Validity:Not After` > "%s"
25-
GROUP BY reports.chain_fp
26-
ORDER BY count DESC
23+
WHERE count > 1000 AND
24+
`Validity:Not After` > "{}"
25+
GROUP BY reports.chain_fp
26+
ORDER BY count DESC
2727
LIMIT 1000
28-
""" % (cutoff,)
28+
""".format(cutoff)
2929

3030
dbc.execute(q)
3131
results = dbc.fetchmany(1000)
@@ -36,14 +36,14 @@
3636

3737
header = """
3838
// These are SHA256 fingerprints for the most common chains observed by the
39-
// Decentralized SSL Observatory. These should not be resubmitted.
39+
// Decentralized SSL Observatory. These should not be resubmitted.
4040
// This file is automatically generated by utils/mk_client_whitelist.py
4141
4242
const X509ChainWhitelist = {"""
4343

4444
print(header)
4545
for chain_fp in sorted([row[0] for row in results]):
46-
print(" '%s' : true," % chain_fp)
46+
print(" '{}' : true,".format(chain_fp))
4747

4848
footer = "} ;"
4949
print(footer)

0 commit comments

Comments
 (0)