diff options
Diffstat (limited to 'monitor/josef_monitor.py')
-rwxr-xr-x | monitor/josef_monitor.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index 6c189ca..a32cf7d 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -122,6 +122,7 @@ class ctlog: def log(self, string): s = time.strftime('%Y-%m-%d %H:%M:%S') + " " + string + s = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S') + " " + string with open(self.logfile, 'a') as f: f.write(s + "\n") f.close() @@ -133,12 +134,11 @@ class ctlog: self.log("Failed to fetch STH. " +str(e)) return - # try: - check_sth_signature(self.url, new_sth, base64.b64decode(self.key)) - # check_sth_signature(self.url, new_sth, None) - # except: - # self.log("ERROR: Could not verify STH signature") - # print "ERROR: Could not verify STH signature from " + self.url + try: + check_sth_signature(self.url, new_sth, base64.b64decode(self.key)) + except: + self.log("ERROR: Could not verify STH signature") + print "ERROR: Could not verify STH signature from " + self.url sth_time = datetime.datetime.fromtimestamp(new_sth['timestamp'] / 1000, UTC()).strftime("%Y-%m-%d %H:%M:%S") if new_sth["timestamp"] != self.sth["timestamp"]: @@ -444,17 +444,17 @@ def main(args): open(CONFIG.DOMAINS_FILE, 'w').write(json.dumps(domain_dict)) # Something went horribly wrong! - # except Exception, err: - # print Exception, err - # for log in logs: - # log.save() - - # # Save info about monitored domains - # domain_dict = [] - # if len(monitored_domains) > 0: - # for md in monitored_domains: - # domain_dict.append(md.to_dict()) - # open(CONFIG.DOMAINS_FILE, 'w').write(json.dumps(domain_dict)) + except Exception, err: + print Exception, err + for log in logs: + log.save() + + # Save info about monitored domains + domain_dict = [] + if len(monitored_domains) > 0: + for md in monitored_domains: + domain_dict.append(md.to_dict()) + open(CONFIG.DOMAINS_FILE, 'w').write(json.dumps(domain_dict)) |