From 3e83fa21731317a46d5b2612012ae3567664afc9 Mon Sep 17 00:00:00 2001 From: Chris Truncer Date: Thu, 10 Sep 2015 22:49:20 -0400 Subject: [PATCH] Patch to work on newer python versions which validate ssl --- protocols/clients/https_client.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/protocols/clients/https_client.py b/protocols/clients/https_client.py index 148c6e8..376d271 100644 --- a/protocols/clients/https_client.py +++ b/protocols/clients/https_client.py @@ -4,6 +4,7 @@ This is the web client code ''' +import ssl import sys import urllib2 @@ -23,6 +24,15 @@ class Client: self.file_transfer = cli_object.file def transmit(self, data_to_transmit): + # This restores the same behavior as before. + try: + _create_unverified_https_context = ssl._create_unverified_context + except AttributeError: + # Legacy Python that doesn't verify HTTPS certificates by default + pass + else: + # Handle target environment that doesn't support HTTPS verification + ssl._create_default_https_context = _create_unverified_https_context if not self.file_transfer: url = "https://" + self.remote_server + "/post_data.php"