aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjobs/EmailChecker.py6
-rwxr-xr-xjobs/PeerChecker.py2
-rwxr-xr-xjobs/TLSCertExpiration.py2
-rwxr-xr-xservers.py2
4 files changed, 6 insertions, 6 deletions
diff --git a/jobs/EmailChecker.py b/jobs/EmailChecker.py
index 2689cb9..e3bed8f 100755
--- a/jobs/EmailChecker.py
+++ b/jobs/EmailChecker.py
@@ -26,10 +26,10 @@ class EmailChecker(JobBase.JobBase):
USER = self.config.get('email', 'user')
PASS = self.config.get('email', 'pass')
- logdetails = ""
+ logdetails = ""
#Generate a random subject
- subj = base64.b64encode(os.urandom(20))
+ subj = base64.b64encode(os.urandom(20)).decode("utf-8")
logdetails += "Target subject is " + subj + "\n\n"
if not self.sendEmail(subj, "", USER):
@@ -52,7 +52,7 @@ class EmailChecker(JobBase.JobBase):
logdetails += "Found IMAP item" + str(num) + "\n"
typ, data = M.fetch(num, '(BODY.PEEK[HEADER.FIELDS (Subject)])')
logdetails += "IMAP details: " + str(data) + "\n"
- if subj in data[0][1]:
+ if subj.encode("utf-8") in data[0][1]:
logdetails += "Found the target subject!!\n"
foundSubject = True
M.close()
diff --git a/jobs/PeerChecker.py b/jobs/PeerChecker.py
index dab78aa..8db692c 100755
--- a/jobs/PeerChecker.py
+++ b/jobs/PeerChecker.py
@@ -34,7 +34,7 @@ class PeerChecker(JobSpawner.JobSpawner):
self.body = ""
try:
- response = requests.get(self.checkurl)
+ response = requests.get(self.checkurl, timeout=5)
if response.status_code != 200:
peerOK = False
self.subject = self.checkurl + " returned a non-standard status code."
diff --git a/jobs/TLSCertExpiration.py b/jobs/TLSCertExpiration.py
index 1ef9328..dd704bd 100755
--- a/jobs/TLSCertExpiration.py
+++ b/jobs/TLSCertExpiration.py
@@ -43,7 +43,7 @@ class TLSCertExpiration(JobSpawner.JobSpawner):
c.request("GET", "/")
asn1 = c.sock.getpeercert(True)
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, asn1)
- na = time.mktime(time.strptime(x509.get_notAfter()[:-1], '%Y%m%d%H%M%S'))
+ na = time.mktime(time.strptime(x509.get_notAfter()[:-1].decode("utf-8"), '%Y%m%d%H%M%S'))
now = time.time()
delta = datetime.timedelta(seconds=(na - now))
if delta < datetime.timedelta(days=30):
diff --git a/servers.py b/servers.py
index 1529e0d..0a5d1ce 100755
--- a/servers.py
+++ b/servers.py
@@ -31,7 +31,7 @@ class PingSite(resource.Resource):
self.statusTracker = statusTracker
def render_POST(self, request):
self.statusTracker.markJobRan()
- emailStatus = request.content.read()
+ emailStatus = request.content.read().decode("utf-8")
emailStatus = "True" in emailStatus
logging.debug("Got notification of jobs ran")