|
1 | | -#!/usr/bin/env python2.7 |
| 1 | +#!/usr/bin/env python3.6 |
2 | 2 |
|
3 | 3 | # Make a list of the current top 1,000 certs to whitelist from the |
4 | 4 | # Decentralized SSL Observatory's client submissions, to live in |
|
17 | 17 | # run on the published datasets and read-only SQL servers too... |
18 | 18 |
|
19 | 19 | 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 |
22 | 22 | 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 |
27 | 27 | LIMIT 1000 |
28 | | -""" % (cutoff,) |
| 28 | +""".format(cutoff) |
29 | 29 |
|
30 | 30 | dbc.execute(q) |
31 | 31 | results = dbc.fetchmany(1000) |
|
36 | 36 |
|
37 | 37 | header = """ |
38 | 38 | // 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. |
40 | 40 | // This file is automatically generated by utils/mk_client_whitelist.py |
41 | 41 |
|
42 | 42 | const X509ChainWhitelist = {""" |
43 | 43 |
|
44 | 44 | print(header) |
45 | 45 | for chain_fp in sorted([row[0] for row in results]): |
46 | | - print(" '%s' : true," % chain_fp) |
| 46 | + print(" '{}' : true,".format(chain_fp)) |
47 | 47 |
|
48 | 48 | footer = "} ;" |
49 | 49 | print(footer) |
|
0 commit comments