summaryrefslogtreecommitdiff
path: root/monitor/josef_reader.py
blob: bf415f74264eca2463f45d8470c5516b041a9b98 (plain)
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
#!/usr/bin/python
# -*- coding: utf-8 -*-     

import sys
from certtools import *
import argparse



parser = argparse.ArgumentParser(description="")
parser.add_argument('--domain', default=None, help="RTFM")
parser.add_argument('--exclude-expired', action='store_true', help="RTFM")

args = parser.parse_args()

monitored_domains = [
    "google.com",
    "preishelden.de",
    "liu.se",
    "nordu.net",
    "symantec.com",
]



# data = []
f = open("plausible_cert_data.json")
for line in f:
    tmp = json.loads(line)
    try: 
        success = True

        if args.domain:
            if args.domain in tmp["subject"].split("CN=")[1] or \
            args.domain in tmp["SAN"]:
                pass
            else:
                success = False

        if args.exclude_expired:
            print "EXCLUDE EXPIRED NOT IMPLEMENTED YET"


        if success:
            print tmp["subject"].split("CN=")[1] + " certified by " + tmp["issuer"].split("CN=")[1]
    except:
        pass

f.close()

# for item in data[10000:]:
#     try:
#         s = item["subject"].split("CN=")[1]
#         print "\n" + s
#         print item["SAN"]
#     except:
#         pass

# print "\nTotal entries: " + str(len(data))